Package org.nuxeo.runtime.model.impl
Class ComponentInstanceImpl
- java.lang.Object
-
- org.nuxeo.runtime.model.impl.ComponentInstanceImpl
-
- All Implemented Interfaces:
Adaptable
,ComponentContext
,ComponentInstance
,Extensible
public class ComponentInstanceImpl extends Object implements ComponentInstance
- Author:
- Bogdan Stefanescu
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ComponentInstanceImpl.OSGiServiceFactory
-
Field Summary
Fields Modifier and Type Field Description protected List<ComponentInstanceImpl.OSGiServiceFactory>
factories
protected Object
instance
protected RegistrationInfo
ri
-
Constructor Summary
Constructors Constructor Description ComponentInstanceImpl(RegistrationInfo ri)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
activate()
Activates the implementation instance.void
create()
protected Object
createInstance()
void
deactivate()
Deactivates the implementation instance.void
destroy()
Destroys this instance.<T> T
getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object.RuntimeContext
getContext()
Gets the runtime context attached to this instance.Object
getInstance()
Gets the actual component implementation instance.ComponentName
getName()
Gets the name of the component.Property
getProperty(String property)
String[]
getPropertyNames()
Object
getPropertyValue(String property)
Object
getPropertyValue(String property, Object defValue)
String[]
getProvidedServiceNames()
Gets the list of provided services, or null if no service is provided.RegistrationInfo
getRegistrationInfo()
Gets the Registration InfoRuntimeContext
getRuntimeContext()
protected void
handleError(String message, RuntimeMessage.Source source, String sourceId, Exception e)
void
registerExtension(Extension extension)
Registers the given extension.void
registerServices()
Register provided services as OSGi servicesvoid
reload()
Deprecated.since 9.3, but in fact since 5.6, only usage inRegistrationInfoImpl
void
start()
Starts the implementation instance.void
stop()
Stops the implementation instance.String
toString()
void
unregisterExtension(Extension extension)
Unregisters the given extension.void
unregisterServices()
-
-
-
Field Detail
-
instance
protected Object instance
-
ri
protected RegistrationInfo ri
-
factories
protected List<ComponentInstanceImpl.OSGiServiceFactory> factories
-
-
Constructor Detail
-
ComponentInstanceImpl
public ComponentInstanceImpl(RegistrationInfo ri)
-
-
Method Detail
-
getInstance
public Object getInstance()
Description copied from interface:ComponentInstance
Gets the actual component implementation instance.- Specified by:
getInstance
in interfaceComponentInstance
- Returns:
- the component implementation instance
-
create
public void create()
-
createInstance
protected Object createInstance()
-
destroy
public void destroy()
Description copied from interface:ComponentInstance
Destroys this instance.- Specified by:
destroy
in interfaceComponentInstance
-
getContext
public RuntimeContext getContext()
Description copied from interface:ComponentInstance
Gets the runtime context attached to this instance.- Specified by:
getContext
in interfaceComponentInstance
- Returns:
- the runtime context
-
getName
public ComponentName getName()
Description copied from interface:ComponentInstance
Gets the name of the component.- Specified by:
getName
in interfaceComponentInstance
- Returns:
- the component name
-
activate
public void activate()
Description copied from interface:ComponentInstance
Activates the implementation instance.- Specified by:
activate
in interfaceComponentInstance
-
deactivate
public void deactivate()
Description copied from interface:ComponentInstance
Deactivates the implementation instance.- Specified by:
deactivate
in interfaceComponentInstance
-
start
public void start()
Description copied from interface:ComponentInstance
Starts the implementation instance.- Specified by:
start
in interfaceComponentInstance
- Since:
- 9.3
-
stop
public void stop() throws InterruptedException
Description copied from interface:ComponentInstance
Stops the implementation instance.- Specified by:
stop
in interfaceComponentInstance
- Throws:
InterruptedException
- Since:
- 9.3
-
reload
@Deprecated public void reload()
Deprecated.since 9.3, but in fact since 5.6, only usage inRegistrationInfoImpl
Description copied from interface:ComponentInstance
Reload the component. All the extensions and registries are reloaded.- Specified by:
reload
in interfaceComponentInstance
-
registerExtension
public void registerExtension(Extension extension)
Description copied from interface:Extensible
Registers the given extension.- Specified by:
registerExtension
in interfaceExtensible
- Parameters:
extension
- the extension to register
-
unregisterExtension
public void unregisterExtension(Extension extension)
Description copied from interface:Extensible
Unregisters the given extension.- Specified by:
unregisterExtension
in interfaceExtensible
- Parameters:
extension
- the extension to unregister
-
handleError
protected void handleError(String message, RuntimeMessage.Source source, String sourceId, Exception e)
-
getAdapter
public <T> T getAdapter(Class<T> adapter)
Description copied from interface:Adaptable
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.- Specified by:
getAdapter
in interfaceAdaptable
- Parameters:
adapter
- the adapter class to look up- Returns:
- a object castable to the given class, or
null
if this object does not have an adapter for the given class
-
getPropertyNames
public String[] getPropertyNames()
- Specified by:
getPropertyNames
in interfaceComponentContext
-
getProperty
public Property getProperty(String property)
- Specified by:
getProperty
in interfaceComponentContext
-
getRuntimeContext
public RuntimeContext getRuntimeContext()
- Specified by:
getRuntimeContext
in interfaceComponentContext
-
getPropertyValue
public Object getPropertyValue(String property)
- Specified by:
getPropertyValue
in interfaceComponentContext
-
getPropertyValue
public Object getPropertyValue(String property, Object defValue)
- Specified by:
getPropertyValue
in interfaceComponentContext
-
getProvidedServiceNames
public String[] getProvidedServiceNames()
Description copied from interface:ComponentInstance
Gets the list of provided services, or null if no service is provided.- Specified by:
getProvidedServiceNames
in interfaceComponentInstance
- Returns:
- an array containing the service class names or null if no service is provided
-
registerServices
public void registerServices()
Register provided services as OSGi services
-
unregisterServices
public void unregisterServices()
-
getRegistrationInfo
public RegistrationInfo getRegistrationInfo()
Description copied from interface:ComponentInstance
Gets the Registration Info- Specified by:
getRegistrationInfo
in interfaceComponentInstance
- Returns:
- the registration info
-
-