com.borland.jbuilder.runtime.servlet
Interface ServerStarter


public interface ServerStarter

Maintains and returns runtime-specific information for a particular run of a web server/servlet engine. Each ServerStarter is associated with a ServerSetup, and may delegate to it for items that do not change.


Field Summary
static java.lang.String GENERATE_COMMENT
          This string, which should be used in a comment early in any generated files, can be used to identify those files, so that they may be deleted if they are found during the prepare stage (if for example, the cleanup stage was not executed previously, leaving files that should have been deleted).
 
Method Summary
 void cleanup()
          Performs any desired cleanup after the server has been terminated, like deleting a generated configuration file.
 void configure(JBProject jbProject, ServerDescriptor serverDescriptor)
          Configures the starter for a particular run.
 java.lang.String getArguments()
          Returns any arguments required by the server for this particular run.
 JspSourceBridge getJspSourceBridge()
          Returns object to enable JSP source debugging.
 java.lang.String getMainClass()
          Returns the main class or JAR file to execute.
 java.lang.String getVMParameters()
          Returns any VM parameters required by the server for this particular run.
 java.io.File getWorkingDir()
          Returns the directory the VM should be started in.
 void prepare()
          Prepares the server for execution by doing server-specific configuration for a particular run, usually by generating a configuration file.
 boolean shutdown()
          Attempts to shut down the server gracefully; called by the IDE when the user wants to terminate the server process.
 

Field Detail

GENERATE_COMMENT

public static final java.lang.String GENERATE_COMMENT
This string, which should be used in a comment early in any generated files, can be used to identify those files, so that they may be deleted if they are found during the prepare stage (if for example, the cleanup stage was not executed previously, leaving files that should have been deleted). Because it is used as an identifier, it is not resourced.
Method Detail

configure

public void configure(JBProject jbProject,
                      ServerDescriptor serverDescriptor)
Configures the starter for a particular run. This is generally called once, each time the tracker is created. Stopping and restarting with the same tracker would not call this again. After calling this method, the ServerStarter should be able to return the command line components (arguments, etc.) that are needed to start the server.

It's desirable to be able to run the same server on multiple ports simultaneously, so any configuration/preparation should not prevent this. For example, a single configuration file that has the port number hard-coded in it would not work.

Parameters:
jbProject - reference to current project
serverDescriptor - object that contains run-time particulars

getVMParameters

public java.lang.String getVMParameters()
Returns any VM parameters required by the server for this particular run. If the server is executed by running a JAR, then "-jar" should included as a parameter.
Returns:
string with parameters (if any) separated by spaces, suitable for insertion in a java command line. If no VM parameters, return an empty string.

getMainClass

public java.lang.String getMainClass()
Returns the main class or JAR file to execute.
Returns:
main class or JAR file name

getArguments

public java.lang.String getArguments()
Returns any arguments required by the server for this particular run. A typical example would be something like "-config /some/dir/config.xml", referencing a configuration file that will be created by prepare. Note that if there are filename arguments with spaces, they must be enclosed in quotes in the string.
Returns:
string with arguments (if any) separated by spaces, suitable for insertion in a java command line. If no arguments, return an empty string.

getWorkingDir

public java.io.File getWorkingDir()
Returns the directory the VM should be started in.
Returns:
File object representing directory, or null if no particular directory is needed.

getJspSourceBridge

public JspSourceBridge getJspSourceBridge()
Returns object to enable JSP source debugging. This object, which also has server-specific variants, is usually created during configure.
Returns:
JspSourceBridge for current configuration, or null if JSP mapping is not available.

prepare

public void prepare()
Prepares the server for execution by doing server-specific configuration for a particular run, usually by generating a configuration file. Called every time the server process is started or restarted.

shutdown

public boolean shutdown()
Attempts to shut down the server gracefully; called by the IDE when the user wants to terminate the server process. This may be through RMI or by running another VM with a simple class that communicates on an administrative port. This may require that the shutdown class use the same configuration that started the server, in case the administrative port is part of that configuration. Implementations should not wait too long for shutdown, as this will block the IDE. Upon return, the IDE will always attempt to destroy the server process itself as a fail-safe.
Returns:
an attempt was made to shut down the server. If unsure, not implemented, shut down process was unsuccessful return false.

cleanup

public void cleanup()
Performs any desired cleanup after the server has been terminated, like deleting a generated configuration file. Called every time the server process is terminated.