Class OpcUaConnector<CO,CI>
- Type Parameters:
CO- the output type to the IIP-Ecosphere platformCI- the input type from the IIP-Ecosphere platform
- All Implemented Interfaces:
de.iip_ecosphere.platform.connectors.Connector<DataItem,,Object, CO, CI> de.iip_ecosphere.platform.connectors.events.EventHandlingConnector,de.iip_ecosphere.platform.connectors.model.AbstractModelAccess.NotificationChangedListener
@MachineConnector(specificSettings={})
public class OpcUaConnector<CO,CI>
extends de.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object,CO,CI>
Implements the generic OPC UA connector. Do not rename, this class is referenced in
META-INF/services.
For custom types such as structs, the following must apply: - A class implements the datatype and its fields.
- The class declares an accessible static field named
BINARY_ENCODING_IDof typeExpandedNodeId. - The class declares a top-level inner class called "Codec" of type
GenericDataTypeCodechaving an accessible no-arg constructor. - Value constructor parameters and accessors shall be based on Java types rather than OPC/Milo types
- Such custom types must be registered through
ModelAccess.registerCustomType(Class)inConnectorOutputTypeTranslator.initializeModelAccess().
- Author:
- Holger Eichelberger, SSE, Jan Cepok, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe descriptor of this connector (see META-INF/services).private classA fallback identity provider.private static classRealizes a node cache entry with value lifetime.private static classSpecialized model input converter.private static classSpecialized model output converter.protected classImplements the model access for OPC UA.Nested classes/interfaces inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
de.iip_ecosphere.platform.connectors.AbstractConnector.BasicAdapterProvider -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.eclipse.milo.opcua.sdk.client.OpcUaClientprivate static final DataItemprivate static final Stringprivate static final de.iip_ecosphere.platform.support.logging.Loggerstatic final StringThe name of this connector.private de.iip_ecosphere.platform.connectors.ConnectorParameterstatic final charDenotes the path separator for qualified model names.static final StringDenotes the path separator for qualified model names (as String).static final StringDenotes the top-level folder "Objects".static final StringDenotes the top-level folder "Types".static final StringDenotes the top-level folder "Views".Fields inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
DEFAULT_CHANNEL -
Constructor Summary
ConstructorsConstructorDescriptionOpcUaConnector(de.iip_ecosphere.platform.connectors.AdapterSelector<DataItem, Object, CO, CI> selector, de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem, Object, CO, CI>... adapter) Creates an instance and installs the protocol adapter(s).OpcUaConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem, Object, CO, CI>... adapter) Creates an instance and installs the protocol adapter(s). -
Method Summary
Modifier and TypeMethodDescriptionprivate org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilderconfigure(org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilder configBuilder) Does the basic configuration of the OPC UA client.protected voidconnectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params) private org.eclipse.milo.opcua.stack.core.types.builtin.DataValuecreateWriteDataValue(org.eclipse.milo.opcua.stack.core.types.builtin.Variant value) Creates a data value for write accesses.protected voidvoiddispose()protected Predicate<org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription> endpointFilter(de.iip_ecosphere.platform.connectors.ConnectorParameter params) Provides a filter for OPC UA endpoints in case that multiple are present.protected voidprivate StringgetEndpointUrl(de.iip_ecosphere.platform.connectors.ConnectorParameter params) Construct the endpoint URL.protected org.eclipse.milo.opcua.sdk.client.api.identity.IdentityProvidergetIdentityProvider(de.iip_ecosphere.platform.connectors.ConnectorParameter params) Returns the identity provider by translating the token information inparamsto Milo specific token information.private de.iip_ecosphere.platform.support.identities.IdentityTokengetIdToken(String endpointUrl) Returns the id token for an endpoint URL consideringConnectorParameter.ANY_ENDPOINT.getName()protected DataItemread()voidtrigger(de.iip_ecosphere.platform.connectors.events.ConnectorTriggerQuery query) protected voidMethods inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
checkCache, configureAdapter, configureModelAccess, connect, createTlsContext, disconnect, doPolling, enableNotifications, enablePolling, getCachingStrategy, getCachingStrategyCls, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getInitCachingStrategyCls, getInstanceIdentification, getProtocolInputType, getProtocolOutputType, getSelector, getStorageValue, initializeModelAccess, initSelector, installPollTask, isPolling, notificationsChanged, notifyDataTimeDifference, notifyReconfigured, received, received, request, request, setDataTimeDifference, setDataTimeDifferenceProvider, setInstanceIdentification, setReceptionCallback, setStorageValue, trigger, uninstallPollTask, useTls, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.connectors.Connector
createSharedSpace, disconnectSafe, enableSharedSpace, setReceptionCallbackSafe
-
Field Details
-
NAME
The name of this connector.- See Also:
-
TOP_OBJECTS
Denotes the top-level folder "Objects".- See Also:
-
TOP_TYPES
Denotes the top-level folder "Types".- See Also:
-
TOP_VIEWS
Denotes the top-level folder "Views".- See Also:
-
SEPARATOR_CHAR
public static final char SEPARATOR_CHARDenotes the path separator for qualified model names.- See Also:
-
SEPARATOR_STRING
Denotes the path separator for qualified model names (as String).- See Also:
-
LOGGER
private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER -
DUMMY
-
FIELD_BINARY_ENCODING_ID
- See Also:
-
client
private org.eclipse.milo.opcua.sdk.client.OpcUaClient client -
params
private de.iip_ecosphere.platform.connectors.ConnectorParameter params
-
-
Constructor Details
-
OpcUaConnector
@SafeVarargs public OpcUaConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem, Object, CO, CI>... adapter) Creates an instance and installs the protocol adapter(s).- Parameters:
adapter- the protocol adapter(s)- Throws:
IllegalArgumentException- ifadapteris null or empty or adapters are null
-
OpcUaConnector
@SafeVarargs public OpcUaConnector(de.iip_ecosphere.platform.connectors.AdapterSelector<DataItem, Object, CO, CI> selector, de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem, Object, CO, CI>... adapter) Creates an instance and installs the protocol adapter(s).- Parameters:
selector- the adapter selector (null leads to a default selector for the first adapter)adapter- the protocol adapter(s)- Throws:
IllegalArgumentException- ifadapteris null or empty or adapters are null
-
-
Method Details
-
createWriteDataValue
private org.eclipse.milo.opcua.stack.core.types.builtin.DataValue createWriteDataValue(org.eclipse.milo.opcua.stack.core.types.builtin.Variant value) Creates a data value for write accesses.- Parameters:
value- the actual value- Returns:
- the data value
-
getEndpointUrl
Construct the endpoint URL.- Parameters:
params- the connector parameters- Returns:
- the endpoint URL
-
connectImpl
protected void connectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params) throws IOException - Specified by:
connectImplin classde.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object, CO, CI> - Throws:
IOException
-
endpointFilter
protected Predicate<org.eclipse.milo.opcua.stack.core.types.structured.EndpointDescription> endpointFilter(de.iip_ecosphere.platform.connectors.ConnectorParameter params) Provides a filter for OPC UA endpoints in case that multiple are present.- Parameters:
params- the connector parameters- Returns:
- the endpoint filter
-
configure
private org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilder configure(org.eclipse.milo.opcua.sdk.client.api.config.OpcUaClientConfigBuilder configBuilder) Does the basic configuration of the OPC UA client.- Parameters:
configBuilder- the configuration builder- Returns:
configBuilder
-
getIdToken
Returns the id token for an endpoint URL consideringConnectorParameter.ANY_ENDPOINT.- Parameters:
endpointUrl- the endpoint URL- Returns:
- the identity token
-
getIdentityProvider
protected org.eclipse.milo.opcua.sdk.client.api.identity.IdentityProvider getIdentityProvider(de.iip_ecosphere.platform.connectors.ConnectorParameter params) Returns the identity provider by translating the token information inparamsto Milo specific token information.- Parameters:
params- the connector params- Returns:
- the identity provider
-
disconnectImpl
- Specified by:
disconnectImplin classde.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object, CO, CI> - Throws:
IOException
-
getName
-
dispose
public void dispose() -
writeImpl
- Specified by:
writeImplin classde.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object, CO, CI> - Throws:
IOException
-
read
- Specified by:
readin classde.iip_ecosphere.platform.connectors.AbstractConnector<DataItem,Object, CO, CI> - Throws:
IOException
-
trigger
public void trigger(de.iip_ecosphere.platform.connectors.events.ConnectorTriggerQuery query) -
error
-
supportedEncryption
-
enabledEncryption
-