Class SMFService
- java.lang.Object
-
- com.sun.enterprise.admin.servermgmt.services.ServiceAdapter
-
- com.sun.enterprise.admin.servermgmt.services.SMFService
-
- All Implemented Interfaces:
Service
public final class SMFService extends ServiceAdapter
Represents the SMF Service. Holds the tokens and their values that are consumed by the SMF templates. The recommended way to use this class (or its instances) is to initialize it with default constructor and then apply various mutators to configure the service. Finally, callers should make sure that the configuration is valid, before attempting to create the service in the Solaris platform.- Since:
- SJSAS 9.0
- Author:
- Kedar Mhaswade
- See Also:
isConfigValid(),SMFServiceHandler
-
-
Field Summary
Fields Modifier and Type Field Description static StringAS_ADMIN_USER_DEF_VALstatic StringBASIC_NETADDR_PRIV_VALstatic StringMANIFEST_HOMEstatic StringNETADDR_PRIV_VALstatic StringNO_START_INSTANCES_PROPERTYstatic StringPRIVILEGES_DEFAULT_VALstatic StringSP_DELIMITERstatic StringSTART_INSTANCES_DEFAULT_VALstatic StringSTART_INSTANCES_TNstatic StringSVCADMstatic StringSVCCFGstatic StringTIMEOUT_SECONDS_DV
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateServiceInternal()Creates the service on the given platform.voiddeleteServiceInternal()StringgetLocationArgsStart()StringgetLocationArgsStop()StringgetManifestFilePath()Returns the absolute location of the manifest file as SMF understands it.StringgetManifestFileTemplatePath()Returns the absolute location of the template for the given service.StringgetServiceProperties()Returns the additional properties of the Service.StringgetSuccessMessage()For safety -- this is similar to the subversion dry-run command.intgetTimeoutSeconds()Returns timeout in seconds before the master boot restarter should give up starting this service.voidinitializeInternal()booleanisConfigValid()Determines if the configuration of the method is valid.voidsetServiceProperties(String cds)Sets the additional service properties that are specific to it.voidsetTimeoutSeconds(int number)Sets timeout in seconds before the master boot restarter should give up starting this service.Map<String,String>tokensAndValues()Returns the tokens and values of the service as a map.StringtoString()Returns a String representation of the SMFService.voidwriteReadmeFile(String msg)-
Methods inherited from class com.sun.enterprise.admin.servermgmt.services.ServiceAdapter
createService, deleteService, getInfo, getLocationArgsRestart, getServerDirs, isDomain, isInstance
-
-
-
-
Field Detail
-
TIMEOUT_SECONDS_DV
public static final String TIMEOUT_SECONDS_DV
- See Also:
- Constant Field Values
-
AS_ADMIN_USER_DEF_VAL
public static final String AS_ADMIN_USER_DEF_VAL
- See Also:
- Constant Field Values
-
SP_DELIMITER
public static final String SP_DELIMITER
- See Also:
- Constant Field Values
-
PRIVILEGES_DEFAULT_VAL
public static final String PRIVILEGES_DEFAULT_VAL
- See Also:
- Constant Field Values
-
NETADDR_PRIV_VAL
public static final String NETADDR_PRIV_VAL
- See Also:
- Constant Field Values
-
BASIC_NETADDR_PRIV_VAL
public static final String BASIC_NETADDR_PRIV_VAL
- See Also:
- Constant Field Values
-
START_INSTANCES_TN
public static final String START_INSTANCES_TN
- See Also:
- Constant Field Values
-
START_INSTANCES_DEFAULT_VAL
public static final String START_INSTANCES_DEFAULT_VAL
-
NO_START_INSTANCES_PROPERTY
public static final String NO_START_INSTANCES_PROPERTY
- See Also:
- Constant Field Values
-
SVCCFG
public static final String SVCCFG
- See Also:
- Constant Field Values
-
SVCADM
public static final String SVCADM
- See Also:
- Constant Field Values
-
MANIFEST_HOME
public static final String MANIFEST_HOME
- See Also:
- Constant Field Values
-
-
Method Detail
-
createServiceInternal
public void createServiceInternal()
Creates the service on the given platform.
-
deleteServiceInternal
public void deleteServiceInternal()
-
getTimeoutSeconds
public int getTimeoutSeconds()
Returns timeout in seconds before the master boot restarter should give up starting this service.
-
setTimeoutSeconds
public void setTimeoutSeconds(int number)
Sets timeout in seconds before the master boot restarter should give up starting this service.- Parameters:
number- a non-negative integer representing timeout. A value of zero implies infinite timeout.
-
getServiceProperties
public String getServiceProperties()
Returns the additional properties of the Service.- Returns:
- String representing addtional properties of the service. May return default properties as well.
-
setServiceProperties
public void setServiceProperties(String cds)
Sets the additional service properties that are specific to it.- Parameters:
must- be a colon separated String, if not null. No effect, if null is passed.
-
isConfigValid
public boolean isConfigValid()
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.- Returns:
- true if the configuration is valid, an exception is thrown otherwise
- Throws:
RuntimeException- if the configuration is not valid
-
tokensAndValues
public Map<String,String> tokensAndValues()
Returns the tokens and values of the service as a map. Note that a copy is returned.- Returns:
- a copy of tokens and values
-
getManifestFilePath
public String getManifestFilePath()
Returns the absolute location of the manifest file as SMF 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.
-
getManifestFileTemplatePath
public String getManifestFileTemplatePath()
Returns the absolute location of the template for the given service. If the file can not be found at its required location then the file will be copied from inside this jar file to the file system. The type of the service must be set before calling this method, otherwise a runtime exception results.
-
toString
public String toString()
Returns a String representation of the SMFService. It contains a new-line separated "name=value" String that contains the name and value of each of of the tokens that were set in the service.
-
getSuccessMessage
public String getSuccessMessage()
For safety -- this is similar to the subversion dry-run command. It does everything except create the service.
-
initializeInternal
public void initializeInternal()
-
writeReadmeFile
public void writeReadmeFile(String msg)
-
getLocationArgsStart
public final String getLocationArgsStart()
-
getLocationArgsStop
public final String getLocationArgsStop()
-
-