|
||||||||||||
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.
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.
Field Summary | |
---|---|
static int |
PUBLISH_AUTO
Publish kind constant (value 3) indicating an automatic publish request. |
static int |
PUBLISH_CLEAN
Publish kind constant (value 4) indicating a publish clean request |
static int |
PUBLISH_FULL
Publish kind constant (value 2) indicating a full publish request. |
static int |
PUBLISH_INCREMENTAL
Publish kind constant (value 1) indicating an incremental publish request. |
static int |
PUBLISH_STATE_FULL
Publish state constant (value 3) indicating that a full publish is required. |
static int |
PUBLISH_STATE_INCREMENTAL
Publish state constant (value 2) indicating that an incremental publish is required. |
static int |
PUBLISH_STATE_NONE
Publish state constant (value 1) indicating that there is no publish required. |
static int |
PUBLISH_STATE_UNKNOWN
Publish state constant (value 0) indicating that it's in an unknown state. |
static int |
STATE_STARTED
Server state constant (value 2) indicating that the server is ready to serve content. |
static int |
STATE_STARTING
Server state constant (value 1) indicating that the server is starting, but not yet ready to serve content. |
static int |
STATE_STOPPED
Server state constant (value 4) indicating that the server is stopped. |
static int |
STATE_STOPPING
Server state constant (value 3) indicating that the server is shutting down. |
static int |
STATE_UNKNOWN
Server state constant (value 0) indicating that the server is in an unknown state. |
Method Summary | |
---|---|
void |
addServerListener(IServerListener listener)
Adds the given server state listener to this server. |
void |
addServerListener(IServerListener listener,
int eventMask)
Adds the given server state listener to this server. |
IStatus |
canPublish()
Returns whether this server is in a state that it can be published to. |
IStatus |
canRestart(java.lang.String mode)
Returns whether this server is in a state that it can be restarted in the given mode. |
IStatus |
canRestartModule(IModule[] module,
IProgressMonitor monitor)
Returns whether the given module can be restarted. |
IStatus |
canStart(java.lang.String launchMode)
Returns whether this server is in a state that it can be started in the given mode. |
IStatus |
canStop()
Returns whether this server is in a state that it can be stopped. |
java.lang.String |
getMode()
Returns the ILaunchManager mode that the server is in. |
int |
getModulePublishState(IModule[] module)
Returns the module's sync state. |
boolean |
getModuleRestartState(IModule[] module)
Check if the given module is in sync on the server. |
int |
getModuleState(IModule[] module)
Returns the current state of the given module on this server. |
int |
getServerPublishState()
Returns the server's sync state. |
boolean |
getServerRestartState()
Returns whether this server is out of sync and needs to be restarted. |
int |
getServerState()
Returns the current state of this server. |
IStatus |
publish(int kind,
IProgressMonitor monitor)
Publish to the server using the progress monitor. |
void |
removeServerListener(IServerListener listener)
Removes the given server state listener from this server. |
void |
restart(java.lang.String launchMode)
Asynchronously restarts this server. |
void |
restartModule(IModule[] module,
IProgressMonitor monitor)
Asynchronously restarts the given module on the server. |
ILaunch |
start(java.lang.String launchMode,
IProgressMonitor monitor)
Asynchronously starts this server in the given launch mode. |
void |
stop(boolean force)
Asynchronously stops this server. |
void |
synchronousRestart(java.lang.String launchMode,
IProgressMonitor monitor)
Synchronously restarts this server. |
void |
synchronousRestartModule(IModule[] module,
IProgressMonitor monitor)
Restarts the given module and waits until it has finished restarting. |
ILaunch |
synchronousStart(java.lang.String launchMode,
IProgressMonitor monitor)
Starts this server in the given launch mode and waits until the server has finished starting. |
void |
synchronousStop(boolean force)
Stops this server and waits until the server has completely stopped. |
Methods inherited from interface org.eclipse.wst.server.core.IServerAttributes |
---|
canModifyModules, createWorkingCopy, delete, getAdapter, getChildModules, getHost, getId, getModules, getName, getRootModules, getRuntime, getServerConfiguration, getServerPorts, getServerType, isReadOnly, isWorkingCopy, loadAdapter |
Field Detail |
public static final int STATE_UNKNOWN
getServerState()
,
getModuleState(IModule[])
,
Constant Field Valuespublic static final int STATE_STARTING
getServerState()
,
getModuleState(IModule[])
,
Constant Field Valuespublic static final int STATE_STARTED
getServerState()
,
getModuleState(IModule[])
,
Constant Field Valuespublic static final int STATE_STOPPING
getServerState()
,
getModuleState(IModule[])
,
Constant Field Valuespublic static final int STATE_STOPPED
getServerState()
,
getModuleState(IModule[])
,
Constant Field Valuespublic static final int PUBLISH_STATE_UNKNOWN
getServerPublishState()
,
getModulePublishState(IModule[])
,
Constant Field Valuespublic static final int PUBLISH_STATE_NONE
getServerPublishState()
,
getModulePublishState(IModule[])
,
Constant Field Valuespublic static final int PUBLISH_STATE_INCREMENTAL
getServerPublishState()
,
getModulePublishState(IModule[])
,
Constant Field Valuespublic static final int PUBLISH_STATE_FULL
getServerPublishState()
,
getModulePublishState(IModule[])
,
Constant Field Valuespublic static final int PUBLISH_INCREMENTAL
publish(int, IProgressMonitor)
,
Constant Field Valuespublic static final int PUBLISH_FULL
publish(int, IProgressMonitor)
,
Constant Field Valuespublic static final int PUBLISH_AUTO
publish(int, IProgressMonitor)
,
Constant Field Valuespublic static final int PUBLISH_CLEAN
publish(int, IProgressMonitor)
,
Constant Field ValuesMethod Detail |
public int getServerState()
Note that this operation is guaranteed to be fast (it does not actually communicate with any actual server).
STATE_XXX
)
constants declared on IServer
public java.lang.String getMode()
org.eclipse.debug.core.ILaunchManager
, or
null
if the server is stopped.public int getServerPublishState()
public int getModulePublishState(IModule[] module)
module
- the module
public void addServerListener(IServerListener listener)
listener
- the server listenerremoveServerListener(IServerListener)
public void addServerListener(IServerListener listener, int eventMask)
listener
- the server listenereventMask
- the bit-wise OR of all event types of interest to the
listenerremoveServerListener(IServerListener)
public void removeServerListener(IServerListener listener)
listener
- the listeneraddServerListener(IServerListener)
public IStatus canPublish()
IStatus.OK
if the server can
be published to, otherwise a status object indicating what is wrongpublic IStatus publish(int kind, IProgressMonitor monitor)
kind
- the kind of publish being requested. Valid values are
PUBLSIH_FULL
- indicates a full publish.PUBLISH_INCREMENTAL
- indicates a incremental publish.
PUBLISH_CLEAN
- indicates a clean request. Clean throws
out all state and cleans up the module on the server before doing a
full publish.
monitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
public IStatus canStart(java.lang.String launchMode)
launchMode
- a mode in which a server can be launched,
one of the mode constants defined by
org.eclipse.debug.core.ILaunchManager
IStatus.OK
if the server can
be started, otherwise a status object indicating why it can'tpublic ILaunch start(java.lang.String launchMode, IProgressMonitor monitor) throws CoreException
If canStart(launchMode) is false, this method will throw an exception.
[issue: There is no way to communicate failure to the client for the async portion of this operation. Given that this operation can go awry, there probably should be a mechanism that allows failing asynch operations to be diagnosed.]
launchMode
- a mode in which a server can be launched,
one of the mode constants defined by
org.eclipse.debug.core.ILaunchManager
monitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- if an error occurs while trying to start the serverpublic ILaunch synchronousStart(java.lang.String launchMode, IProgressMonitor monitor) throws CoreException
This convenience method uses start(String, IProgressMonitor)
to start the server, and an internal thread and listener to detect
when the server has finished starting.
launchMode
- a mode in which a server can be launched,
one of the mode constants defined by
org.eclipse.debug.core.ILaunchManager
monitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- if an error occurs while trying to start the serverpublic IStatus canRestart(java.lang.String mode)
mode
- a mode in which a server can be launched,
one of the mode constants defined by
org.eclipse.debug.core.ILaunchManager
IStatus.OK
if the server can
be restarted, otherwise a status object indicating why it can'tpublic boolean getServerRestartState()
[issue: Need to explain what is it that can get out of "out of sync" here, and how this can happen.]
true
if this server is out of sync and needs to be
restarted, and false
otherwise (e.g., if the contents have
not been modified and the server process is still in sync); the
result is unspecified if the server is not currently runningpublic void restart(java.lang.String launchMode)
canRestart(String)
returns false
.
This method cannot be used to start the server from a stopped state.
[issue: There is no way to communicate failure to the client. Given that this operation can go awry, there probably should be a mechanism that allows failing asynch operations to be diagnosed.]
launchMode
- a mode in which a server can be launched,
one of the mode constants defined by
org.eclipse.debug.core.ILaunchManager
public void synchronousRestart(java.lang.String launchMode, IProgressMonitor monitor) throws CoreException
canRestart(String)
returns false
.
[issue: There is no way to communicate failure to the client. Given that this operation can go awry, there probably should be a mechanism that allows failing asynch operations to be diagnosed.]
launchMode
- a mode in which a server can be launched,
one of the mode constants defined by
org.eclipse.debug.core.ILaunchManager
monitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- if there was an errorpublic IStatus canStop()
IStatus.OK
if the server can
be stopped, otherwise a status object indicating why it can'tpublic void stop(boolean force)
canStop()
returns false
.
If force is false
, it will attempt to stop the server
normally/gracefully. If force is true
, then the server
process will be terminated any way that it can.
[issue: There is no way to communicate failure to the client. Given that this operation can go awry, there probably should be a mechanism that allows failing asynch operations to be diagnosed.]
force
- true
to kill the server, or false
to stop normallypublic void synchronousStop(boolean force)
This convenience method uses stop(boolean)
to stop the server, and an internal thread and listener to detect
when the server has complied.
force
- true
to kill the server, or false
to stop normallypublic IStatus canRestartModule(IModule[] module, IProgressMonitor monitor)
[issue: It's unclear whether this operations is guaranteed to be fast or whether it could involve communication with any actual server. If it is not fast, the method should take a progress monitor.]
module
- the modulemonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
IStatus.OK
if the module can
be restarted, otherwise a status object indicating why it can'tpublic boolean getModuleRestartState(IModule[] module)
module
- the module
public void restartModule(IModule[] module, IProgressMonitor monitor) throws CoreException
synchronousRestartModule(IModule[], IProgressMonitor)
for further details.
The implementation should update the module sync state and fire an event for the module. If the module does not exist on the server, an exception will be thrown.
[issue: Since this method is ascynchronous, is there any need for the progress monitor?]
[issue: Since this method is ascynchronous, how can it return a meaningful IStatus? And IServer.synchronousModuleRestart throws CoreException if anything goes wrong.]
[issue: If the module was just published to the server and had never been started, would is be ok to "start" the module using this method?]
module
- the module to be startedmonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- if an error occurs while trying to restart the modulepublic void synchronousRestartModule(IModule[] module, IProgressMonitor monitor) throws CoreException
This method may not be used to initially start a module.
module
- the module to be restartedmonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- if an error occurs while trying to restart the modulepublic int getModuleState(IModule[] module)
STATE_UNKNOWN
if the module
is not among the ones associated with this server.
module
- the module
STATE_XXX
) constants declared
on IServer
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |