Package com.iizix.db.prop
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
,java.lang.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 Summary
Fields Modifier and Type Field Description static int
DEFAULT_POOL_SIZE
The default pool size: 100.static int
DEFAULT_POOL_TIMEOUT
The default pool timeout in milliseconds: 10,000 ms (10 seconds).static int
DEFAULT_VALID_TIMEOUT
The default connection validity timeout in milliseconds: 1000 ms (1 seconds).static java.lang.String
PROP_CLASSPATH
Predefined property name: classpath as list of Jar's (e.g.static java.lang.String
PROP_DATABASE_NAME
Predefined property name: database name (e.g.static java.lang.String
PROP_DRIVER_CLASS
Predefined property name: JDBC driver class name, (e.g.static java.lang.String
PROP_DRIVER_DEFINITION_ID
Predefined property name: driver definition ID in Eclipse DTP connection profiles (e.g.static java.lang.String[]
PROP_LIST
Names that are placed as StringProp's instead of placed into the Properties StringMapProp.static java.lang.String
PROP_PASSWORD
Predefined property name: password (this property is not a StringProp but a PasswordProp!)static java.lang.String
PROP_POOL_SIZE
Predefined property name: pool size (this property is not a StringProp but a IntProp!)static java.lang.String
PROP_POOL_TIMEOUT
Predefined property name: pool timeout (this property is not a StringProp but a IntProp!)static java.lang.String
PROP_URL
Predefined property name: URL to database (e.g.static java.lang.String
PROP_USERNAME
Predefined property name: user name.static java.lang.String
PROP_VALID_TIMEOUT
Predefined property name: connection valid timeout (this property is not a StringProp but a IntProp!)static java.lang.String
PROP_VENDOR
Predefined property name: vendor (e.g.static java.lang.String
PROP_VERSION
Predefined property name: version of driver (e.g.Fields inherited from class com.iizix.prop.PropCnr
EMPTY, EMPTY_CLASSES, EMPTY_CNRS, EXTENDS_FRAMEWORK_ERROR_ID
Fields inherited from class com.iizix.prop.GProp
GPDEBUG, PROP_ATTR_STRING_EDITOR_PROP, PROP_ATTR_STRING_ERRORED_NAME, PROP_ATTR_STRING_EXTENDS, PROP_ATTR_STRING_EXTENDS_FINAL, PROP_ATTR_STRING_EXTENDS_PRIVATE, PROP_ATTR_STRING_NULLABLE, PROP_ATTR_STRING_PRIVATE, PROP_ATTR_STRING_PRIVATE_CHANGE_EVENT, PROP_ATTR_STRING_READ_ONLY, PROP_USER_1, PROP_USER_2
Fields inherited from interface com.iizix.prop.IGProp
EQC_ERROR_IGNORE_ALL, EQC_ERROR_IGNORE_REFERENCES, EQC_IGNORE_ARRAY, EQC_IGNORE_VOLATILE_OR_EDITOR, EQC_PRIVATE, EQC_SAVE_FILE, EXT_CONTAINER_EXTENDS, EXT_CONTAINER_EXTENDS_VALID, EXT_EXTENDED, EXT_FINAL, EXT_OVERRIDES, EXT_OVERRIDES_FINAL_ERR, EXT_PRIVATE
Constructor Summary
Constructors Constructor Description ConnectionProfileSetup()
Constructs the connection profile setup container without name.ConnectionProfileSetup(Atom name)
Constructs the connection profile setup container with specified name.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionProfileSetup
clone()
Clones the instance.java.util.Properties
createDriverProperties()
Creates the Driver specific Properties.boolean
getAutoCommit()
Gets the auto-commit mode.java.sql.Connection
getConnection()
Gets a new connection from the pool.IDBConnectionPool
getConnectionPool()
Gets the connection pool to retrieve a new connection.java.lang.String
getName()
Gets the name of the profile.int
getTransactionIsolationLevel()
Gets the transaction isolation level.boolean
isJDBCDriverEqual(ConnectionProfileSetup setup)
Verification if two connection profiles are equal in terms of the JDBC Driver information.protected void
onPropDispose()
Disposes of the connection pool if allocated without closing current connections.void
setFromEclipseBase(java.util.Properties props)
Stores the information from Eclipse connection profile base Properties.boolean
setName(java.lang.String name)
Sets the name of the profile.Methods inherited from class com.iizix.prop.PropCnr
__transferChildProps, addPredefinedProps, addProp, addProp, addProp2, addProp2, appendPropValue, canRequestFocus, completeVirtualize, containsProp, containsProp, convertLoadedProp, couldRequestFocusIfVirtualized, createCopyOfAtom, createUniqueAtom, createUniqueAtom, createUniqueAtom, createVSReference, doPropEqualsArrayValues, doVirtualizePropCnr, enablePropCommunication, enablePropHashMap, equalsTree, equalsTree, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getAllProps, getBool, getBool, getBool, getBool, getChildPropError, getChildPropError, getChildPropErrorSeverity, getChildPropErrorSeverity, getErrorsProp, getExtendsContainer, getExtendsError, getExtendsName, getExtendsOverride, getExtendsPossibleClasses, getFirstProp, getFirstProp, getFocusEngine, getInt, getInt, getInt, getInt, getLong, getLong, getLong, getLong, getNumber, getNumber, getNumber, getNumber, getPossibleChildren, getPredefinedProps, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getProp, getPropBaseReference, getPropCnr, getPropCount, getPropCount, getPropIndex, getPropIndex, getPropIndexes, getProps, getProps, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue, getPropValue0, getReferences, getRetargetedVerifyContainer, getString, getString, getString, getString, getValueClasses, getVSReference, hasFocus, hasSendData, initializeElement, initializeExtendsFramework, initializeProp, initializeValue, initPropCnr, insertProp, insertProp2, isChild, isExtendsOverriden, isExtendsPropertyValid, isExtendsRoot, isPropAddRemoveAllowed, isPropCommunicating, isPropExtended, isSibling, list, list, logPropNotFound, maybeAddProp, onInsertProp, onPropRemoved, onPropTreeInitialized, onReferenceEvent, paramString, prepare, removeAllProps, removeAllProps2, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, removeProp2, reorderProps, replaceProps, requestFocus, requestFocus, requestFocusEx, requestFocusEx, resolveReferences, resolveRuntimeReferences, setBool, setBool, setBool, setBool, setCreateRequiredProp, setExtendsName, setExtendsOverride, setInt, setInt, setInt, setLong, setLong, setLong, setLong, setNumber, setNumber, setNumber, setNumber, setProp, setProp, setProp, setProp2, setProp2, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setPropValue, setString, setString, setString, setString, shouldCreateProps, shouldSerializeToXML, toElementString, toNativeValue0, usePropHashMap, usesPropIndex, validateChildPropInValue, validateClassInstances, validatePropType, validatePropValue, verify, verifyInternalUseOnly, verifyTree, virtualize
Methods inherited from class com.iizix.prop.GProp
addPropError, addPropListener, convertPropError, dispose, equals, equals, equalsErrors, equalsObj, equalsPropValue, equalValues, extendsClone, finalize, fine, fine, finer, finer, finest, finest, fromElementString, getAliasName, getAppSessionGyro, getAppWorker, getAtomPath, getAttribute, getChildReferencePropName, getClientSessionGyro, getClientWorker, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropName, getFullPropNameDebug, getFullPropNameDebug, getListeners, getModuleFolder, getModuleFolder, getParent, getParent, getProjectName, getPropAtom, getPropError, getPropError, getPropErroredName, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromPath, getPropFromReference, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropReferenceTarget, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getPropValueObject, getReferencePropName, getRelativePropName, getRootFromName, getRootName, getRootParent, getRootParent, getTreeLock, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropForEditor, isPropNullable, isPropPrivate, isPropPrivateAtCreation, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropUSER, isPropValueTreeLockNeeded, isPropVirtualized, isPropVirtualizing, isPropVolatile, isPropVolatileOrEditorOnly, isProxied, list, list, list, mapAliasToReference, mapAliasToReference, mapReferenceToAlias, mapReferenceToAlias, mapReferenceToProjectRelative, modifyPropValue, moveProp, moveProp, moveProp, onEvent, onEventSelf, onPrepare, onPropInvalidateCache, onPropParentChanged, onPropValueSet, onRemoteEvent, onVirtualizationCompleted, onVirtualized, paramValue, post, post, removePropError, removePropListener, removePropUSER, renameProp, renameProp2, resetChangedTree, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPrivateCreateRequiredProp, setPropError, setPropErroredName, setPropExtended, setPropExtendsFinal, setPropExtendsPrivate, setPropForEditor, setPropNullable, setPropPrivate, setPropReadOnly, setPropUSER, setPropValue, setPropValue, setPropValue, setPropValueIncognito, setPropVolatile, severe, severe, severe, shouldSerializeToXML, throwIfReadOnly, toNativeValue, toString, toString, triggerRemoteEvent, triggerRemoteEvent, validateProp, verifyHasPropertyItem, warning, warning, warning
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.iizix.prop.IGProp
addPropError, addPropListener, dispose, equals, fine, fine, finer, finer, finest, finest, fromElementString, getAppSessionGyro, getAtomPath, getClientSessionGyro, getConstraints, getEnvironment, getErroredPropItems, getErroredProps, getErrorsProp, getExtendsRootContainer, getFullPropName, getFullPropNameDebug, getModuleFolder, getModuleFolder, getParent, getParent, getPropAtom, getPropError, getPropError, getPropErrorSeverity, getPropExtendsFlags, getPropFromPath, getPropFromReference, getPropIndex, getPropName, getPropPath, getPropPath, getPropRootPropMgr, getPropTreeErrorSeverity, getPropValue, getPropValue, getReferencePropName, getRelativePropName, getRootParent, getTreeLock, hasChanged, hasPrivateChangeEventProp, hasPropError, hasPropTreeError, info, info, initializeGElement, initializeGProp, isDisposed, isPropChildOf, isPropClientCreated, isPropCreateRequired, isPropExtended, isPropExtendsFinal, isPropExtendsPrivate, isPropExtendsPrivateInRoot, isPropExtendsPrivateInRoot, isPropFile, isPropFolder, isPropNullable, isPropPrivate, isPropReadOnly, isPropReferenceTreeValid, isPropRoot, isPropVirtualized, list, list, list, mapAliasToReference, mapReferenceToAlias, mapReferenceToProjectRelative, moveProp, moveProp, moveProp, onEvent, onEventSelf, onRemoteEvent, removePropError, removePropListener, renameProp, setChanged, setConstraints, setConstraints, setParent, setPrivateChangeEventProp, setPropError, setPropExtendsFinal, setPropExtendsPrivate, setPropNullable, setPropPrivate, setPropReadOnly, setPropValue, setPropValue, severe, severe, severe, toNativeValue, triggerRemoteEvent, triggerRemoteEvent, validateProp, verifyHasPropertyItem, warning, warning, warning
Methods inherited from interface com.iizix.prop.IPropCnr
canRequestFocus, canRequestFocus, couldRequestFocusIfVirtualized, couldRequestFocusIfVirtualized
Field Detail
PROP_VENDOR
public static final java.lang.String PROP_VENDOR
Predefined property name: vendor (e.g. "Derby").- See Also:
- Constant Field Values
PROP_VERSION
public static final java.lang.String PROP_VERSION
Predefined property name: version of driver (e.g. "10.2").- See Also:
- Constant Field Values
PROP_DRIVER_DEFINITION_ID
public static final java.lang.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:
- Constant Field Values
PROP_CLASSPATH
public static final java.lang.String PROP_CLASSPATH
Predefined property name: classpath as list of Jar's (e.g. "C:\Eclipse\64\j2ee-luna\plugins\org.apache.derby.core_10.5.1.1_v201405191524\derby.jar"), separated by comma's. Duplicate comma's mean a single one!- See Also:
- Constant Field Values
PROP_DRIVER_CLASS
public static final java.lang.String PROP_DRIVER_CLASS
Predefined property name: JDBC driver class name, (e.g. "org.apache.derby.jdbc.EmbeddedDriver").- See Also:
- Constant Field Values
PROP_DATABASE_NAME
public static final java.lang.String PROP_DATABASE_NAME
Predefined property name: database name (e.g. "BirtSample").- See Also:
- Constant Field Values
PROP_URL
public static final java.lang.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:
- Constant Field Values
PROP_USERNAME
public static final java.lang.String PROP_USERNAME
Predefined property name: user name.- See Also:
- Constant Field Values
PROP_PASSWORD
public static final java.lang.String PROP_PASSWORD
Predefined property name: password (this property is not a StringProp but a PasswordProp!)- See Also:
- Constant Field Values
PROP_POOL_SIZE
public static final java.lang.String PROP_POOL_SIZE
Predefined property name: pool size (this property is not a StringProp but a IntProp!)- See Also:
- Constant Field Values
PROP_POOL_TIMEOUT
public static final java.lang.String PROP_POOL_TIMEOUT
Predefined property name: pool timeout (this property is not a StringProp but a IntProp!)- See Also:
- Constant Field Values
PROP_VALID_TIMEOUT
public static final java.lang.String PROP_VALID_TIMEOUT
Predefined property name: connection valid timeout (this property is not a StringProp but a IntProp!)- See Also:
- Constant Field Values
DEFAULT_POOL_SIZE
public static final int DEFAULT_POOL_SIZE
The default pool size: 100.- See Also:
- Constant Field Values
DEFAULT_POOL_TIMEOUT
public static final int DEFAULT_POOL_TIMEOUT
The default pool timeout in milliseconds: 10,000 ms (10 seconds).- See Also:
- Constant Field Values
DEFAULT_VALID_TIMEOUT
public static final int DEFAULT_VALID_TIMEOUT
The default connection validity timeout in milliseconds: 1000 ms (1 seconds).- See Also:
- Constant Field Values
PROP_LIST
public static final java.lang.String[] PROP_LIST
Names that are placed as StringProp's instead of placed into the Properties StringMapProp.
Constructor Detail
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 Detail
clone
public ConnectionProfileSetup clone()
Clones the instance.
onPropDispose
protected void onPropDispose()
Disposes of the connection pool if allocated without closing current connections.- Overrides:
onPropDispose
in classPropCnr
getName
public java.lang.String getName()
Gets the name of the profile.- Returns:
- The profile name, or "<undefined>" if not defined.
setName
public boolean setName(java.lang.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(java.util.Properties props)
Stores the information from Eclipse connection profile base Properties.- Parameters:
props
- The Properties.
createDriverProperties
public java.util.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
, orConnection.TRANSACTION_SERIALIZABLE
.
getAutoCommit
public boolean getAutoCommit()
Gets the auto-commit mode.- Returns:
- true for auto-commit mode (default), false for manual commit.
getConnection
public java.sql.Connection getConnection() throws java.sql.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:
java.sql.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.