Class ConnectionBuilder
-
- All Implemented Interfaces:
public final class ConnectionBuilderBuilder to create the different connection objects.
- Since:
2.0
-
-
Constructor Summary
Constructors Constructor Description ConnectionBuilder()
-
Method Summary
Modifier and Type Method Description final ConnectionBuilderwithAddress(String address)Sets the IP address or the domain name of the home power plant (Without port! final ConnectionBuilderwithPort(Integer port)Port on which the RSCP service in the home power plant listens. final ConnectionBuilderwithPortalUser(String portalUser)Username from the E3DC portal. final ConnectionBuilderwithPortalPassword(String portalPassword)Password from the E3DC Portal final ConnectionBuilderwithRSCPPassword(String rscpPassword)RSCP Password. final ConnectionBuilderwithCipherFactory(AESCipherFactory cipherFactory)If you want to use your own implementation for encryption, you can set a factory here. final ConnectionBuilderwithSocketTimeoutMillis(Long timeout)Timeout in milliseconds for establishing the connection. final ConnectionBuilderwithSocketFactory(SocketFactory socketFactory)If you want to use your own SocketFactory, you can set the instance here. final ConnectionBuilderwithFrameParser(FrameParser frameParser)If you want to use your own frame parser, you can set the instance here. final ConnectionBuilderwithConnectionPool(ConnectionPool connectionPool)If you want to use your own ConnectionPool, you can set it here. final ConnectionBuilderwithConnectionPoolTimeoutMillis(Long timeout)Timeout in milliseconds how long the SingleInstanceConnectionPool waits for a free connection before generating an error. final ConnectionBuilderaddRequestResponseListener(RSCPRequestResponseListener listener)Adds listeners that are called when passing through a request/response cycle final HomePowerPlantConnectionFactorybuildConnectionFactory()Creates a new HomePowerPlantConnectionFactory instance. final E3DCConnectionDatabuildConnectionData()Creates a new instance with the configured connection data final AESCipherFactorybuildCipherFactory()Returns either the instance of AESCipherFactory set by withCipherFactory or creates a new one of type BouncyCastleAESCipherFactory. final SocketFactorybuildSocketFactory()Either returns the instance of a SocketFactory previously set by withSocketFactory or creates a new one of type DefaultSocketFactory. final ConnectionPoolbuildConnectionPool()Returns either the instance of a ConnectionPool set by withConnectionPool or creates a new one of type SingleInstanceConnectionPool. -
-
Method Detail
-
withAddress
final ConnectionBuilder withAddress(String address)
Sets the IP address or the domain name of the home power plant (Without port!)
- Parameters:
address- IP address or domain name- Returns:
this reference
-
withPort
final ConnectionBuilder withPort(Integer port)
Port on which the RSCP service in the home power plant listens. The specification is optional. By default, 5033 is used. For farms it should be 5034.
- Parameters:
port- Port of the RSCP service in the home power plant- Returns:
this reference
- Since:
2.0
-
withPortalUser
final ConnectionBuilder withPortalUser(String portalUser)
Username from the E3DC portal.
- Parameters:
portalUser- E3DC Portal Username- Returns:
this reference
- Since:
2.0
-
withPortalPassword
final ConnectionBuilder withPortalPassword(String portalPassword)
Password from the E3DC Portal
- Parameters:
portalPassword- E3DC Portal password- Returns:
this reference
- Since:
2.0
-
withRSCPPassword
final ConnectionBuilder withRSCPPassword(String rscpPassword)
RSCP Password. This is used to encrypt the transmission. The same value must be selected as was stored at the home power plant.
- Parameters:
rscpPassword- RSCP Password for encryption- Returns:
this reference
- Since:
2.0
-
withCipherFactory
final ConnectionBuilder withCipherFactory(AESCipherFactory cipherFactory)
If you want to use your own implementation for encryption, you can set a factory here. The setting is optional. By default BouncyCastleAESCipherFactory is used.
- Parameters:
cipherFactory- Factory to use- Returns:
this reference
- Since:
2.0
-
withSocketTimeoutMillis
final ConnectionBuilder withSocketTimeoutMillis(Long timeout)
Timeout in milliseconds for establishing the connection. Optional specification. By default 10000ms is used.
- Parameters:
timeout- Timeout in milliseconds- Returns:
this reference
- Since:
2.0
-
withSocketFactory
final ConnectionBuilder withSocketFactory(SocketFactory socketFactory)
If you want to use your own SocketFactory, you can set the instance here. Optional specification. By default an instance of type DefaultSocketFactory is used.
- Parameters:
socketFactory- Factory to be used- Returns:
this reference
- Since:
2.0
-
withFrameParser
final ConnectionBuilder withFrameParser(FrameParser frameParser)
If you want to use your own frame parser, you can set the instance here. Optional specification. By default an instance of type DefaultFrameParser is used.
- Parameters:
frameParser- Parser to use- Returns:
this reference
- Since:
2.0
-
withConnectionPool
final ConnectionBuilder withConnectionPool(ConnectionPool connectionPool)
If you want to use your own ConnectionPool, you can set it here. Optional specification. By default an instance of the type SingleInstanceConnectionPool is used.
- Parameters:
connectionPool- ConnectionPool to use- Returns:
this reference
- Since:
2.0
-
withConnectionPoolTimeoutMillis
final ConnectionBuilder withConnectionPoolTimeoutMillis(Long timeout)
Timeout in milliseconds how long the SingleInstanceConnectionPool waits for a free connection before generating an error. Optional specification. The default is 10000ms.
The value only has relevance if NO own ConnectionPool is set with withConnectionPool.
- Parameters:
timeout- Timeout in milleseconds- Returns:
this reference
- Since:
2.0
-
addRequestResponseListener
final ConnectionBuilder addRequestResponseListener(RSCPRequestResponseListener listener)
Adds listeners that are called when passing through a request/response cycle
- Parameters:
listener- Listeners to be added- Returns:
this reference
- Since:
2.0
-
buildConnectionFactory
final HomePowerPlantConnectionFactory buildConnectionFactory()
Creates a new HomePowerPlantConnectionFactory instance.
- Returns:
Newly created implementation of the HomePowerPlantConnectionFactory interface.
- Since:
2.0
-
buildConnectionData
final E3DCConnectionData buildConnectionData()
Creates a new instance with the configured connection data
- Returns:
Newly created instance of the connection data E3DCConnectionData.
- Since:
2.0
-
buildCipherFactory
final AESCipherFactory buildCipherFactory()
Returns either the instance of AESCipherFactory set by withCipherFactory or creates a new one of type BouncyCastleAESCipherFactory.
- Returns:
An instance of the type BouncyCastleAESCipherFactory.
- Since:
2.0
-
buildSocketFactory
final SocketFactory buildSocketFactory()
Either returns the instance of a SocketFactory previously set by withSocketFactory or creates a new one of type DefaultSocketFactory.
- Returns:
An instance of the type SocketFactory.
- Since:
2.0
-
buildConnectionPool
final ConnectionPool buildConnectionPool()
Returns either the instance of a ConnectionPool set by withConnectionPool or creates a new one of type SingleInstanceConnectionPool.
- Returns:
An instance of the type ConnectionPool.
- Since:
2.0
-
-
-
-