org.eclipse.wst.server.core
Interface IServerType


public interface IServerType

Represents a server type from which server instances can be created.

The server core framework supports an open-ended set of server types, which are contributed via the serverTypes extension point in the server core plug-in. Server type objects carry no state (all information is read-only and is supplied by the server type declaration). The global list of known server types is available via ServerCore.getServerTypes().

This interface is not intended to be implemented by clients.

Two server types are identical if and only if they have the same id.

Caveat: The server core API is still in an early form, and is likely to change significantly before the initial release.

Since:
1.0

Method Summary
 IServerWorkingCopy createServer(java.lang.String id, IFile file, IProgressMonitor monitor)
          Creates a working copy instance of this server type.
 IServerWorkingCopy createServer(java.lang.String id, IFile file, IRuntime runtime, IProgressMonitor monitor)
          Creates an working copy instance of this server type.
 java.lang.String getDescription()
          Returns the displayable description for this server type.
 java.lang.String getId()
          Returns the id of this server type.
 java.lang.String getName()
          Returns the displayable name for this server type.
 IRuntimeType getRuntimeType()
          Returns the type of server runtime that this type of server requires.
 boolean hasRuntime()
          Returns whether this type of server requires a server runtime.
 boolean hasServerConfiguration()
          Returns whether this type of server requires a server configuration.
 boolean supportsLaunchMode(java.lang.String launchMode)
          Returns whether this type of server supports the given launch mode.
 boolean supportsRemoteHosts()
          Returns true if this type of server can run on a remote host.
 

Method Detail

getId

public java.lang.String getId()
Returns the id of this server type. Each known server type has a distinct id. Ids are intended to be used internally as keys; they are not intended to be shown to end users.

Returns:
the server type id

getName

public java.lang.String getName()
Returns the displayable name for this server type.

Note that this name is appropriate for the current locale.

Returns:
a displayable name for this server type

getDescription

public java.lang.String getDescription()
Returns the displayable description for this server type.

Note that this description is appropriate for the current locale.

Returns:
a displayable description for this server type

getRuntimeType

public IRuntimeType getRuntimeType()
Returns the type of server runtime that this type of server requires.

[issue: "runtimeTypeId" is mandatory according the serverTypes schema. This suggests that all types of servers have a server runtime. But there is also a boolean "runtime" attribute indicating whether the server requires a runtime. I supect that server type has an optional server runtime, in which case you can make "runtimeTypeId" optional and dispense with "runtime".]

[issue: Does it really make sense for runtimeTypes and serverTypes be separate extension points? Would it not be sufficient to have the party declaring the server type also declare the server runtime type? Having runtimeType as a separate extension point only makes sense if it would be possible in principle to declare a server runtime type that could actually be used on serveral server types. If server runtimes always end up being server-type specific, it would be better to combine them.]

[issue: What should happen when a server type mentions the id of a server runtime type that is not known to the system?]

Returns:
a server runtime type

hasRuntime

public boolean hasRuntime()
Returns whether this type of server requires a server runtime.

[issue: See issues on getRuntimeType(). I suspect this method is unnecessary, and that this.getRuntimeType() != null will do.]

Returns:
true if this type of server requires a server runtime, and false if it does not
See Also:
getRuntimeType()

supportsLaunchMode

public boolean supportsLaunchMode(java.lang.String launchMode)
Returns whether this type of server supports the given launch mode.

[issue: It also seems odd that this is part of the server type declaration. This means that any server type has to commit so early on which modes it supports.]

Parameters:
launchMode - a mode in which a server can be launched, one of the mode constants defined by org.eclipse.debug.core.ILaunchManager
Returns:
whether this type of server supports the given mode

hasServerConfiguration

public boolean hasServerConfiguration()
Returns whether this type of server requires a server configuration.

[issue: It's not clear how this method differs from this.getServerConfigurationType() != null]

Returns:
true if this type of server requires a server configuration, and false if it does not

supportsRemoteHosts

public boolean supportsRemoteHosts()
Returns true if this type of server can run on a remote host. Returns false if the server type can only be run on "localhost" (the local machine).

Returns:
true if this type of server can run on a remote host, and false if it cannot

createServer

public IServerWorkingCopy createServer(java.lang.String id,
                                       IFile file,
                                       IRuntime runtime,
                                       IProgressMonitor monitor)
                                throws CoreException
Creates an working copy instance of this server type. After setting various properties of the working copy, the client should call IServerWorkingCopy.save(boolean, IProgressMonitor) to bring the server instance into existence.

[issue: Why is a runtime passed in? IServerWorkingCopy.setRuntime(runtime) could be called on the result to accomplish the same thing.]

[issue: The implementation of this method never creates a server config working copy, whereas the other one does!?] Consider combining the method with the other.]

The server returned from this method will have it's host set to "localhost". Other defaults will be set by calling the server delegate's setDefaults() method.

Parameters:
id - the id to assign to the server instance; a generated id is used if id is null or an empty string
file - the file in the workspace where the server instance is to be serialized, or null if the information is instead to be persisted with the workspace but not with any particular workspace resource
runtime - the runtime to associate with the server instance, or null if none
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a new server working copy with the given id
Throws:
CoreException - if an exception occurs while creating this runtime or setting it's default values

createServer

public IServerWorkingCopy createServer(java.lang.String id,
                                       IFile file,
                                       IProgressMonitor monitor)
                                throws CoreException
Creates a working copy instance of this server type. After setting various properties of the working copy, the client should call IServerWorkingCopy.save(boolean, IProgressMonitor) to bring the server instance into existence.

[issue: Since this method just creates a working copy, it's not clear the operation is long-running and in need of a progress monitor.]

The server returned from this method will have it's host set to "localhost". Other defaults will be set by calling the server delegate's setDefaults() method.

[issue: The implementation of this method creates a server config working copy, whereas the other one does not!? Consider combining the method with the other.]

Parameters:
id - the id to assign to the server instance; a generated id is used if id is null or an empty string
file - the file in the workspace where the server instance is to be serialized, or null if the information is instead to be persisted with the workspace but not with any particular workspace resource
monitor - a progress monitor, or null if progress reporting and cancellation are not desired
Returns:
a new server working copy with the given id
Throws:
CoreException - if an exception occurs while creating this runtime or setting it's default values