Class ConnectorParameter.ConnectorParameterBuilder
java.lang.Object
de.iip_ecosphere.platform.connectors.ConnectorParameter.ConnectorParameterBuilder
- Enclosing class:
ConnectorParameter
Builds a connector parameter object.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates the instance.newBuilder(ConnectorParameter params) Creates a new connector parameter builder based on the givenparams.newBuilder(ConnectorParameter params, String host, Integer port, de.iip_ecosphere.platform.support.Schema schema) Creates a new connector parameter builder based on the givenparams.newBuilder(de.iip_ecosphere.platform.support.ServerAddress addr) Creates a new connector parameter builder with required basic information.newBuilder(String host, int port) Creates a new connector parameter builder with required basic information.newBuilder(String host, int port, de.iip_ecosphere.platform.support.Schema schema) Creates a new connector parameter builder with required basic information.setApplicationInformation(String applicationId, String applicationDescription) Sets connector-dependent application information.setAutoApplicationId(boolean autoApplicationId) Defines whether the application identification is expected to be unique or shall be made unique upon first connect.setCacheMode(ConnectorParameter.CacheMode cacheMode) Defines the cache mode.setEndpointPath(String endpointPath) Sets a connector-dependent endpoint path, a URL path.setHostnameVerification(boolean hostnameVerification) Defines whether TLS hostname verification shall be performed.setIdentities(Map<String, de.iip_ecosphere.platform.support.identities.IdentityToken> identityToken) Sets the endpoint identities.setKeepAlive(int keepAlive) Sets the keep alive time for connection heartbeats/reconnects (if supported).setKeyAlias(String alias) Sets up optional TLS key alias.setKeystoreKey(String keystoreKey) Sets up the optional TLS keystore key to be obtained fromIdentityStore.setNotificationInterval(int notificationInterval) Defines the notification interval, i.e., how frequently the connector shall look for new values.setRequestTimeout(int requestTimeout) Sets the request timeout.setService(de.iip_ecosphere.platform.support.iip_aas.NameplateSetup.Service service) Sets the optional service information to select upon.setSpecificSetting(String key, Object value) Adds connector specific settings.setSpecificSettingFromResource(String key, String resource, de.iip_ecosphere.platform.support.resources.ResourceResolver... resolver) Adds connector specific settings by reading the setting value from a given resource.setSpecificSettingFromResourceSafe(String key, String resource, de.iip_ecosphere.platform.support.resources.ResourceResolver... resolver) Adds connector specific settings by reading the setting value as the contents of a given resource.
-
Field Details
-
instance
-
-
Constructor Details
-
ConnectorParameterBuilder
private ConnectorParameterBuilder()Prevents external creation.
-
-
Method Details
-
newBuilder
Creates a new connector parameter builder with required basic information. Schema is set toConnectorParameter.DEFAULT_SCHEMA.- Parameters:
host- the host to connect toport- the port to connect to- Returns:
- the connector parameter builder
-
newBuilder
public static ConnectorParameter.ConnectorParameterBuilder newBuilder(String host, int port, de.iip_ecosphere.platform.support.Schema schema) Creates a new connector parameter builder with required basic information.- Parameters:
host- the host to connect toport- the port to connect toschema- protocol schema, usually (ConnectorParameter.DEFAULT_SCHEMAif value is null)- Returns:
- the connector parameter builder
-
newBuilder
public static ConnectorParameter.ConnectorParameterBuilder newBuilder(ConnectorParameter params, String host, Integer port, de.iip_ecosphere.platform.support.Schema schema) Creates a new connector parameter builder based on the givenparams.- Parameters:
params- the connector params to take information fromhost- the host name to override the value inparams, may be null for the value fromparams.port- the port number to override the value inparams, may be null for the value fromparams.schema- the schema to override the value inparams, may be null for the value fromparams.- Returns:
- the connector parameter builder
-
newBuilder
Creates a new connector parameter builder based on the givenparams.- Parameters:
params- the connector params to take information from- Returns:
- the connector parameter builder
-
newBuilder
public static ConnectorParameter.ConnectorParameterBuilder newBuilder(de.iip_ecosphere.platform.support.ServerAddress addr) Creates a new connector parameter builder with required basic information.- Parameters:
addr- the server address- Returns:
- the connector parameter builder
-
setService
public ConnectorParameter.ConnectorParameterBuilder setService(de.iip_ecosphere.platform.support.iip_aas.NameplateSetup.Service service) Sets the optional service information to select upon.- Parameters:
service- the device service information the connector shall connect to- Returns:
- this
-
setEndpointPath
Sets a connector-dependent endpoint path, a URL path. Optional, remains an empty string if not called.- Parameters:
endpointPath- the endpoint path- Returns:
- this
-
setRequestTimeout
Sets the request timeout.- Parameters:
requestTimeout- the request timeout. Optional, if not called uses the default value of 5000 ms.- Returns:
- this
-
setKeepAlive
Sets the keep alive time for connection heartbeats/reconnects (if supported).- Parameters:
keepAlive- the keep alive time. Optional, if not called uses the default value of 2000 ms.- Returns:
- this
-
setNotificationInterval
public ConnectorParameter.ConnectorParameterBuilder setNotificationInterval(int notificationInterval) Defines the notification interval, i.e., how frequently the connector shall look for new values. This may happen via events, notifications or polling depending on the connector implementation.- Parameters:
notificationInterval- the notification interval in ms, disabled if less than 1, default is 1000- Returns:
- the polling period
-
setApplicationInformation
public ConnectorParameter.ConnectorParameterBuilder setApplicationInformation(String applicationId, String applicationDescription) Sets connector-dependent application information. Optional, if not called both settings will remain empty strings.- Parameters:
applicationId- String/URL to identify the application.applicationDescription- application description.- Returns:
- this
-
setAutoApplicationId
Defines whether the application identification is expected to be unique or shall be made unique upon first connect. May be ignored if not applicable.- Parameters:
autoApplicationId-true(default) for make unique,falseelse- Returns:
- this
-
setIdentities
public ConnectorParameter.ConnectorParameterBuilder setIdentities(Map<String, de.iip_ecosphere.platform.support.identities.IdentityToken> identityToken) Sets the endpoint identities. Optional, if not called, anonymous identity is assumed.- Parameters:
identityToken- the client identity token per endpoint URL (may be null for anonymous), anConnectorParameter.ANY_ENDPOINTdenotes just all endpoints- Returns:
- this
-
setKeystoreKey
Sets up the optional TLS keystore key to be obtained fromIdentityStore.- Parameters:
keystoreKey- the (logical) key to access the keystore (null for none)- Returns:
- this
-
setKeyAlias
Sets up optional TLS key alias.- Parameters:
alias- key alias, may be null for none/first match- Returns:
- this
-
setHostnameVerification
public ConnectorParameter.ConnectorParameterBuilder setHostnameVerification(boolean hostnameVerification) Defines whether TLS hostname verification shall be performed.- Parameters:
hostnameVerification-falsefor no verification,trueelse- Returns:
- this
-
setCacheMode
public ConnectorParameter.ConnectorParameterBuilder setCacheMode(ConnectorParameter.CacheMode cacheMode) Defines the cache mode.- Parameters:
cacheMode- the cache mode- Returns:
- this
-
setSpecificSetting
Adds connector specific settings.- Parameters:
key- the key of the setting as defined by the connectorvalue- the value of the setting- Returns:
- this (builder style)
-
setSpecificSettingFromResource
public ConnectorParameter.ConnectorParameterBuilder setSpecificSettingFromResource(String key, String resource, de.iip_ecosphere.platform.support.resources.ResourceResolver... resolver) throws IOException Adds connector specific settings by reading the setting value from a given resource.- Parameters:
key- the key of the setting as defined by the connectorresource- the resource to read fromresolver- optional resource resolver- Returns:
- this (builder style)
- Throws:
IOException
-
setSpecificSettingFromResourceSafe
public ConnectorParameter.ConnectorParameterBuilder setSpecificSettingFromResourceSafe(String key, String resource, de.iip_ecosphere.platform.support.resources.ResourceResolver... resolver) Adds connector specific settings by reading the setting value as the contents of a given resource. Emits an error in case of an exception.- Parameters:
key- the key of the setting as defined by the connectorresource- the resource to read fromresolver- optional resource resolver- Returns:
- this (builder style)
- See Also:
-
build
Creates the instance.- Returns:
- the created instance
-