Class 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
    • 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.
        Returns:
        the absolute file path
      • 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.
        Returns:
        the absolute file path
      • 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.
        Overrides:
        toString in class Object
        Returns:
        a String according to above description, never returns null
      • 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()