Interface RuntimeService
- All Known Implementing Classes:
AbstractRuntimeService
,OSGiRuntimeService
,OSGiRuntimeTestService
,SimpleRuntime
,TestRuntime
This service is usually implemented for each target platform where Nuxeo Runtime should run.
It is recommended to extend the AbstractRuntimeService
class 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
Modifier and TypeMethodDescriptionexpandVars
(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.Bundle
Get an installed bundle given its symbolic name.getBundleFile
(org.osgi.framework.Bundle bundle) OSGi frameworks are using a stringBundle.getLocation()
to identify bundle locations.default Object
getComponent
(String name) Gets a component given its name as a string.getComponent
(ComponentName name) Gets a component given its name.default ComponentInstance
getComponentInstance
(String name) Gets a component implementation instance given its name as a string.Gets a component implementation instance given its name.Gets the component manager.Gets the context of the runtime bundle.Gets the description of this runtime service.getHome()
Gets the home directory of the runtime.Gets the runtime message handler.getName()
Gets the name of this runtime service.Gets runtime service properties.getProperty
(String name) Gets a runtime service property given its name.getProperty
(String name, String defaultValue) Gets a property value using a default value if the property was not set.<T> T
getService
(Class<T> serviceClass) Gets the service of type serviceClass if such a service was declared by a resolved runtime component.boolean
Computes the runtime status, adds it to the given string builder, and return true if some problems have been detected.Gets the version of this runtime service.boolean
Returns true if the runtime is shutting down.boolean
Returns true if the runtime is started.void
Reread all property files loaded at startup.void
setProperty
(String name, Object value) void
start()
Starts the runtime.void
stop()
Stops the runtime.
-
Method Details
-
start
void start()Starts the runtime. -
stop
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
Reread all property files loaded at startup.- Throws:
IOException
-
getProperty
Gets a runtime service property given its name.- Parameters:
name
- the property name- Returns:
- the property value if any or null if none
-
getProperty
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
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
Gets a component given its name as a string.- Parameters:
name
- the component name as a string- Returns:
- the component
-
getComponent
Gets a component given its name.- Parameters:
name
- the component name- Returns:
- the component, or null if no such component was registered
-
getComponentInstance
Gets a component implementation instance given its name as a string.- Parameters:
name
- the component name as a string- Returns:
- the component
-
getComponentInstance
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
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
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
Get an installed bundle given its symbolic name. This method is not handling versions. -
getStatusMessage
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
- Since:
- 7.4
-