Package org.nuxeo.runtime
Class AbstractRuntimeService
java.lang.Object
org.nuxeo.runtime.AbstractRuntimeService
- All Implemented Interfaces:
RuntimeService
- Direct Known Subclasses:
OSGiRuntimeService,SimpleRuntime,TestRuntime
Abstract implementation of the Runtime Service.
Implementors are encouraged to extend this class instead of directly implementing the RuntimeService
interface.
- Author:
- Bogdan Stefanescu
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classConfigure the logging system (log4j) at runtime startup and do any cleanup is needed when the runtime is stopped -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final RuntimeContextprotected booleanprotected booleanprotected AbstractRuntimeService.LogConfigprotected ComponentManagerprotected final RuntimeMessageHandlerImplMessage handler for runtime.protected CryptoPropertiesstatic final StringProperty that controls whether or not to redirect JUL to JCL.static final Stringprotected File -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractRuntimeService(DefaultRuntimeContext context, Map<String, String> properties) -
Method Summary
Modifier and TypeMethodDescriptionprotected ComponentManagerprotected voiddoStart()protected voiddoStop()expandVars(String expression) Replaces any substring in the form${property.name}with the corresponding runtime property value if any, otherwise leaves the substring unchanged.protected static URLorg.osgi.framework.BundleGet an installed bundle given its symbolic name.getBundleFile(org.osgi.framework.Bundle bundle) OSGi frameworks are using a stringBundle.getLocation()to identify bundle locations.getComponent(ComponentName name) Gets a component given its name.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.static ThreadgetErrorLoggerThread(String message) Error logger which does its logging from a separate thread, for thread isolation.getHome()Gets the home directory of the runtime.Gets the runtime message handler.Gets runtime service properties.getProperty(String name) Gets a runtime service property given its name.getProperty(String name, String defValue) 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.booleanComputes the runtime status, adds it to the given string builder, and return true if some problems have been detected.booleanReturns true if the runtime is shutting down.booleanReturns true if the runtime is started.protected voidvoidvoidsetProperty(String name, Object value) voidstart()Starts the runtime.voidstop()Stops the runtime.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.nuxeo.runtime.RuntimeService
getComponent, getComponentInstance, getName, getVersion, reloadProperties
-
Field Details
-
REDIRECT_JUL
Property that controls whether or not to redirect JUL to JCL. By default is true (JUL will be redirected)- See Also:
-
REDIRECT_JUL_THRESHOLD
- See Also:
-
isStarted
protected boolean isStarted -
isShuttingDown
protected boolean isShuttingDown -
workingDir
-
properties
-
manager
-
context
-
logConfig
-
messageHandler
Message handler for runtime. This handler takes care to store messages with the component manager step.- Since:
- 9.10
-
-
Constructor Details
-
AbstractRuntimeService
-
AbstractRuntimeService
-
-
Method Details
-
getMessageHandler
Description copied from interface:RuntimeServiceGets 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.
- Specified by:
getMessageHandlerin interfaceRuntimeService- Returns:
- the message handler for runtime.
- Since:
- 9.10
-
createComponentManager
-
getBuiltinFeatureURL
-
start
public void start()Description copied from interface:RuntimeServiceStarts the runtime.- Specified by:
startin interfaceRuntimeService
-
stop
public void stop()Description copied from interface:RuntimeServiceStops the runtime.- Specified by:
stopin interfaceRuntimeService
-
isStarted
public boolean isStarted()Description copied from interface:RuntimeServiceReturns true if the runtime is started.- Specified by:
isStartedin interfaceRuntimeService- Returns:
- true if the runtime is started, false otherwise
-
isShuttingDown
public boolean isShuttingDown()Description copied from interface:RuntimeServiceReturns true if the runtime is shutting down.- Specified by:
isShuttingDownin interfaceRuntimeService- Returns:
- true if the runtime is shutting down, false otherwise
-
loadConfig
- Throws:
IOException
-
doStart
protected void doStart() -
doStop
protected void doStop() -
getHome
Description copied from interface:RuntimeServiceGets the home directory of the runtime.- Specified by:
getHomein interfaceRuntimeService- Returns:
- the home directory
-
setHome
-
getDescription
Description copied from interface:RuntimeServiceGets the description of this runtime service.- Specified by:
getDescriptionin interfaceRuntimeService- Returns:
- the runtime service description
-
getProperties
Description copied from interface:RuntimeServiceGets runtime service properties.- Specified by:
getPropertiesin interfaceRuntimeService- Returns:
- the runtime properties
-
getProperty
Description copied from interface:RuntimeServiceGets a runtime service property given its name.- Specified by:
getPropertyin interfaceRuntimeService- Parameters:
name- the property name- Returns:
- the property value if any or null if none
-
getProperty
Description copied from interface:RuntimeServiceGets a property value using a default value if the property was not set.- Specified by:
getPropertyin interfaceRuntimeService- Parameters:
name- the property namedefValue- the default value to use when the property doesn't exists- Returns:
- the property value
-
setProperty
- Specified by:
setPropertyin interfaceRuntimeService
-
toString
-
getComponent
Description copied from interface:RuntimeServiceGets a component given its name.- Specified by:
getComponentin interfaceRuntimeService- Parameters:
name- the component name- Returns:
- the component, or null if no such component was registered
-
getComponentInstance
Description copied from interface:RuntimeServiceGets a component implementation instance given its name.- Specified by:
getComponentInstancein interfaceRuntimeService- Parameters:
name- the component name- Returns:
- the component or null if no such component was registered
-
getComponentManager
Description copied from interface:RuntimeServiceGets the component manager.- Specified by:
getComponentManagerin interfaceRuntimeService- Returns:
- the component manager
-
getContext
Description copied from interface:RuntimeServiceGets the context of the runtime bundle.- Specified by:
getContextin interfaceRuntimeService- Returns:
- the context object
-
getService
Description copied from interface:RuntimeServiceGets 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:
getServicein interfaceRuntimeService- Type Parameters:
T- the service type- Parameters:
serviceClass- the service class- Returns:
- the service object
-
expandVars
Description copied from interface:RuntimeServiceReplaces any substring in the form${property.name}with the corresponding runtime property value if any, otherwise leaves the substring unchanged.- Specified by:
expandVarsin interfaceRuntimeService- Parameters:
expression- the expression to process- Returns:
- the expanded expression
-
getBundleFile
Description copied from interface:RuntimeServiceOSGi 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.
- Specified by:
getBundleFilein interfaceRuntimeService- Returns:
- the bundle file, or null
-
getBundle
Description copied from interface:RuntimeServiceGet an installed bundle given its symbolic name. This method is not handling versions.- Specified by:
getBundlein interfaceRuntimeService
-
getStatusMessage
Description copied from interface:RuntimeServiceComputes the runtime status, adds it to the given string builder, and return true if some problems have been detected.- Specified by:
getStatusMessagein interfaceRuntimeService- Parameters:
msg- summary message about all components loading status- Returns:
- true if there was no detected error, else return false
- Since:
- 5.5
-
getErrorLoggerThread
Error logger which does its logging from a separate thread, for thread isolation.- Parameters:
message- the message to log- Returns:
- a thread that can be started to do the logging
- Since:
- 9.2, 8.10-HF05
-