Enterprise Information Portal APIs

com.ibm.mm.beans
Class CMBConnectionPool

java.lang.Object
  |
  +--com.ibm.mm.beans.CMBConnectionPool
All Implemented Interfaces:
CMBBaseConstant, java.io.Serializable

public class CMBConnectionPool
extends java.lang.Object
implements CMBBaseConstant, java.io.Serializable

Manages a pool of CMBConnection objects. Since connections are expensive, a server may choose to obtain connections using this connection pooling bean. Properties on this bean provide for:

Since:
7.1 starting from version 8.1, a new underlying mechanism is used to support connection pooling.
old APIs are still supported for backward compatibility.
an example:
CMBConnectionPool connectionPool = new CMBConnectionPool();
connectionPool.setDsType(dstype);
connectionPool.setServerName(server);
connectionPool.setMaxFreeConnections(10);
connectionPool.setMinFreeConnections(3);
connectionPool.setTimeOut(1);
CMBConnection connection = connectionPool.getConnection(userid, password);
..do some work....
connectionPool.freeConnection(connection);

user can switch to different types of datastores by doing the following:
connectionPool.connectionPool.setDsType(newdstype);
CMBConnection newconnection = connectionPool.getConnection(userid, password);

See Also:
CMBConnection, Serialized Form

Fields inherited from interface com.ibm.mm.beans.CMBBaseConstant
ANNOTATION_MIME_TYPE, CMB_CLASS_ICM_DOC_MODEL, CMB_CLASS_ICM_DOC_PART, CMB_CLASS_ITEM, CMB_CLASS_RESOURCE_ITEM, CMB_CLASS_UNDEFINED, CMB_CONNTYPE_DYNAMIC, CMB_CONNTYPE_LOCAL, CMB_CONNTYPE_REMOTE, CMB_CONTENT_ATTRONLY, CMB_CONTENT_CHILDREN, CMB_CONTENT_ITEMTREE, CMB_CONTENT_LINKS_INBOUND, CMB_CONTENT_LINKS_OUTBOUND, CMB_CONTENT_YES, CMB_DATATYPE_COLLECTION, CMB_DATATYPE_COLLECTION_DDO, CMB_DATATYPE_COLLECTION_XDO, CMB_DATATYPE_DATAOBJECTBASE, CMB_DATATYPE_DATE, CMB_DATATYPE_DECIMAL, CMB_DATATYPE_DOUBLE, CMB_DATATYPE_FLOAT, CMB_DATATYPE_FSTRING, CMB_DATATYPE_ITEM, CMB_DATATYPE_ITEM_COLLECTION, CMB_DATATYPE_LONG, CMB_DATATYPE_OBJECT, CMB_DATATYPE_OBJECT_COLLECTION, CMB_DATATYPE_SHORT, CMB_DATATYPE_TIME, CMB_DATATYPE_TIMESTAMP, CMB_DATATYPE_UNDEFINED, CMB_DATATYPE_VSTRING, CMB_DSTYPE_CM, CMB_DSTYPE_DB2, CMB_DSTYPE_DES, CMB_DSTYPE_DJ, CMB_DSTYPE_DL, CMB_DSTYPE_DOMDOC, CMB_DSTYPE_FED, CMB_DSTYPE_FN, CMB_DSTYPE_IC, CMB_DSTYPE_ICM, CMB_DSTYPE_IP390, CMB_DSTYPE_JDBC, CMB_DSTYPE_OD, CMB_DSTYPE_VI400, CMB_EIP_LOGOUT, CMB_OBJTYPE_CMBITEM, CMB_OBJTYPE_CMBOBJECT, CMB_OP_AND, CMB_OP_BETWEEN, CMB_OP_CONTAINS_TEXT, CMB_OP_CONTAINS_TEXT_IN_CONTENT, CMB_OP_EQUAL, CMB_OP_GREATER, CMB_OP_GREATER_EQUAL, CMB_OP_IN, CMB_OP_LESS, CMB_OP_LESS_EQUAL, CMB_OP_LIKE, CMB_OP_NOT, CMB_OP_NOT_BETWEEN, CMB_OP_NOT_EQUAL, CMB_OP_NOT_IN, CMB_OP_NOT_LIKE, CMB_OP_OR, CMB_OP_UNDEFINED, CMB_QS_TYPE_COMBINED, CMB_QS_TYPE_DES, CMB_QS_TYPE_FEDERATED, CMB_QS_TYPE_IMAGE, CMB_QS_TYPE_PARAMETRIC, CMB_QS_TYPE_SQL, CMB_QS_TYPE_TEMPLATE, CMB_QS_TYPE_TEXT, CMB_QS_TYPE_UNKNOWN, CMB_QS_TYPE_XPATH, CMB_ST_SKIP_ALWAYS, CMB_ST_SKIP_NEVER, CMB_ST_SKIP_WITH_PROMPT, CMB_STATUS_FAILED, CMB_STATUS_OK, CMB_STATUS_RESULT_END, CMB_STATUS_RESULT_MORE, CMB_STATUS_RESULT_NEW, CMB_TIMESTAMP_UNDEFINED, CMB_TYPE_DOCUMENT, CMB_TYPE_FOLDER, CMB_TYPE_ITEM, CMB_TYPE_UNKNOWN, CMB_USERID_UNDEFINED, CMB_VERSION_CONTROL_ALWAYS_NEW, CMB_VERSION_CONTROL_BY_APP, CMB_VERSION_CONTROL_NEVER, CMB_VERSION_KEYWORD, CMB_VERSION_LATEST, CMB_VERSION_NEW, PROP_CACHE_ENABLED, PROP_CC2MIME_URL, PROP_CONNECTION, PROP_CONNECTION_TYPE, PROP_DATA_MANAGEMENT_ENABLED, PROP_DSTYPE, PROP_LOCAL_SERVER, PROP_NAME, PROP_NEW_PASSWORD, PROP_PASSWORD, PROP_PORT_NUMBER, PROP_QUERY_CALLBACK_THRESHOLD, PROP_QUERY_MAX_RESULTS, PROP_RESULT_PAGESIZE, PROP_RMI_HOSTNAME, PROP_SCHEMA_MANAGEMENT_ENABLED, PROP_SEARCH_ASYNCH, PROP_SEARCH_MULTI_CHARS_WILDCARD, PROP_SEARCH_PARAMETRIC_WILDCARD, PROP_SEARCH_SINGLE_CHAR_WILDCARD, PROP_SEARCH_SKIP_SERVER, PROP_SEARCH_TIMEOUT, PROP_SERVER_NAME, PROP_SV_CONNECTION_TYPE, PROP_SV_PORT_NUMBER, PROP_SV_RMI_HOSTNAME, PROP_TRACE_ENABLED, PROP_USERID
 
