Package com.aquima.web.config.connection
Class ConfigurableConnectionManager
- java.lang.Object
-
- com.aquima.web.config.connection.ConfigurableConnectionManager
-
- All Implemented Interfaces:
com.aquima.interactions.foundation.connectivity.IConnectionManager
,com.blueriq.component.api.connection.ISqlConnectionManager
,org.springframework.beans.factory.DisposableBean
@RefreshScope public class ConfigurableConnectionManager extends Object implements com.blueriq.component.api.connection.ISqlConnectionManager, org.springframework.beans.factory.DisposableBean
Connection manager implementation that returns default implementations of IConnections which can be configured with a properties file. See the javadoc of the methods on how to specify the properties.- Since:
- 8.3
- Author:
- Danny Roest
-
-
Constructor Summary
Constructors Constructor Description ConfigurableConnectionManager(org.springframework.core.env.Environment environment, SecurityConfigProperties securityProperties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
com.aquima.interactions.foundation.connectivity.IConnection
getConnection(String name)
This method creates a connection based on a given nameString[]
getConnectionNames()
String[]
getConnectionNames(com.aquima.interactions.foundation.connectivity.ConnectionType type)
com.aquima.interactions.foundation.connectivity.IHttpConnection
getHttpConnection(String name)
This method returns aIHttpConnection
based on the configured properties.com.aquima.interactions.foundation.connectivity.IMailConnection
getMailConnection(String name)
This method returns a mail connection on the configured properties.com.aquima.interactions.foundation.connectivity.IResourceConnection
getResourceConnection(String name)
This method returns aResourceConnection
based on the configured properties.com.aquima.interactions.foundation.connectivity.ISoapConnection
getSoapConnection(String name)
This method returns aISoapConnection
based on the configured properties.com.aquima.interactions.foundation.connectivity.ISqlConnection
getSqlConnection(String name)
This method returns a default implementation based on the configured properties.com.blueriq.component.api.connection.SqlConnectionData
getSqlConnectionData(String name)
This method should be used by plugins to retreive connection data.boolean
hasConnection(String name)
boolean
hasConnection(String name, com.aquima.interactions.foundation.connectivity.ConnectionType type)
void
setResourceManager(com.aquima.interactions.foundation.io.IResourceManager resourceManager)
This method sets the resource manager to use for default resources.
-
-
-
Constructor Detail
-
ConfigurableConnectionManager
public ConfigurableConnectionManager(org.springframework.core.env.Environment environment, SecurityConfigProperties securityProperties)
-
-
Method Detail
-
getConnectionNames
public String[] getConnectionNames(com.aquima.interactions.foundation.connectivity.ConnectionType type)
- Specified by:
getConnectionNames
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
-
getConnectionNames
public String[] getConnectionNames()
- Specified by:
getConnectionNames
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
-
getMailConnection
public com.aquima.interactions.foundation.connectivity.IMailConnection getMailConnection(String name) throws com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
This method returns a mail connection on the configured properties. Example of properties:connection.NAME.email.smtp=HOSTNAME_SMTP connection.NAME.email.username=USERNAME connection.NAME.email.password=PASSWORD
- Specified by:
getMailConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
- Throws:
com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
-
getResourceConnection
public com.aquima.interactions.foundation.connectivity.IResourceConnection getResourceConnection(String name) throws com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
This method returns aResourceConnection
based on the configured properties. Example of properties:connection.NAME.resource.path=PATH_TO_RESOURCE
- Specified by:
getResourceConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
- Throws:
com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
-
getSoapConnection
public com.aquima.interactions.foundation.connectivity.ISoapConnection getSoapConnection(String name) throws com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
This method returns aISoapConnection
based on the configured properties. Example of properties:connection.NAME.soap.url=URL connection.NAME.soap.username=USERNAME connection.NAME.soap.password=PASSWORD
- Specified by:
getSoapConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
- Throws:
com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
-
getHttpConnection
public com.aquima.interactions.foundation.connectivity.IHttpConnection getHttpConnection(String name) throws com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException, com.aquima.interactions.foundation.connectivity.exception.MisconfiguredConnectionException
This method returns aIHttpConnection
based on the configured properties. Example of properties:connection.NAME.http.url=URL connection.NAME.http.username=USERNAME connection.NAME.http.password=PASSWORD
- Specified by:
getHttpConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
- Throws:
com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
com.aquima.interactions.foundation.connectivity.exception.MisconfiguredConnectionException
-
getSqlConnection
public com.aquima.interactions.foundation.connectivity.ISqlConnection getSqlConnection(String name) throws com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
This method returns a default implementation based on the configured properties. The following property returns aJ2eeConnection
connection.NAME.sql.jndi=JDNI_NAME
J2eeConnection
connection.NAME.sql.url=JDBC_URL connection.NAME.sql.driver=DRIVER connection.NAME.sql.username=USERNAME connection.NAME.sql.password=PASSWORD
DirectConnection
connection.NAME.sql.database=DATABASENAME connection.NAME.sql.username=USERNAME connection.NAME.sql.password=PASSWORD
- Specified by:
getSqlConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
- Throws:
com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
-
getSqlConnectionData
public com.blueriq.component.api.connection.SqlConnectionData getSqlConnectionData(String name)
This method should be used by plugins to retreive connection data. Jndi and jdbc are supported. if the url contains %AQUIMA_HOME% this is replaced with the aquima home folder. This can be used for file based databases like H2.- Specified by:
getSqlConnectionData
in interfacecom.blueriq.component.api.connection.ISqlConnectionManager
- Parameters:
name
- the name of the connection- Returns:
- connection data for the connection with the specified name
-
setResourceManager
@Autowired(required=false) public void setResourceManager(com.aquima.interactions.foundation.io.IResourceManager resourceManager)
This method sets the resource manager to use for default resources.- Parameters:
resourceManager
- the resource manager to use for default resources.
-
hasConnection
public boolean hasConnection(String name)
- Specified by:
hasConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
-
hasConnection
public boolean hasConnection(String name, com.aquima.interactions.foundation.connectivity.ConnectionType type)
- Specified by:
hasConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
-
getConnection
public com.aquima.interactions.foundation.connectivity.IConnection getConnection(String name) throws com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
This method creates a connection based on a given name- Specified by:
getConnection
in interfacecom.aquima.interactions.foundation.connectivity.IConnectionManager
- Throws:
com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
-
-