Class AbstractModelAccess
- java.lang.Object
-
- de.iip_ecosphere.platform.connectors.model.AbstractModelAccess
-
- All Implemented Interfaces:
ModelAccess
public abstract class AbstractModelAccess extends java.lang.Object implements ModelAccess
Basic implementation of the model access.- Author:
- Holger Eichelberger, SSE
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAbstractModelAccess.NotificationChangedListenerListener for notification changes.
-
Field Summary
Fields Modifier and Type Field Description private booleandetailNotificationsprivate AbstractModelAccess.NotificationChangedListenernotificationChangedListenerprivate java.lang.BooleanuseNotifications
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractModelAccess(AbstractModelAccess.NotificationChangedListener notificationChangedListener)Creates an abstract model access with notification changed listener.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ConnectorParametergetConnectorParameter()Returns the actual connector parameters that apply for this model instance.java.lang.StringiqName(java.lang.String... names)Composes multiple names to a qualified instance name starting withModelAccess.topInstancesQName()usingModelAccess.getQSeparator().protected booleanisDetailNotifiedItemEnabled()Returns whether detailed notifications for monitored items is enabled.voidmonitor(java.lang.String... qNames)Monitors the givenqNameelement in the server namespace and upon changes, triggers a reception in the connector.voidmonitorModelChanges()Monitors generic model changes, in particular those not covered byModelAccess.monitor(String...).java.lang.StringqName(java.lang.String... names)Composes multiple names to a qualified name usingModelAccess.getQSeparator().private java.lang.StringqName(java.lang.String init, java.lang.String... names)Composes a qualified name.voidsetDetailNotifiedItem(boolean detail)Whether the connector shall send detailed information about monitored changes.protected booleanuseNotifications()Returns whether (event-based) notifications or polling shall be used.voiduseNotifications(boolean useNotifications)Use notifications or polling.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.iip_ecosphere.platform.connectors.model.ModelAccess
call, get, get, getBoolean, getByte, getDouble, getFloat, getInputConverter, getInt, getLong, getOutputConverter, getQSeparator, getShort, getString, getStruct, monitor, monitorModelChanges, registerCustomType, set, setBoolean, setByte, setDouble, setFloat, setInt, setLong, setShort, setString, setStruct, stepInto, stepOut, topInstancesQName
-
-
-
-
Field Detail
-
detailNotifications
private boolean detailNotifications
-
useNotifications
private java.lang.Boolean useNotifications
-
notificationChangedListener
private AbstractModelAccess.NotificationChangedListener notificationChangedListener
-
-
Constructor Detail
-
AbstractModelAccess
protected AbstractModelAccess(AbstractModelAccess.NotificationChangedListener notificationChangedListener)
Creates an abstract model access with notification changed listener.- Parameters:
notificationChangedListener- listener to be called when the notification settings have been changed, typically during initialization of the connector/model
-
-
Method Detail
-
isDetailNotifiedItemEnabled
protected final boolean isDetailNotifiedItemEnabled()
Returns whether detailed notifications for monitored items is enabled.- Returns:
truefor details,falsefor null
-
setDetailNotifiedItem
public final void setDetailNotifiedItem(boolean detail)
Description copied from interface:ModelAccessWhether the connector shall send detailed information about monitored changes. Intended to be used inConnectorOutputTypeTranslator.initializeModelAccess(). [monitoring]- Specified by:
setDetailNotifiedItemin interfaceModelAccess- Parameters:
detail-truefor details,falsefor null (default)
-
useNotifications
protected final boolean useNotifications()
Returns whether (event-based) notifications or polling shall be used.- Returns:
truefor notifications,falsefor polling
-
useNotifications
public final void useNotifications(boolean useNotifications)
Description copied from interface:ModelAccessUse notifications or polling. This is required here, as the related translator codeModelAccess.monitor(String...)depends on that. [monitoring]- Specified by:
useNotificationsin interfaceModelAccess- Parameters:
useNotifications-truefor notifications,falsefor polling
-
qName
private java.lang.String qName(java.lang.String init, java.lang.String... names)Composes a qualified name.- Parameters:
init- the initialization for the result to be used when the first non-empty name shall be appendednames- the names to be appended- Returns:
- the qualified name, empty if there was nothing to compose irrespective of
init
-
qName
public java.lang.String qName(java.lang.String... names)
Description copied from interface:ModelAccessComposes multiple names to a qualified name usingModelAccess.getQSeparator().- Specified by:
qNamein interfaceModelAccess- Parameters:
names- the names (may be empty but shall be ignored then)- Returns:
- the composed qualified name, empty if no
nameswere given
-
iqName
public java.lang.String iqName(java.lang.String... names)
Description copied from interface:ModelAccessComposes multiple names to a qualified instance name starting withModelAccess.topInstancesQName()usingModelAccess.getQSeparator().- Specified by:
iqNamein interfaceModelAccess- Parameters:
names- the names (may be empty but shall be ignored then)- Returns:
- the composed qualified name, empty if no
nameswere given
-
monitor
public void monitor(java.lang.String... qNames) throws java.io.IOExceptionDescription copied from interface:ModelAccessMonitors the givenqNameelement in the server namespace and upon changes, triggers a reception in the connector. Intended to be used inConnectorOutputTypeTranslator.initializeModelAccess().ConnectorParameter.getNotificationInterval()shall be used as default value if applicable. [monitoring]- Specified by:
monitorin interfaceModelAccess- Parameters:
qNames- the qualified names of the elements to monitor- Throws:
java.io.IOException- if creating the monitor fails
-
monitorModelChanges
public void monitorModelChanges() throws java.io.IOExceptionDescription copied from interface:ModelAccessMonitors generic model changes, in particular those not covered byModelAccess.monitor(String...). Triggers a reception in the connector. Intended to be used inConnectorOutputTypeTranslator.initializeModelAccess().ConnectorParameter.getNotificationInterval()shall be used as default value if applicable. [monitoring]- Specified by:
monitorModelChangesin interfaceModelAccess- Throws:
java.io.IOException- if creating the monitor fails
-
getConnectorParameter
protected abstract ConnectorParameter getConnectorParameter()
Returns the actual connector parameters that apply for this model instance.- Returns:
- the connector parameters
-
-