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

    Modifier and Type
    Method
    Description
    void
     
    com.aquima.interactions.foundation.connectivity.IConnection
    This method creates a connection based on a given name
     
    getConnectionNames(com.aquima.interactions.foundation.connectivity.ConnectionType type)
     
    com.aquima.interactions.foundation.connectivity.IHttpConnection
    This method returns a IHttpConnection based on the configured properties.
    com.aquima.interactions.foundation.connectivity.IMailConnection
    This method returns a mail connection on the configured properties.
    com.aquima.interactions.foundation.connectivity.IResourceConnection
    This method returns a ResourceConnection based on the configured properties.
    com.aquima.interactions.foundation.connectivity.ISoapConnection
    This method returns a ISoapConnection based on the configured properties.
    com.aquima.interactions.foundation.connectivity.ISqlConnection
    This method returns a default implementation based on the configured properties.
    com.blueriq.component.api.connection.SqlConnectionData
    This method should be used by plugins to retreive connection data.
    boolean
     
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ConfigurableConnectionManager

      public ConfigurableConnectionManager(org.springframework.core.env.Environment environment, SecurityConfigProperties securityProperties)
  • Method Details

    • getConnectionNames

      public String[] getConnectionNames(com.aquima.interactions.foundation.connectivity.ConnectionType type)
      Specified by:
      getConnectionNames in interface com.aquima.interactions.foundation.connectivity.IConnectionManager
    • getConnectionNames

      public String[] getConnectionNames()
      Specified by:
      getConnectionNames in interface com.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 interface com.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 a ResourceConnection based on the configured properties. Example of properties:
       
       connection.NAME.resource.path = PATH_TO_RESOURCE
       
       
      Specified by:
      getResourceConnection in interface com.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 a ISoapConnection based on the configured properties. Example of properties:
       
       connection.NAME.soap.url=URL
       connection.NAME.soap.username=USERNAME
       connection.NAME.soap.password=PASSWORD
       
       
      The username and password property are optional.
      Specified by:
      getSoapConnection in interface com.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 a IHttpConnection based on the configured properties. Example of properties:
       
       connection.NAME.http.url=URL
       connection.NAME.http.username=USERNAME
       connection.NAME.http.password=PASSWORD
       
       
      The username, password, domain, timeout and authenticationtype property are optional.
      Specified by:
      getHttpConnection in interface com.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 a J2eeConnection
       
       connection.NAME.sql.jndi = JDNI_NAME
       
       
      The following properties returns a J2eeConnection
       
       connection.NAME.sql.url=JDBC_URL
       connection.NAME.sql.driver=DRIVER
       connection.NAME.sql.username=USERNAME
       connection.NAME.sql.password=PASSWORD
       
       
      The following properties returns a DirectConnection
       
       connection.NAME.sql.database=DATABASENAME
       connection.NAME.sql.username=USERNAME
       connection.NAME.sql.password=PASSWORD
       
       
      DATABASENAME is the odbc name that should be used to connect to.
      Specified by:
      getSqlConnection in interface com.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 interface com.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 interface com.aquima.interactions.foundation.connectivity.IConnectionManager
    • hasConnection

      public boolean hasConnection(String name, com.aquima.interactions.foundation.connectivity.ConnectionType type)
      Specified by:
      hasConnection in interface com.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 interface com.aquima.interactions.foundation.connectivity.IConnectionManager
      Throws:
      com.aquima.interactions.foundation.connectivity.exception.UnknownConnectionException
    • destroy

      public void destroy() throws Exception
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      Exception