Class ConnectionProfileSetup

java.lang.Object
com.iizix.prop.GProp<GProp<?>[]>
com.iizix.prop.PropCnr
com.iizix.db.prop.ConnectionProfileSetup
All Implemented Interfaces:
EventListener, IGProp<GProp<?>[]>, IPropCnr, Cloneable
Direct Known Subclasses:
EditorConnectionProfileSetup

public class ConnectionProfileSetup extends PropCnr
A single connection profile setup that is used to establish a JDBC connection.
Author:
Christopher Mindus
  • Field Details

    • PROP_VENDOR

      public static final String PROP_VENDOR
      Predefined property name: vendor (e.g. "Derby").
      See Also:
    • PROP_VERSION

      public static final String PROP_VERSION
      Predefined property name: version of driver (e.g. "10.2").
      See Also:
    • PROP_DRIVER_DEFINITION_ID

      public static final String PROP_DRIVER_DEFINITION_ID
      Predefined property name: driver definition ID in Eclipse DTP connection profiles (e.g. "DriverDefn.org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb.driverTemplate.BIRT SampleDb Derby Embedded Driver").
      See Also:
    • PROP_CLASSPATH

      public static final String PROP_CLASSPATH
      Predefined property name: classpath as list of Jar's (e.g. "C:\Eclipse\64\eclipsename\plugins\org.apache.derby.core_v.er.si.on_vDATEtime\derby.jar"), separated by comma's. Duplicate comma's mean a single one!
      See Also:
    • PROP_DRIVER_CLASS

      public static final String PROP_DRIVER_CLASS
      Predefined property name: JDBC driver class name, (e.g. "org.apache.derby.jdbc.EmbeddedDriver").
      See Also:
    • PROP_DATABASE_NAME

      public static final String PROP_DATABASE_NAME
      Predefined property name: database name (e.g. "BirtSample").
      See Also:
    • PROP_URL

      public static final String PROP_URL
      Predefined property name: URL to database (e.g. "jdbc:derby:C:\iizi\runtime\.metadata\.plugins\org.eclipse.birt.report.data.oda.jdbc.dbprofile.sampledb/db/BirtSample").
      See Also:
    • PROP_USERNAME

      public static final String PROP_USERNAME
      Predefined property name: user name.
      See Also:
    • PROP_PASSWORD

      public static final String PROP_PASSWORD
      Predefined property name: password (this property is not a StringProp but a PasswordProp!)
      See Also:
    • PROP_POOL_SIZE

      public static final String PROP_POOL_SIZE
      Predefined property name: pool size (this property is not a StringProp but a IntProp!)
      See Also:
    • PROP_POOL_TIMEOUT

      public static final String PROP_POOL_TIMEOUT
      Predefined property name: pool timeout (this property is not a StringProp but a IntProp!)
      See Also:
    • PROP_VALID_TIMEOUT

      public static final String PROP_VALID_TIMEOUT
      Predefined property name: connection valid timeout (this property is not a StringProp but a IntProp!)
      See Also:
    • DEFAULT_POOL_SIZE

      public static final int DEFAULT_POOL_SIZE
      The default pool size: 100.
      See Also:
    • DEFAULT_POOL_TIMEOUT

      public static final int DEFAULT_POOL_TIMEOUT
      The default pool timeout in milliseconds: 10,000 ms (10 seconds).
      See Also:
    • DEFAULT_VALID_TIMEOUT

      public static final int DEFAULT_VALID_TIMEOUT
      The default connection validity timeout in milliseconds: 1000 ms (1 seconds).
      See Also:
    • PROP_LIST

      public static final String[] PROP_LIST
      Names that are placed as StringProp's instead of placed into the Properties StringMapProp.
  • Constructor Details

    • ConnectionProfileSetup

      public ConnectionProfileSetup()
      Constructs the connection profile setup container without name.
    • ConnectionProfileSetup

      public ConnectionProfileSetup(Atom name)
      Constructs the connection profile setup container with specified name.
      Parameters:
      name - The name.
  • Method Details

    • clone

      public ConnectionProfileSetup clone()
      Clones the instance.
      Overrides:
      clone in class PropCnr
    • onPropDispose

      protected void onPropDispose()
      Disposes of the connection pool if allocated without closing current connections.
      Overrides:
      onPropDispose in class PropCnr
    • getName

      public String getName()
      Gets the name of the profile.
      Returns:
      The profile name, or "<undefined>" if not defined.
    • setName

      public boolean setName(String name)
      Sets the name of the profile.
      Parameters:
      name - The name of the profile.
      Returns:
      true when this property container has been changed, false otherwise (or for error).
    • setFromEclipseBase

      public void setFromEclipseBase(Properties props)
      Stores the information from Eclipse connection profile base Properties.
      Parameters:
      props - The Properties.
    • createDriverProperties

      public Properties createDriverProperties()
      Creates the Driver specific Properties.
      Returns:
      A new Properties instance with at least "user" and "password" set.
    • isJDBCDriverEqual

      public boolean isJDBCDriverEqual(ConnectionProfileSetup setup)
      Verification if two connection profiles are equal in terms of the JDBC Driver information. The Properties are checked for equality, excluding the connection profile name and other settings that are not used in the JDBC Driver construction.
      Parameters:
      setup - Another connection profile setup to check for "equality".
      Returns:
      true if it would result in the same JDBC Driver setup, false otherwise.
    • getConnectionPool

      public IDBConnectionPool getConnectionPool() throws ActionActorException
      Gets the connection pool to retrieve a new connection. This is called when the DB TXP node is created. Normally the pool should have been created, otherwise log a warning.
      Returns:
      The connection pool.
      Throws:
      ActionActorException - If there is a problem such as connection profiles disposed of or failure to initialize the pool.
    • getTransactionIsolationLevel

      public int getTransactionIsolationLevel()
      Gets the transaction isolation level.
      Returns:
      The level is one of the following Connection constants: Connection.TRANSACTION_READ_UNCOMMITTED, Connection.TRANSACTION_READ_COMMITTED (default if value is undefined), Connection.TRANSACTION_REPEATABLE_READ, or Connection.TRANSACTION_SERIALIZABLE.
    • getAutoCommit

      public boolean getAutoCommit()
      Gets the auto-commit mode.
      Returns:
      true for auto-commit mode (default), false for manual commit.
    • getConnection

      public Connection getConnection() throws SQLException
      Gets a new connection from the pool.
      Returns:
      The connection, initialized with the auto-commit mode of the connection profile and transaction isolation level (if JDBC driver supports it).
      Throws:
      SQLException - If the pool is closed or found a connection that was closed or invalid and needed to recreate a connection because the pool was exhausted.