Class AbstractRuntimeService

    • Method Detail

      • getMessageHandler

        public RuntimeMessageHandler getMessageHandler()
        Description copied from interface: RuntimeService
        Gets the runtime message handler. You can add new messages or just retrieve them.

        Warning messages don't block server startup, but error messages do in strict mode.

        Specified by:
        getMessageHandler in interface RuntimeService
        Returns:
        the message handler for runtime.
        Since:
        9.10
      • getBuiltinFeatureURL

        protected static URL getBuiltinFeatureURL()
      • isStarted

        public boolean isStarted()
        Description copied from interface: RuntimeService
        Returns true if the runtime is started.
        Specified by:
        isStarted in interface RuntimeService
        Returns:
        true if the runtime is started, false otherwise
      • isShuttingDown

        public boolean isShuttingDown()
        Description copied from interface: RuntimeService
        Returns true if the runtime is shutting down.
        Specified by:
        isShuttingDown in interface RuntimeService
        Returns:
        true if the runtime is shutting down, false otherwise
      • doStart

        protected void doStart()
      • doStop

        protected void doStop()
      • getHome

        public File getHome()
        Description copied from interface: RuntimeService
        Gets the home directory of the runtime.
        Specified by:
        getHome in interface RuntimeService
        Returns:
        the home directory
      • setHome

        public void setHome​(File home)
      • getDescription

        public String getDescription()
        Description copied from interface: RuntimeService
        Gets the description of this runtime service.
        Specified by:
        getDescription in interface RuntimeService
        Returns:
        the runtime service description
      • getProperty

        public String getProperty​(String name)
        Description copied from interface: RuntimeService
        Gets a runtime service property given its name.
        Specified by:
        getProperty in interface RuntimeService
        Parameters:
        name - the property name
        Returns:
        the property value if any or null if none
      • getProperty

        public String getProperty​(String name,
                                  String defValue)
        Description copied from interface: RuntimeService
        Gets a property value using a default value if the property was not set.
        Specified by:
        getProperty in interface RuntimeService
        Parameters:
        name - the property name
        defValue - the default value to use when the property doesn't exists
        Returns:
        the property value
      • getComponent

        public Object getComponent​(ComponentName name)
        Description copied from interface: RuntimeService
        Gets a component given its name.
        Specified by:
        getComponent in interface RuntimeService
        Parameters:
        name - the component name
        Returns:
        the component, or null if no such component was registered
      • getService

        public <T> T getService​(Class<T> serviceClass)
        Description copied from interface: RuntimeService
        Gets the service of type serviceClass if such a service was declared by a resolved runtime component.

        If the component is not yet activated, it will be prior to return the service.

        Specified by:
        getService in interface RuntimeService
        Type Parameters:
        T - the service type
        Parameters:
        serviceClass - the service class
        Returns:
        the service object
      • expandVars

        public String expandVars​(String expression)
        Description copied from interface: RuntimeService
        Replaces any substring in the form ${property.name} with the corresponding runtime property value if any, otherwise leaves the substring unchanged.
        Specified by:
        expandVars in interface RuntimeService
        Parameters:
        expression - the expression to process
        Returns:
        the expanded expression
      • getBundleFile

        public File getBundleFile​(org.osgi.framework.Bundle bundle)
        Description copied from interface: RuntimeService
        OSGi frameworks are using a string Bundle.getLocation() to identify bundle locations.

        This method try to convert the bundle location to real file if possible. If this bundle location cannot be converted to a file (e.g. it may be a remote URL), null is returned.

        This method works only for bundles that are installed as files on the host file system.

        Specified by:
        getBundleFile in interface RuntimeService
        Returns:
        the bundle file, or null
      • getBundle

        public org.osgi.framework.Bundle getBundle​(String symbolicName)
        Description copied from interface: RuntimeService
        Get an installed bundle given its symbolic name. This method is not handling versions.
        Specified by:
        getBundle in interface RuntimeService
      • getStatusMessage

        public boolean getStatusMessage​(StringBuilder msg)
        Description copied from interface: RuntimeService
        Computes the runtime status, adds it to the given string builder, and return true if some problems have been detected.
        Specified by:
        getStatusMessage in interface RuntimeService
        Parameters:
        msg - summary message about all components loading status
        Returns:
        true if there was no detected error, else return false
        Since:
        5.5
      • getErrorLoggerThread

        public static Thread getErrorLoggerThread​(String message)
        Error logger which does its logging from a separate thread, for thread isolation.
        Parameters:
        message - the message to log
        Returns:
        a thread that can be started to do the logging
        Since:
        9.2, 8.10-HF05