Interface RuntimeService

    • Method Detail

      • start

        void start()
        Starts the runtime.
      • isStarted

        boolean isStarted()
        Returns true if the runtime is started.
        Returns:
        true if the runtime is started, false otherwise
      • isShuttingDown

        boolean isShuttingDown()
        Returns true if the runtime is shutting down.
        Returns:
        true if the runtime is shutting down, false otherwise
        Since:
        5.5
      • getHome

        File getHome()
        Gets the home directory of the runtime.
        Returns:
        the home directory
      • getName

        String getName()
        Gets the name of this runtime service.
        Returns:
        the runtime service name
      • getDescription

        String getDescription()
        Gets the description of this runtime service.
        Returns:
        the runtime service description
      • getVersion

        Version getVersion()
        Gets the version of this runtime service.
        Returns:
        the runtime service version
      • getProperties

        Properties getProperties()
        Gets runtime service properties.
        Returns:
        the runtime properties
      • reloadProperties

        void reloadProperties()
                       throws IOException
        Reread all property files loaded at startup.
        Throws:
        IOException
      • getProperty

        String getProperty​(String name)
        Gets a runtime service property given its name.
        Parameters:
        name - the property name
        Returns:
        the property value if any or null if none
      • getProperty

        String getProperty​(String name,
                           String defaultValue)
        Gets a property value using a default value if the property was not set.
        Parameters:
        name - the property name
        defaultValue - the default value to use when the property doesn't exists
        Returns:
        the property value
      • expandVars

        String expandVars​(String expression)
        Replaces any substring in the form ${property.name} with the corresponding runtime property value if any, otherwise leaves the substring unchanged.
        Parameters:
        expression - the expression to process
        Returns:
        the expanded expression
      • getComponentManager

        ComponentManager getComponentManager()
        Gets the component manager.
        Returns:
        the component manager
      • getComponent

        default Object getComponent​(String name)
        Gets a component given its name as a string.
        Parameters:
        name - the component name as a string
        Returns:
        the component
      • getComponent

        Object getComponent​(ComponentName name)
        Gets a component given its name.
        Parameters:
        name - the component name
        Returns:
        the component, or null if no such component was registered
      • getComponentInstance

        default ComponentInstance getComponentInstance​(String name)
        Gets a component implementation instance given its name as a string.
        Parameters:
        name - the component name as a string
        Returns:
        the component
      • getComponentInstance

        ComponentInstance getComponentInstance​(ComponentName name)
        Gets a component implementation instance given its name.
        Parameters:
        name - the component name
        Returns:
        the component or null if no such component was registered
      • getContext

        RuntimeContext getContext()
        Gets the context of the runtime bundle.
        Returns:
        the context object
      • getService

        <T> T getService​(Class<T> serviceClass)
        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.

        Type Parameters:
        T - the service type
        Parameters:
        serviceClass - the service class
        Returns:
        the service object
      • getMessageHandler

        RuntimeMessageHandler getMessageHandler()
        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.

        Returns:
        the message handler for runtime.
        Since:
        9.10
      • getBundleFile

        File getBundleFile​(org.osgi.framework.Bundle bundle)
        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.

        Returns:
        the bundle file, or null
      • getBundle

        org.osgi.framework.Bundle getBundle​(String symbolicName)
        Get an installed bundle given its symbolic name. This method is not handling versions.
      • getStatusMessage

        boolean getStatusMessage​(StringBuilder msg)
        Computes the runtime status, adds it to the given string builder, and return true if some problems have been detected.
        Returns:
        true if there are warnings/errors on current runtime.
        Since:
        5.6
      • setProperty

        void setProperty​(String name,
                         Object value)
        Since:
        7.4