Interface RuntimeService
-
- All Known Implementing Classes:
AbstractRuntimeService,OSGiRuntimeService,OSGiRuntimeTestService,SimpleRuntime,TestRuntime
public interface RuntimeServiceThe runtime service: a singleton object that provides access to the Nuxeo Runtime. The runtime service must be started before any other runtime component or object that accesses the runtime.This service is usually implemented for each target platform where Nuxeo Runtime should run.
It is recommended to extend the
AbstractRuntimeServiceclass instead of directly implementing this interface.After the runtime service was initialized, it may be accessed through the facade class
Framework.See:
Framework- Author:
- Bogdan Stefanescu
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description StringexpandVars(String expression)Replaces any substring in the form${property.name}with the corresponding runtime property value if any, otherwise leaves the substring unchanged.org.osgi.framework.BundlegetBundle(String symbolicName)Get an installed bundle given its symbolic name.FilegetBundleFile(org.osgi.framework.Bundle bundle)OSGi frameworks are using a stringBundle.getLocation()to identify bundle locations.default ObjectgetComponent(String name)Gets a component given its name as a string.ObjectgetComponent(ComponentName name)Gets a component given its name.default ComponentInstancegetComponentInstance(String name)Gets a component implementation instance given its name as a string.ComponentInstancegetComponentInstance(ComponentName name)Gets a component implementation instance given its name.ComponentManagergetComponentManager()Gets the component manager.RuntimeContextgetContext()Gets the context of the runtime bundle.StringgetDescription()Gets the description of this runtime service.FilegetHome()Gets the home directory of the runtime.RuntimeMessageHandlergetMessageHandler()Gets the runtime message handler.StringgetName()Gets the name of this runtime service.PropertiesgetProperties()Gets runtime service properties.StringgetProperty(String name)Gets a runtime service property given its name.StringgetProperty(String name, String defaultValue)Gets a property value using a default value if the property was not set.<T> TgetService(Class<T> serviceClass)Gets the service of type serviceClass if such a service was declared by a resolved runtime component.booleangetStatusMessage(StringBuilder msg)Computes the runtime status, adds it to the given string builder, and return true if some problems have been detected.VersiongetVersion()Gets the version of this runtime service.booleanisShuttingDown()Returns true if the runtime is shutting down.booleanisStarted()Returns true if the runtime is started.voidreloadProperties()Reread all property files loaded at startup.voidsetProperty(String name, Object value)voidstart()Starts the runtime.voidstop()Stops the runtime.
-
-
-
Method Detail
-
start
void start()
Starts the runtime.
-
stop
void stop() throws InterruptedException
Stops the runtime.- Throws:
InterruptedException
-
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 IOExceptionReread 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 namedefaultValue- 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 stringBundle.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
-
-