C
- public abstract class ResourceAdapter<C extends ResourceConfiguration> extends java.lang.Object implements Resource
Constructor and Description |
---|
ResourceAdapter(PositionInformation positionInformation,
ResourceConfiguration configuration,
java.lang.String typeIdentifier,
java.lang.Class<C> configurationClass,
java.lang.String defaultName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessageListener(MessageListener writer)
Adds a message listener to which (non-error) status information is send.
|
protected void |
assertInitialized() |
protected C |
getConfiguration() |
java.lang.String |
getName()
Returns a name of the component meant for human interpretation.
|
PositionInformation |
getPositionInformation()
Returns the component's position information, e.g.
|
java.lang.String |
getTypeIdentifier()
Returns the type identifier of the resource.
|
java.util.UUID |
getUUID()
Returns a unique ID of the component.
|
void |
initialize(MeasurementContext measurementContext)
Initializes the resource.
|
boolean |
isInitialized()
Returns true if the addon is initialized.
|
void |
removeMessageListener(MessageListener writer)
Removes a previously added listener.
|
protected void |
sendErrorMessage(java.lang.String message,
java.lang.Throwable error)
Sends an error message to all registered listeners.
|
protected void |
sendMessage(java.lang.String message)
Sends a message to all registered listeners.
|
void |
setName(java.lang.String name)
Sets the name of the component meant for human interpretation.
|
void |
uninitialize(MeasurementContext measurementContext)
Called to free all acquired resources of the addon.
|
public ResourceAdapter(PositionInformation positionInformation, ResourceConfiguration configuration, java.lang.String typeIdentifier, java.lang.Class<C> configurationClass, java.lang.String defaultName) throws ConfigurationException
positionInformation
- logical position in measurement.configuration
- Configuration of resource.typeIdentifier
- type identifier of resource.configurationClass
- defaultName
- ConfigurationException
public void addMessageListener(MessageListener writer) throws java.rmi.RemoteException
Component
addMessageListener
in interface Component
writer
- Listener to which output should be written.java.rmi.RemoteException
public void removeMessageListener(MessageListener writer) throws java.rmi.RemoteException
Component
removeMessageListener
in interface Component
writer
- Listener which should be removed.java.rmi.RemoteException
protected void sendMessage(java.lang.String message)
message
- Message to send.protected void sendErrorMessage(java.lang.String message, java.lang.Throwable error)
message
- Error message to send.error
- The error which occurred.public java.lang.String getTypeIdentifier() throws java.rmi.RemoteException
Resource
getTypeIdentifier
in interface Resource
java.rmi.RemoteException
public void initialize(MeasurementContext measurementContext) throws ResourceException, java.rmi.RemoteException
Resource
getTypeIdentifier
, getConfigurationClass
, isInitialized
,
addDetectionOutputWriter
, or removeMessageListener
.initialize
in interface Resource
measurementContext
- The measurement context.ResourceException
java.rmi.RemoteException
public void uninitialize(MeasurementContext measurementContext) throws ResourceException, java.rmi.RemoteException
Resource
uninitialize
in interface Resource
measurementContext
- The measurement context.ResourceException
java.rmi.RemoteException
public boolean isInitialized() throws java.rmi.RemoteException
Resource
isInitialized
in interface Resource
java.rmi.RemoteException
protected C getConfiguration()
protected void assertInitialized() throws ResourceException, java.rmi.RemoteException
ResourceException
java.rmi.RemoteException
public PositionInformation getPositionInformation() throws java.rmi.RemoteException
Component
getPositionInformation
in interface Component
java.rmi.RemoteException
public java.lang.String getName() throws java.rmi.RemoteException
Component
public void setName(java.lang.String name) throws java.rmi.RemoteException
Component
public java.util.UUID getUUID() throws java.rmi.RemoteException
Component
UUID.equals(Object)
and UUID.randomUUID()
.