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.model.AbstractModelAccess.NotificationChangedListener
@MachineConnector 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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpcUaConnector.DescriptorThe descriptor of this connector (see META-INF/services).protected classOpcUaConnector.OpcUaModelAccessImplements the model access for OPC UA. -
Field Summary
Fields Modifier and Type Field Description private org.eclipse.milo.opcua.sdk.client.OpcUaClientclientprivate static DataItemDUMMYprivate static StringFIELD_BINARY_ENCODING_IDprivate static org.slf4j.LoggerLOGGERstatic StringNAMEprivate de.iip_ecosphere.platform.connectors.ConnectorParameterparams -
Constructor Summary
Constructors Constructor Description OpcUaConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,Object,CO,CI> adapter)Creates an instance and installs the protocol adapter. -
Method Summary
Modifier and Type Method Description private 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)protected voiddisconnectImpl()voiddispose()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 voiderror(String message, Throwable th)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.StringgetName()protected DataItemread()protected voidwriteImpl(Object data)Methods inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
connect, disconnect, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getProtocolInputType, getProtocolOutputType, initializeModelAccess, installPollTask, isPolling, notificationsChanged, received, setReceptionCallback, uninstallPollTask, write
-
Field Details
-
NAME
- See Also:
- Constant Field Values
-
LOGGER
private static final org.slf4j.Logger LOGGER -
DUMMY
-
FIELD_BINARY_ENCODING_ID
- See Also:
- Constant Field Values
-
client
private org.eclipse.milo.opcua.sdk.client.OpcUaClient client -
params
private de.iip_ecosphere.platform.connectors.ConnectorParameter params
-
-
Constructor Details
-
OpcUaConnector
public OpcUaConnector(de.iip_ecosphere.platform.connectors.types.ProtocolAdapter<DataItem,Object,CO,CI> adapter)Creates an instance and installs the protocol adapter.- Parameters:
adapter- the protocol adapter
-
-
Method Details
-
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
-
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
-
error
-