Constructor Summary
CMBConnectionPool()
          Constructs the connection pool bean.
 
Method Summary
 void clearConnections()
          Clears this object instance including all the setted data and the connections in the free pool.
 void destroy()
          Destroys the connection pool.
 void freeConnection(CMBConnection connection)
          Frees a connection previously obtained using getConnection()
 java.lang.String getCC2MimeURL()
          Returns the value of the CC2MimeURL property.
 java.lang.String getClientURLString()
          Returns the value of the ClientURLString property.
 CMBConnection getConnection(java.lang.String userid, java.lang.String password)
          Returns a connected instance of CMBConnection.
 CMBConnection getConnection(java.lang.String userid, java.lang.String password, int sessionid)
          Returns a connected instance of CMBConnection.
 CMBConnection getConnection(java.lang.String serverName, java.lang.String userid, java.lang.String password)
          Returns a connected instance of CMBConnection.
 short getConnectionType()
          Returns the value of the ConnectionType property.
 java.lang.String getConnectString()
          Returns the value of the connectString property.
 boolean getConnectToWorkFlow()
          Returns the value of the connectToWorkFlow property.
 java.lang.String getCsURLString()
          Returns the value of the CSURLString property.
 boolean getDataManagementEnabled()
          Deprecated. This property no longer exists on the CMBConnection bean.
 java.lang.String getDsType()
          Returns the value of the DsType property.
 int getMaxFreeConnections()
          Returns the maximum number of free connections.
 int getMaxFreeConnectionsPerUserid()
          Get the maximum number of connections pooled per userid.
 int getPortNumber()
          Returns the value of the PortNumber property.
 java.lang.String getRMIHostname()
          Returns the value of the RMIHostname property.
 boolean getSchemaManagementEnabled()
          Deprecated. This property no longer exists on the CMBConnection bean.
 java.lang.String getServerName()
          Returns the value of the ServerName property.
 java.lang.String getServiceClientURLString()
          Returns the value of the ServiceClientURLString property.
 short getServiceConnectionType()
          Returns the value of the ServiceConnectionType property.
 java.lang.String getServiceCsURLString()
          Returns the value of the ServiceCSURLString property.
 int getServicePortNumber()
          Returns the value of the ServicePortNumber property.
 java.lang.String getServiceRMIHostname()
          Returns the value of the ServiceRMIHostname property.
 long getTimeOut()
          Returns the time duration after which a free connection will be disconnected and destroyed.
 boolean getTraceEnabled()
          Deprecated. use isTraceEnabled
 boolean getWorkflowDataManagementEnabled()
          Deprecated. use isWorkflowDataManagementEnabled
 boolean isTraceEnabled()
          Returns the value of the TraceEnabled property.
 boolean isWorkflowDataManagementEnabled()
          Returns the value of the WorkflowDataManagementEnabled property.
 void setCC2MimeURL(java.lang.String CC2MimeURL)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setClientURLString(java.lang.String clientURLString)
          Specifies the client URL string.
 void setConfigurationString(java.lang.String config)
          set the configuration string
 void setConnectionType(short connectionType)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setConnectString(java.lang.String connectString)
          Specifies the connect string.
 void setConnectToWorkFlow(boolean newvalue)
          Sets the connectToWorkFlow property value.
 void setCsURLString(java.lang.String csURLString)
          Specifies the cs URL string.
 void setDataManagementEnabled(boolean dataManagementEnabled)
          Deprecated. This property no longer exists on the CMBConnection bean.
 void setDsType(java.lang.String dsType)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setMaxFreeConnections(int maxFreeConnections)
          Sets the maximum number of free connections.
 void setMaxFreeConnectionsPerUserid(int maxFreeConnectionsPerUserid)
          Sets the maximum number of connections pooled per userid.
 void setMinFreeConnections(int minFreeConnections)
           
 void setPortNumber(int portNumber)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setRMIHostname(java.lang.String RMIHostname)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setSchemaManagementEnabled(boolean schemaManagementEnabled)
          Deprecated. This property no longer exists on the CMBConnection bean.
 void setServerName(java.lang.String serverName)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setServiceClientURLString(java.lang.String serviceClientURLString)
          Specifies the service client URL string.
 void setServiceConnectionType(short serviceConnectionType)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setServiceCsURLString(java.lang.String serviceCsURLString)
          Specifies the service cs URL string.
 void setServicePortNumber(int servicePortNumber)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setServiceRMIHostname(java.lang.String serviceRMIHostname)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setTimeOut(long timeOut)
          Sets the time duration after which a freed connection will be disconnected and destroyed.
 void setTraceEnabled(boolean traceEnabled)
          Sets the like named CMBConnection property on any new connections created to this value.
 void setWorkflowDataManagementEnabled(boolean workflowDataManagementEnabled)
          Sets the like named CMBConnection property on any new connections created to this value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CMBConnectionPool

