FileDocCategorySizeDatePackage
Service.javaAPI DocGlassfish v2 API9811Fri May 04 22:24:30 BST 2007com.sun.enterprise.admin.servermgmt

Service

public interface Service
Represents an abstract Service. This interface defines sufficient methods for any platform integration of application server with various service control mechanisms on various platforms. An example is SMF for Solaris.
since
SJSAS 9.1
see
#isConfigValid
see
ServiceHandler

Fields Summary
Constructors Summary
Methods Summary
public voidcreateService(java.util.Map params)
Creates an arbitrary service, specified by certain parameters. The implementations should dictate the mappings in the parameters received. The creation of service is either successful or not. In other words, the implementations must retain the original state of the operating platform if the service creation is not successful completely.

param
params a Map between Strings that represents the name value pairs required to create the service
throws
RuntimeException if there is any error is creation of service

public java.lang.StringgetAsadminPath()
Returns the absolute path to the asadmin script.

public java.lang.StringgetDate()
Returns the date the service is created.

return
A String Representation of Date.
see
java.util.Date

public java.lang.StringgetFQSN()
Returns the so-called Fully Qualified Service Name for this service. It is a function of name and location where the configuration of the service is stored. Might not return the intended value if the name and/or location is not set prior to this call.

return
String representing the place where the manifest is stored

public java.lang.StringgetLocation()
Returns the location where configuration of the service is stored on the disk.

public java.lang.StringgetManifestFilePath()
Returns the absolute location of the manifest file as service understands it. It takes into account the name, type and configuration location of the service. It is expected that these are set before calling this method. If the Fully Qualified Service Name is invalid, a RuntimeException results.

public java.lang.StringgetManifestFileTemplatePath()
Returns the absolute location of the template for the given service. The type of the service must be set before calling this method, otherwise a runtime exception results.

public java.lang.StringgetName()
Returns the name of the Service.

public java.lang.StringgetOSUser()
Returns the OS-level user-id who should start and own the processes started by this service.

public java.lang.StringgetPasswordFilePath()
Returns the absolute path of the password file that contains asadmin authentication artifacts.

public java.lang.StringgetServiceProperties()
Returns the additional properties of the Service.

return
String representing addtional properties of the service. May return default properties as well.

public intgetTimeoutSeconds()
Returns timeout in seconds before the master boot restarter should give up starting this service.

public AppserverServiceTypegetType()
Returns the type of service as an enum AppserverServiceType, from the given String.

throws
IllegalArgumentException if the enum value in the internal data structure is not valid.
see
AppserverServiceType

public booleanisConfigValid()
Determines if the configuration of the method is valid. When this class is constructed, appropriate defaults are used. But before attempting to create the service in the Solaris platform, it is important that the necessary configuration is done by the users via various mutator methods of this class. This method must be called to guard against some abnormal failures before creating the service. It makes sure that the caller has set all the necessary parameters reasonably. Note that it does not validate the actual values.

throws
RuntimeException if the configuration is not valid
return
true if the configuration is valid, an exception is thrown otherwise

public voidsetAsadminPath(java.lang.String path)
Sets the absolute path to the asadmin script. May not be null.

public voidsetDate(java.lang.String date)
Sets the date as the date when this service is created.

param
date String representation of the date
throws
IllegalArgumentException if the parameter is null

public voidsetFQSN()
Sets the so-called Fully Qualified Service Name for this service. Note that there is no parameter accepted by this method. This is because the Fully Qualified Service Name is a function of name and location. The callers are expected to call this method once name and location is set on this service.

public voidsetLocation(java.lang.String cfgLocation)
Sets the location to the parent of given location. The location is treated as absolute and hence caller must ensure that it passes the absolute location.

public voidsetName(java.lang.String name)
Sets the name of the service. Parameter may not be null, an IllegalArgumentException results otherwise.

public voidsetOSUser()
Sets the OS-level user-id who should start and own the processes started by this service. This user is the same as the value returned by System.getProperty("user.name"). The idea is that the method is called by the user who actually wants to own the service.

throws
IllegalArgumentException if the user can not modify MANIFEST_HOME
throws
IllegalArgumentException if solaris.smf.modify Authorization is not implied by the authorizations available for the user.

public voidsetPasswordFilePath(java.lang.String path)
Sets the absolute path of the password file that contains asadmin authentication artifacts. Parameter may not be null.

public voidsetServiceProperties(java.lang.String cds)
Sets the additional service properties that are specific to it.

param
must be a colon separated String, if not null. No effect, if null is passed.

public voidsetTimeoutSeconds(int number)
Sets timeout in seconds before the master boot restarter should give up starting this service.

param
number a non-negative integer representing timeout. A value of zero implies infinite timeout.

public voidsetTrace(boolean trace)
Sets the trace flag. The ServiceHandler is expected to provide trace output if the flag is set.

public voidsetType(AppserverServiceType type)
Sets the type of the service to the given value in the enum.

see
AppserverServiceType

public java.util.MaptokensAndValues()
Returns the tokens and values of the service as a map. This method converts a service into corresponding tokens and their values.

return
tokens and values as a Map.