public class DefaultComponent extends Object implements Component, Adaptable
Modifier and Type | Field and Description |
---|---|
protected Long |
lastModified |
protected String |
name |
Constructor and Description |
---|
DefaultComponent() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
<T> T |
getAdapter(Class<T> adapter)
Returns an object which is an instance of the given class associated with this object.
|
protected <T extends Descriptor> |
getDescriptor(String xp,
String id) |
protected <T extends Descriptor> |
getDescriptors(String xp) |
Long |
getLastModified()
Returns the last modification timestamp or null if unknown.
|
protected DescriptorRegistry |
getRegistry() |
protected boolean |
register(String xp,
Descriptor descriptor) |
void |
registerContribution(Object contribution,
String xp,
ComponentInstance component) |
void |
registerExtension(Extension extension)
Registers the given extension.
|
void |
setLastModified(Long lastModified)
Sets the last modified date.
|
protected void |
setModifiedNow()
Sets the last modified date to current date timestamp
|
void |
setName(String name)
Sets the name for this component, as it was defined in its XML.
|
void |
start(ComponentContext context)
Start the component.
|
void |
stop(ComponentContext context)
Stop the component.
|
protected boolean |
unregister(String xp,
Descriptor descriptor) |
void |
unregisterContribution(Object contribution,
String xp,
ComponentInstance component) |
void |
unregisterExtension(Extension extension)
Unregisters the given extension.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applicationStarted, getApplicationStartedOrder
protected Long lastModified
public DefaultComponent()
public void setName(String name)
Component
This is called once after construction by the runtime framework.
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
public void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
context
- the runtime contextpublic void registerExtension(Extension extension)
Extensible
registerExtension
in interface Extensible
extension
- the extension to registerpublic void unregisterExtension(Extension extension)
Extensible
unregisterExtension
in interface Extensible
extension
- the extension to unregisterpublic void registerContribution(Object contribution, String xp, ComponentInstance component)
public void unregisterContribution(Object contribution, String xp, ComponentInstance component)
public <T> T getAdapter(Class<T> adapter)
Adaptable
null
if no such object can be found.getAdapter
in interface Adaptable
adapter
- the adapter class to look upnull
if this object does not have an adapter for
the given classpublic void start(ComponentContext context)
Component
public void stop(ComponentContext context) throws InterruptedException
Component
stop
in interface Component
InterruptedException
protected void setModifiedNow()
public Long getLastModified()
TimestampedService
This method is useful for third-party code implementing caching on resources held by the component/service.
getLastModified
in interface TimestampedService
TimestampedService.setLastModified(Long)
public void setLastModified(Long lastModified)
TimestampedService
This method is supposed to be called whenever the component/service resources or state changes.
setLastModified
in interface TimestampedService
TimestampedService.getLastModified()
protected DescriptorRegistry getRegistry()
protected boolean register(String xp, Descriptor descriptor)
protected boolean unregister(String xp, Descriptor descriptor)
protected <T extends Descriptor> T getDescriptor(String xp, String id)
protected <T extends Descriptor> List<T> getDescriptors(String xp)
Copyright © 2019 Nuxeo. All rights reserved.