public CMBConnectionPool()
Constructs the connection pool bean. Typically only one connection pool will exist for the server.
Method Detail

destroy

public void destroy()
             throws CMBException
Destroys the connection pool. All connections maintained in the pool will be disconnected and destroyed.
Since:
8.1

setConfigurationString

public void setConfigurationString(java.lang.String config)
                            throws CMBException
set the configuration string

clearConnections

public void clearConnections()
                      throws CMBException
Clears this object instance including all the setted data and the connections in the free pool. If any conneciton is in use it will throw an exception

setConnectToWorkFlow

public void setConnectToWorkFlow(boolean newvalue)
Sets the connectToWorkFlow property value. If the property is set to false then the method CMBConnection.connect will not attempt to connect to the workflow server.
Parameters:
newvalue - if false the connect method will not attempt a connection to the workflow server. The default value is true.

getConnectToWorkFlow

public boolean getConnectToWorkFlow()
Returns the value of the connectToWorkFlow property. If the return value is false then the CMBConnection.connect method will not attempt to connect to the workflow server. The value can be set by the method CMBConnection.setConnectToWorkFlow.
See Also:
CMBConnection.setConnectToWorkFlow(boolean), CMBConnection.connect()

getMaxFreeConnections

public int getMaxFreeConnections()
Returns the maximum number of free connections.

setMaxFreeConnections

public void setMaxFreeConnections(int maxFreeConnections)
Sets the maximum number of free connections.
Parameters:
maxFreeConnections - the maximum number of free connections that will be pooled. If this value is zero, then there is no maximum.

getMaxFreeConnectionsPerUserid

public int getMaxFreeConnectionsPerUserid()
Get the maximum number of connections pooled per userid.

setMinFreeConnections

public void setMinFreeConnections(int minFreeConnections)

setMaxFreeConnectionsPerUserid

public void setMaxFreeConnectionsPerUserid(int maxFreeConnectionsPerUserid)
Sets the maximum number of connections pooled per userid.
Parameters:
maxFreeConnectionsPerUserid - the maximum number of connections that will be pooled for a single userid. If this value is zero, then there is no maximum.

getTimeOut

public long getTimeOut()
Returns the time duration after which a free connection will be disconnected and destroyed.

setTimeOut

public void setTimeOut(long timeOut)
Sets the time duration after which a freed connection will be disconnected and destroyed.
Parameters:
timeOut - the time duration in milliseconds. If this value is zero, then there is no time limit -- connections will be pooled indefinitely.

getCC2MimeURL

public java.lang.String getCC2MimeURL()
Returns the value of the CC2MimeURL property.
See Also:
CMBConnection

setCC2MimeURL

public void setCC2MimeURL(java.lang.String CC2MimeURL)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getConnectionType

public short getConnectionType()
Returns the value of the ConnectionType property.
See Also:
CMBConnection

setConnectionType

public void setConnectionType(short connectionType)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getServiceConnectionType

public short getServiceConnectionType()
Returns the value of the ServiceConnectionType property.
See Also:
CMBConnection

setServiceConnectionType

public void setServiceConnectionType(short serviceConnectionType)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getDsType

public java.lang.String getDsType()
Returns the value of the DsType property.
See Also:
CMBConnection

setDsType

public void setDsType(java.lang.String dsType)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getPortNumber

public int getPortNumber()
Returns the value of the PortNumber property.
See Also:
CMBConnection

setPortNumber

public void setPortNumber(int portNumber)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getRMIHostname

public java.lang.String getRMIHostname()
Returns the value of the RMIHostname property.
See Also:
CMBConnection

setRMIHostname

public void setRMIHostname(java.lang.String RMIHostname)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getServicePortNumber

public int getServicePortNumber()
Returns the value of the ServicePortNumber property.
See Also:
CMBConnection

setServicePortNumber

public void setServicePortNumber(int servicePortNumber)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getServiceRMIHostname

public java.lang.String getServiceRMIHostname()
Returns the value of the ServiceRMIHostname property.
See Also:
CMBConnection

setServiceRMIHostname

public void setServiceRMIHostname(java.lang.String serviceRMIHostname)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getServerName

public java.lang.String getServerName()
Returns the value of the ServerName property.
See Also:
CMBConnection

setServerName

public void setServerName(java.lang.String serverName)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getTraceEnabled

public boolean getTraceEnabled()
Deprecated. use isTraceEnabled

Returns the value of the TraceEnabled property.
See Also:
CMBConnection

isTraceEnabled

public boolean isTraceEnabled()
Returns the value of the TraceEnabled property.
See Also:
CMBConnection

setTraceEnabled

public void setTraceEnabled(boolean traceEnabled)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getDataManagementEnabled

public boolean getDataManagementEnabled()
Deprecated. This property no longer exists on the CMBConnection bean.

Returns the value of the DataManagementEnabled property.
See Also:
CMBConnection

setDataManagementEnabled

public void setDataManagementEnabled(boolean dataManagementEnabled)
Deprecated. This property no longer exists on the CMBConnection bean.

Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getWorkflowDataManagementEnabled

public boolean getWorkflowDataManagementEnabled()
Deprecated. use isWorkflowDataManagementEnabled

Returns the value of the WorkflowDataManagementEnabled property.
See Also:
CMBConnection

isWorkflowDataManagementEnabled

public boolean isWorkflowDataManagementEnabled()
Returns the value of the WorkflowDataManagementEnabled property.
See Also:
CMBConnection

setWorkflowDataManagementEnabled

public void setWorkflowDataManagementEnabled(boolean workflowDataManagementEnabled)
Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getSchemaManagementEnabled

public boolean getSchemaManagementEnabled()
Deprecated. This property no longer exists on the CMBConnection bean.

Returns the value of the SchemaManagementEnabled property.
See Also:
CMBConnection

setSchemaManagementEnabled

public void setSchemaManagementEnabled(boolean schemaManagementEnabled)
Deprecated. This property no longer exists on the CMBConnection bean.

Sets the like named CMBConnection property on any new connections created to this value.
See Also:
CMBConnection

getClientURLString

public java.lang.String getClientURLString()
Returns the value of the ClientURLString property.
See Also:
CMBConnection

setClientURLString

public void setClientURLString(java.lang.String clientURLString)
Specifies the client URL string. This is an argument on CMBConnection.setConnectionType.
See Also:
CMBConnection

getServiceClientURLString

public java.lang.String getServiceClientURLString()
Returns the value of the ServiceClientURLString property.
See Also:
CMBConnection

setServiceClientURLString

public void setServiceClientURLString(java.lang.String serviceClientURLString)
Specifies the service client URL string. This is an argument on CMBConnection.setServiceConnectionType.
See Also:
CMBConnection

getCsURLString

public java.lang.String getCsURLString()
Returns the value of the CSURLString property.
See Also:
CMBConnection

setCsURLString

public void setCsURLString(java.lang.String csURLString)
Specifies the cs URL string. This is an argument on CMBConnection.setConnectionType.
See Also:
CMBConnection

getServiceCsURLString

public java.lang.String getServiceCsURLString()
Returns the value of the ServiceCSURLString property.
See Also:
CMBConnection

setServiceCsURLString

public void setServiceCsURLString(java.lang.String serviceCsURLString)
Specifies the service cs URL string. This is an argument on CMBConnection.setServiceConnectionType.
See Also:
CMBConnection

getConnectString

public java.lang.String getConnectString()
Returns the value of the connectString property. Returns null if the connect string is not set.
See Also:
CMBConnection

setConnectString

public void setConnectString(java.lang.String connectString)
Specifies the connect string. This is an argument on CMBConnection.setConnectString.
See Also:
CMBConnection

getConnection

public CMBConnection getConnection(java.lang.String userid,
                                   java.lang.String password)
                            throws java.lang.Exception,
                                   CMBException,
                                   java.beans.PropertyVetoException,
                                   java.lang.ClassNotFoundException,
                                   java.lang.IllegalAccessException,
                                   java.lang.InstantiationException,
                                   java.net.MalformedURLException,
                                   java.lang.NoClassDefFoundError
Returns a connected instance of CMBConnection. This is either created during this call or obtained from the pool of free connections.

Note: If the connection obtained from the pool is a federated connection (dsType == "Fed") the userid and password will be verified. Otherwise, the userid and password must match the userid and password specified when the pooled connection was originally created.

Parameters:
userid - the userid of the connection.
password - the password of the connection.

getConnection

public CMBConnection getConnection(java.lang.String userid,
                                   java.lang.String password,
                                   int sessionid)
                            throws java.lang.Exception,
                                   CMBException,
                                   java.beans.PropertyVetoException,
                                   java.lang.ClassNotFoundException,
                                   java.lang.IllegalAccessException,
                                   java.lang.InstantiationException,
                                   java.net.MalformedURLException,
                                   java.lang.NoClassDefFoundError
Returns a connected instance of CMBConnection. This is either created during this call or obtained from the pool of free connections. if you connected before and have the session id, you can use it to retrieve the same connection, otherwise use sessionid = 0 to create a new connection. the session id of the new connection can be retrieved by calling getSessionId() on CMBConnection.

Parameters:
userid - the userid of the connection.
password - the password of the connection.
sessionid - the session id of a connection

getConnection

public CMBConnection getConnection(java.lang.String serverName,
                                   java.lang.String userid,
                                   java.lang.String password)
                            throws java.lang.Exception,
                                   CMBException,
                                   java.beans.PropertyVetoException,
                                   java.lang.ClassNotFoundException,
                                   java.lang.IllegalAccessException,
                                   java.lang.InstantiationException,
                                   java.net.MalformedURLException,
                                   java.lang.NoClassDefFoundError
Returns a connected instance of CMBConnection. This is either created during this call or obtained from the pool of free connections.

Note: If a connection is obtained from the pool of free connections, the userid and password when the connection was originally created must match the userid and password on this method.

Parameters:
serverName - the server to use for the connection.
userid - the userid of the connection.
password - the password of the connection.

freeConnection

public void freeConnection(CMBConnection connection)
Frees a connection previously obtained using getConnection()
Parameters:
connection - the connection being freed. This must be a connection obtained with getConnection().

EIP JavaBeans

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.