|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A working copy server object used for formulating changes
to a server instance (IServer
).
This interface is not intended to be implemented by clients.
Field Summary | |
---|---|
static int |
SAVE_CONFLICT
Status code (value 1) returned from the save() method when the save failed with force set to false because the runtime has
been modified and saved since this working copy was created. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a property change listener to this server. |
IServer |
getOriginal()
Returns the server instance that this working copy is associated with. |
boolean |
isDirty()
Returns whether this working copy has unsaved changes. |
void |
modifyModules(IModule[] add,
IModule[] remove,
IProgressMonitor monitor)
Modifies the list of modules associated with the server. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener from this server. |
IServer |
save(boolean force,
IProgressMonitor monitor)
Commits the changes made in this working copy. |
IServer |
saveAll(boolean force,
IProgressMonitor monitor)
Commits the changes made in this server working copy after first committing any associated server configuration or server runtime working copies. |
void |
setHost(java.lang.String host)
Changes the host for the server. |
void |
setName(java.lang.String name)
Sets the displayable name for this server. |
void |
setReadOnly(boolean readOnly)
Sets or unsets whether this server is marked as read only. |
void |
setRuntime(IRuntime runtime)
Sets the runtime associated with this server working copy. |
void |
setServerConfiguration(IFolder configuration)
Sets the server configuration associated with this server working copy. |
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 SAVE_CONFLICT
false
because the runtime has
been modified and saved since this working copy was created.
save(boolean, IProgressMonitor)
,
Constant Field ValuesMethod Detail |
public void setName(java.lang.String name)
The name should be appropriate for the current locale.
name
- a displayable nameIServerAttributes.getName()
public void setReadOnly(boolean readOnly)
readOnly
- true
to set this server to be marked
read only, and false
to unsetpublic boolean isDirty()
true
if this working copy has unsaved
changes, and false
otherwisepublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Once registered, a listener starts receiving notification of property changes to this server. The listener continues to receive notifications until it is removed. Has no effect if an identical listener is already registered.
listener
- a property change listenerremovePropertyChangeListener(PropertyChangeListener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- a property change listeneraddPropertyChangeListener(PropertyChangeListener)
public void setServerConfiguration(IFolder configuration)
Note: The server configuration of a server working copy may or may not be a working copy.
[issue: According to serverType extension point, configurationTypeId is an optional attribute. What happens if the server configuration passed is null but the server must have a server configuration? What happens of the server configuration has the wrong type? Do the errors get detected and reported now, or upon save()?]
configuration
- the server configuration, or null
if nonepublic IServer getOriginal()
For a server working copy created by a call to
IServerAttributes.createWorkingCopy()
,
this.getOriginal()
returns the original
server object. For a server working copy just created by
a call to IServerType#createServer(String, org.eclipse.core.resources.IFile, IProgressMonitor)
,
this.getOriginal()
returns null
.
null
if nonepublic IServer save(boolean force, IProgressMonitor monitor) throws CoreException
If there an existing server instance with a matching id and server type, this will change the server instance accordingly. The returned server will be the same server this is returned from getOriginal(), after the changes have been applied. Otherwise, this method will return a newly created server.
Servers can be saved even when they have invalid properties. It is the clients responsibility to validate or check the properties before saving.
This method does not apply changes to the server. A publish() must be completed to push out after the save to push out any changes to the server.
[issue: What is lifecycle for ServerWorkingCopyDelegate associated with this working copy?]
[issue: Since it does not make sense to commit a server working copy without first committing any associated runtime and server config working copies, the semantics of saveAll should be part and parcel of the normal save, and the saveAll method eliminated.]
force
- true
to force the save, or false
otherwisemonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- [missing]SAVE_CONFLICT
public IServer saveAll(boolean force, IProgressMonitor monitor) throws CoreException
This convenience method is equivalent to:
IRuntime rt = this.getRuntime(); if (rt != null && rt.isWorkingCopy()) { ((IRuntimeWorkingCopy) rt).save(monitor); } IServerConfiguration cf = this.getServerConfiguration(); if (cf != null && cf.isWorkingCopy()) { ((IServerConfigurationWorkingCopy) cf).save(monitor); } return save(monitor);
[issue: Since it does not make sense to commit a server working copy without first committing any associated runtime and server config working copies, the semantics of this operation should be part and parcel of the normal save, and the saveAll method eliminated.]
force
- true
to force the save, or false
otherwisemonitor
- a progress monitor, or null
if progress
reporting and cancellation are not desired
CoreException
- [missing]SAVE_CONFLICT
public void setRuntime(IRuntime runtime)
Note: The runtime of a server working copy may or may not be a working copy.
[issue: According to serverType extension point, runtimeTypeId is a mandatory attribute. But IServer.getRuntime() is allowed to return null, suggesting that it is optional for instances. What happens if the runtime passed is null but the server must have a runtime? What happens if the runtime has the wrong type? Do the errors get detected and reported now, or upon save()?]
runtime
- the runtime, or null
if nonepublic void setHost(java.lang.String host)
[issue: This is a questionable operation if there is a running server associated with the original. When a host name change is committed, the server instance loses contact with the running server because of the host name change.]
host
- a host string conforming to RFC 2732IServerAttributes.getHost()
,
URL.getHost()
public void modifyModules(IModule[] add, IModule[] remove, IProgressMonitor monitor) throws CoreException
add
list
must exist in the workspace and must not already be associated
with the server.
The modules included in the remove
list
must be associated with the server, but may or may not exist
in the workspace.
This method will not communicate with the server. After saving, publish() can be used to sync up with the server.
[issue: How to formulate what it means to say "the module must exist in the workspace"?]
[issue: The spec should be more lax. Attempting to add a module that's already include should be quietly ignore; ditto removing a module that's not on this list. This simplifies the handling of various other wacko cases such as duplication within and between the add and remove lists.]
[issue: The spec had also said: "...canModifyModules() should have returned true. The configuration must assume any default settings and add the module without any UI."]
[issue: What error checking should be performed by this operation, and what needs to be performed by save() if the client tries to commit these hypothetisized changes?]
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
CoreException
- [missing]
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |