Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.runtime
Interface RuntimeService

All Known Implementing Classes:
AbstractRuntimeService, OSGiRuntimeService, OSGiRuntimeTestService, SimpleRuntime, TestRuntime

public interface RuntimeService

The 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 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
 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.
 org.osgi.framework.Bundle getBundle(String symbolicName)
          Get an installed bundle given its symbolic name.
 File getBundleFile(org.osgi.framework.Bundle bundle)
          OSGi frameworks are using a string Bundle.getLocation() to identify bundle locations.
 Object getComponent(ComponentName name)
          Gets a component given its name.
 Object getComponent(String name)
          Gets a component given its name as a string.
 ComponentInstance getComponentInstance(ComponentName name)
          Gets a component implementation instance given its name.
 ComponentInstance getComponentInstance(String name)
          Gets a component implementation instance given its name as a string.
 ComponentManager getComponentManager()
          Gets the component manager.
 RuntimeContext getContext()
          Gets the context of the runtime bundle.
 String getDescription()
          Gets the description of this runtime service.
 File getHome()
          Gets the home directory of the runtime.
 String getName()
          Gets the name of this runtime service.
 Properties getProperties()
          Gets runtime service properties.
 String getProperty(String name)
          Gets a runtime service property given its name.
 String 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.
 Version getVersion()
          Gets the version of this runtime service.
 List<String> getWarnings()
          Gets a list of startup warnings.
 boolean isShuttingDown()
          Returns true if the runtime is shutting down.
 boolean isStarted()
          Returns true if the runtime is started.
 void reloadProperties()
          Reread all property files loaded at startup.
 void start()
          Starts the runtime.
 void stop()
          Stops the runtime.
 

Method Detail

start

void start()
           throws Exception
Starts the runtime.

Throws:
Exception - if any exception occurred during startup

stop

void stop()
          throws Exception
Stops the runtime.

Throws:
Exception - if any exception occurred during shutdown

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.4.3

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 Exception
Reread all property files loaded at startup.

Throws:
Exception

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

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

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

getWarnings

List<String> getWarnings()
Gets a list of startup warnings. Can be modified to add new warnings.

Returns:
the warning list

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.

Parameters:
symbolicName -
Returns:

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.