Class NonSMFServiceAdapter

  • All Implemented Interfaces:
    Service
    Direct Known Subclasses:
    LinuxSystemDService, LinuxSystemVService, WindowsService

    public abstract class NonSMFServiceAdapter
    extends ServiceAdapter
    The original implementation of Services had serious design problems. The Service interface is ENORMOUSLY fat and non OO in the sense that outside callers had to set things to make things work. The interface is not generic -- it is very SMF specific It is extremely difficult to implement the interface because it has SO MANY methods that non-SMF don't need. This "Adapter" makes it easier to implement the interface. Eventually we should have one adapter for all services but the SMF code is difficult and time-consuming to change. Meantime I'm adding new functionality (August 2010, bnevins) for instances. I'm moving implementations of the new interface methods to "ServiceAdapter" which ALL services extend.
    Author:
    bnevins
    • Method Detail

      • getTimeoutSeconds

        public final int getTimeoutSeconds()
      • setTimeoutSeconds

        public final void setTimeoutSeconds​(int number)
        Description copied from interface: Service
        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 final String getServiceProperties()
        Description copied from interface: Service
        Returns the additional properties of the Service.
        Returns:
        String representing addtional properties of the service. May return default properties as well.
      • setServiceProperties

        public final void setServiceProperties​(String cds)
        Description copied from interface: Service
        Sets the additional service properties that are specific to it.
        Parameters:
        cds - must be a colon separated String, if not null. No effect, if null is passed.
      • tokensAndValues

        public final Map<String,​String> tokensAndValues()
        Description copied from interface: Service
        Returns the tokens and values of the service as a map. This method converts a service into corresponding tokens and their values.
        Returns:
        tokens and values as a Map.
      • getManifestFilePath

        public final String getManifestFilePath()
        Description copied from interface: Service
        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.
        Returns:
        the absolute file path
      • getManifestFileTemplatePath

        public final String getManifestFileTemplatePath()
        Description copied from interface: Service
        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.
        Returns:
        the absolute file path
      • isConfigValid

        public final boolean isConfigValid()
        Description copied from interface: Service
        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