|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Represents a server instance. Every server is an instance of a particular, fixed server type.
Not surprisingly, the notion of server is central in the web tools server infrastructure. In this context, understand that a server is a web server of some ilk. It could be a simple web server lacking Java support, or an J2EE based server, or perhaps even some kind of database server. A more exact definition is not required for the purposes of this API. From a tool-centric point of view, a server is something that the developer is writing "content" for. The unit of content is termed a module. In a sense, the server exists, but lacks useful content. The development task is to provide that content. The content can include anything from simple, static HTML web pages to complex, highly dynamic web applications. In the course of writing and debugging this content, the developer will want to test their content on a web server, to see how it gets served up. For this they will need to launch a server process running on some host machine (often the local host on which the IDE is running), or attach to a server that's already running on a remote (or local) host. The newly developed content sitting in the developer's workspace needs to end up in a location and format that the running server can use for its serving purposes.
In this picture, an IServer
object is a proxy for the real web
server. Through this proxy, a client can configure the server, and start,
stop, and restart it.
IServerAttributes implements IAdaptable to allow users to obtain a server-type-specific class. By casting the runtime extension to the type prescribed in the API documentation for that particular server type, the client can access server-type-specific properties and methods. getAdapter() may involve plugin loading, and should not be called from popup menus, etc.
The server framework maintains a global list of all known server instances
(ServerCore.getServers()
).
[rough notes: Server has a state. Server can be started, stopped, and restarted. To modify server attributes, get a working copy, modify it, and then save it to commit the changes. Server attributes. Serialization. Chained working copies for runtime, server configuration. Server has a set of root modules. Modules have state wrt a server. Restarting modules.]
Two servers are identical if and only if they have the same id.
This interface is not intended to be implemented by clients.
Method Summary | |
---|---|
IStatus |
canModifyModules(IModule[] add,
IModule[] remove,
IProgressMonitor monitor)
Returns whether the specified module modifications could be made to this server at this time. |
IServerWorkingCopy |
createWorkingCopy()
Returns a server working copy for modifying this server instance. |
void |
delete()
Deletes the persistent representation of this server. |
java.lang.Object |
getAdapter(java.lang.Class adapter)
Returns an object which is an instance of the given class associated with this object. |
IModule[] |
getChildModules(IModule[] module,
IProgressMonitor monitor)
Returns the child module(s) of this module. |
java.lang.String |
getHost()
Returns the host for the server. |
java.lang.String |
getId()
Returns the id of this server. |
IModule[] |
getModules()
Returns an array of user modules that are currently being published to this server. |
java.lang.String |
getName()
Returns the displayable name for this server. |
IModule[] |
getRootModules(IModule module,
IProgressMonitor monitor)
Returns the parent module(s) of this module. |
IRuntime |
getRuntime()
Returns the runtime associated with this server. |
IFolder |
getServerConfiguration()
Returns the server configuration associated with this server. |
ServerPort[] |
getServerPorts(IProgressMonitor monitor)
Returns an array of ServerPorts that this server has. |
IServerType |
getServerType()
Returns the type of this server. |
boolean |
isReadOnly()
Returns whether this server is marked read only. |
boolean |
isWorkingCopy()
Returns true if this is a working copy. |
java.lang.Object |
loadAdapter(java.lang.Class adapter,
IProgressMonitor monitor)
Returns an object which is an instance of the given class associated with this object. |
Method Detail |
public java.lang.String getName()
Note that this name is appropriate for the current locale.
public java.lang.String getId()
public void delete() throws CoreException
CoreException
- if there was any error received while deleting the server
or if this method is called on a working copypublic boolean isReadOnly()
true
if this server is marked as read only,
and false
otherwisepublic boolean isWorkingCopy()
true
if this server is a working copy,
and false
otherwisepublic java.lang.Object getAdapter(java.lang.Class adapter)
null
if
no such object can be found.
This method will not check the delegate classes for adapting unless they are already loaded. No plugin loading will occur when calling this method.
adapter
- the adapter class to look up
null
if this object does not
have an adapter for the given classIAdaptable#getAdapter(Class)
public java.lang.Object loadAdapter(java.lang.Class adapter, IProgressMonitor monitor)
null
if
no such object can be found.
This method will force a load of all delegate classes and check them for adapting.
adapter
- the adapter class to look upmonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
null
if this object does not
have an adapter for the given classpublic java.lang.String getHost()
URL.getHost()
public IRuntime getRuntime()
Note: The runtime of a server working copy may or may not be a working copy. For a server instance that is not a working copy, the runtime instance is not a working copy either.
[issue: According to serverType extension point, runtimeTypeId is a mandatory attribute. It seems odd then to have server runtime instance being an optional property of server instance. What does it mean for a server to not have a runtime?]
null
if nonepublic IServerType getServerType()
IServerType
public IFolder getServerConfiguration()
Note: The server configuration of a server working copy may or may not be a working copy. For a server instance that is not a working copy, the server configuration instance is not a working copy either.
[issue: According to serverType extension point, configurationTypeId is an optional attribute. If a server type has no server configuration type, then it seems reasonable to expect this method to return null for all instances of that server type. But what about a server type that explicitly specifies a server configuration type. Does that mean that all server instances of that server type must have a server configuration instance of that server configuration type, and that this method never returns null in those cases?]
null
if nonepublic IServerWorkingCopy createWorkingCopy()
The server working copy is related to this server instance in the following ways:
this.getWorkingCopy().getId() == this.getId() this.getWorkingCopy().getFile() == this.getFile() this.getWorkingCopy().getOriginal() == this this.getWorkingCopy().getRuntime() == this.getRuntime() this.getWorkingCopy().getServerConfiguration() == this.getServerConfiguration()
[issue: IServerWorkingCopy extends IServer. Server.getWorkingCopy() create a new working copy; ServerWorkingCopy.getWorkingCopy() returns this. This may be convenient in code that is ignorant of whether they are dealing with a working copy or not. However, it is hard for clients to manage working copies with this design.]
public IModule[] getModules()
This method returns the root modules, which are not parented within another modules. Each of these may contain child modules, which are also deployed to this server.
public IStatus canModifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor)
This method may decide based on the type of module or refuse simply due to reaching a maximum number of modules or other criteria.
[issue: This seems odd to have a pre-flight method. I should expect that the client can propose making any set of module changes they desire (via a server working copy). If the server doesn't like it, the operation should fail.]
add
- a possibly-empty list of modules to addremove
- a possibly-empty list of modules to removemonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
true
if the proposed modifications
look feasible, and false
otherwisepublic IModule[] getChildModules(IModule[] module, IProgressMonitor monitor)
This method should only return the direct children. To obtain the full module tree, this method may be recursively called on the children.
module
- a modulemonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
public IModule[] getRootModules(IModule module, IProgressMonitor monitor) throws CoreException
If the module type is not supported, this method will return null. If the type is normally supported but there is a configuration problem or missing parent, etc., this method will fire a CoreException that may then be presented to the user.
If it does return valid parent(s), this method will always return the topmost parent module(s), even if there are a few levels (a heirarchy) of modules.
module
- a modulemonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- if there is a problempublic ServerPort[] getServerPorts(IProgressMonitor monitor)
monitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |