Nuxeo Enterprise Platform 5.4

org.nuxeo.runtime
Class AbstractRuntimeService

java.lang.Object
  extended by org.nuxeo.runtime.AbstractRuntimeService
All Implemented Interfaces:
RuntimeService
Direct Known Subclasses:
OSGiRuntimeService, SimpleRuntime, TestRuntime

public abstract class AbstractRuntimeService
extends java.lang.Object
implements RuntimeService

Abstract implementation of the Runtime Service.

Implementors are encouraged to extend this class instead of directly implementing the RuntimeService interface.

Author:
Bogdan Stefanescu

Field Summary
static java.lang.String REDIRECT_JUL
          Property that controls whether or not to redirect JUL to JCL.
 
Method Summary
 java.lang.String expandVars(java.lang.String expression)
          Replaces any substring in the form ${property.name} with the corresponding runtime property value if any, otherwise leaves the substring unchanged.
 AdapterManager getAdapterManager()
           
 java.io.File getBundleFile(org.osgi.framework.Bundle bundle)
          OSGi frameworks are using a string Bundle.getLocation() to identify bundle locations.
 java.lang.Object getComponent(ComponentName name)
          Gets a component given its name.
 java.lang.Object getComponent(java.lang.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(java.lang.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.
 java.lang.String getDescription()
          Gets the description of this runtime service.
 java.io.File getHome()
          Gets the home directory of the runtime.
 java.util.Properties getProperties()
          Gets runtime service properties.
 java.lang.String getProperty(java.lang.String name)
          Gets a runtime service property given its name.
 java.lang.String getProperty(java.lang.String name, java.lang.String defValue)
          Gets a property value using a default value if the property was not set.
<T> T
getService(java.lang.Class<T> serviceClass)
          Gets the service of type serviceClass if such a service was declared by a resolved runtime component.
 java.util.List<java.lang.String> getWarnings()
          Gets a list of startup warnings.
 boolean isStarted()
          Tests whether or not the runtime is started.
 void setHome(java.io.File home)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void start()
          Starts the runtime.
 void stop()
          Stops the runtime.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.nuxeo.runtime.RuntimeService
getName, getVersion, reloadProperties
 

Field Detail

REDIRECT_JUL

public static final java.lang.String REDIRECT_JUL
Property that controls whether or not to redirect JUL to JCL. By default is true (JUL will be redirected)

See Also:
Constant Field Values
Method Detail

getWarnings

public java.util.List<java.lang.String> getWarnings()
Description copied from interface: RuntimeService
Gets a list of startup warnings. Can be modified to add new warnings.

Specified by:
getWarnings in interface RuntimeService
Returns:
the warning list

start

public void start()
           throws java.lang.Exception
Description copied from interface: RuntimeService
Starts the runtime.

Specified by:
start in interface RuntimeService
Throws:
java.lang.Exception - if any exception occurred during startup

stop

public void stop()
          throws java.lang.Exception
Description copied from interface: RuntimeService
Stops the runtime.

Specified by:
stop in interface RuntimeService
Throws:
java.lang.Exception - if any exception occurred during shutdown

isStarted

public boolean isStarted()
Description copied from interface: RuntimeService
Tests whether or not the runtime is started.

Specified by:
isStarted in interface RuntimeService
Returns:
true if the runtime is started, false otherwise

getHome

public java.io.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(java.io.File home)

getDescription

public java.lang.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

getAdapterManager

public AdapterManager getAdapterManager()

getProperties

public java.util.Properties getProperties()
Description copied from interface: RuntimeService
Gets runtime service properties.

Specified by:
getProperties in interface RuntimeService
Returns:
the runtime properties

getProperty

public java.lang.String getProperty(java.lang.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 java.lang.String getProperty(java.lang.String name,
                                    java.lang.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

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getComponent

public java.lang.Object getComponent(java.lang.String name)
Description copied from interface: RuntimeService
Gets a component given its name as a string.

Specified by:
getComponent in interface RuntimeService
Parameters:
name - the component name as a string
Returns:
the component

getComponent

public java.lang.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

getComponentInstance

public ComponentInstance getComponentInstance(java.lang.String name)
Description copied from interface: RuntimeService
Gets a component implementation instance given its name as a string.

Specified by:
getComponentInstance in interface RuntimeService
Parameters:
name - the component name as a string
Returns:
the component

getComponentInstance

public ComponentInstance getComponentInstance(ComponentName name)
Description copied from interface: RuntimeService
Gets a component implementation instance given its name.

Specified by:
getComponentInstance in interface RuntimeService
Parameters:
name - the component name
Returns:
the component or null if no such component was registered

getComponentManager

public ComponentManager getComponentManager()
Description copied from interface: RuntimeService
Gets the component manager.

Specified by:
getComponentManager in interface RuntimeService
Returns:
the component manager

getContext

public RuntimeContext getContext()
Description copied from interface: RuntimeService
Gets the context of the runtime bundle.

Specified by:
getContext in interface RuntimeService
Returns:
the context object

getService

public <T> T getService(java.lang.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 java.lang.String expandVars(java.lang.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 java.io.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

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.