Enterprise Information Portal APIs

com.ibm.mm.sdk.server
Class DKDatastoreJDBC

java.lang.Object
  |
  +--com.ibm.mm.sdk.server.dkAbstractDatastore
        |
        +--com.ibm.mm.sdk.server.DKDatastoreJDBC
All Implemented Interfaces:
DKConstant, DKConstantJDBC, dkDatastore, dkDatastoreIntJDBC, DKMessageId, DKMessageIdJDBC, dkQueryEvaluator, dkQueryManager

public class DKDatastoreJDBC
extends dkAbstractDatastore
implements dkDatastoreIntJDBC, DKConstantJDBC, DKMessageIdJDBC

The DKDatastoreJDBC class is the JDBC implementation of the abstract class dkDatastore. The datastore provides facilities to query, retrieve, update, store, and manage rows stored in a database table.

IBM Confidential

See Also:
dkDatastore

Fields inherited from interface com.ibm.mm.sdk.common.DKConstantJDBC
DK_JDBC_AUTOCOMMIT_OFF, DK_JDBC_AUTOCOMMIT_ON, DK_JDBC_DATABASE_DEFAULT, DK_JDBC_DEFAULT_MIMETYPE, DK_JDBC_DSTYPE, DK_JDBC_HSTMT, DK_JDBC_OPT_AUTOCOMMIT_MODE, DK_JDBC_OPT_TXN_ISOLATION, DK_JDBC_PROPERTY_TABLE_NAME, DK_JDBC_PROPERTY_TABLE_SCHEMA, DK_JDBC_READ_COMMITTED, DK_JDBC_READ_UNCOMMITTED, DK_JDBC_REPEATABLE_READ, DK_JDBC_SERIALIZABLE, DK_JDBC_TABLE, DK_JDBC_VIEW
 
Fields inherited from interface com.ibm.mm.sdk.common.DKConstant
    For details, see the class or interface
 
Fields inherited from interface com.ibm.mm.sdk.common.DKMessageIdJDBC
DK_JDBC_MSG_MSGID_ADD_FAILED, DK_JDBC_MSG_MSGID_DELETE_FAILED, DK_JDBC_MSG_MSGID_NOT_FOUND, DK_JDBC_MSG_MSGID_RETRIEVE_FAILED, DK_JDBC_MSG_MSGID_SQL_ERROR, DK_JDBC_MSG_MSGID_UPDATE_FAILED
 
Fields inherited from interface com.ibm.mm.sdk.common.DKMessageId
    For details, see the class or interface
 
Constructor Summary
DKDatastoreJDBC()
          Constructs the datastore and initializes the datastore.
DKDatastoreJDBC(java.lang.String configuration)
           
 
Method Summary
 void addExtension(java.lang.String extensionName, dkExtension extensionObj)
          Adds a new extension object.
 void addObject(dkDataObject ddo)
          Adds this ddo to this datastore.
 void commit()
          Commits a datastore transaction
 void connect(java.lang.String datastore_name, java.lang.String user_name, java.lang.String authentication, java.lang.String connect_string)
          Connects to a datastore.
 DKHandle connection()
          Gets the connection handle for a datastore
 DKDDO createDDO(java.lang.String objectType, int Flags)
          Creates a new DDO with object type, properties and attributes set for a given backend server.
 java.lang.String createPidIdString(DKNVPair[] list)
          Builds the Pid Id string based on the specified column, value pairs
 dkQuery createQuery(DKCQExpr qe)
          Creates a query object.
 dkQuery createQuery(java.lang.String command, short commandLangType, DKNVPair[] params)
          Creates a query object.
 dkDatastoreDef datastoreDef()
          Get datastore definition
 java.lang.String datastoreName()
          Gets the name of this datastore object.
 java.lang.String datastoreType()
          Gets the datastore type for this datastore object
 void deleteObject(dkDataObject ddo)
          Deletes this ddo from this datastore.
 void destroy()
          datastore destroy - datastore cleanup if needed
 void disconnect()
          Disconnects to a datastore.
 java.lang.Object evaluate(DKCQExpr qe)
          evaluates the query.
 java.lang.Object evaluate(dkQuery query)
          evaluates the query.
 java.lang.Object evaluate(java.lang.String command, short commandLangType, DKNVPair[] params)
          evaluates the query.
 dkResultSetCursor execute(DKCQExpr cqe)
          executes the query.
 dkResultSetCursor execute(dkQuery query)
          executes the query.
 dkResultSetCursor execute(java.lang.String command, short commandLangType, DKNVPair[] params)
          executes the query.
 void executeWithCallback(DKCQExpr qe, dkCallback callbackObj)
          execute the query with callback function.
 void executeWithCallback(dkQuery query, dkCallback callbackObj)
          execute the query with callback function.
 void executeWithCallback(java.lang.String command, short commandLangType, DKNVPair[] params, dkCallback callbackObj)
          execute the query with callback function.
 int getCallbkCnt()
           
 dkExtension getExtension(java.lang.String extensionName)
          Gets the extension object from a given extenstion name.
 dkSchemaMapping getMapping(java.lang.String mappingName)
          Get mapping information for this datastore
 java.lang.Object getOption(int option)
          Gets a datastore option.
 int getRSCCnt()
           
 DKHandle handle(java.lang.String type)
          Gets a datastore handle
 boolean isConnected()
          Checks to see if the datastore is connected.
 java.lang.String[] listDataSourceNames()
          List the available datastore source names that can be used to connect with.
 dkCollection listDataSources()
          List the available datastore sources that can be used to connect with.
 dkCollection listEntities()
          Gets a list of entities from persistent datastore
 java.lang.String[] listEntityAttrNames(java.lang.String entityName)
          Gets a list of attribute names for a given entity name.
 dkCollection listEntityAttrs(java.lang.String entityName)
          Gets a list of attributes for a given entity name.
 java.lang.String[] listEntityNames()
          Gets a list of entity names from persistent datastore
 java.lang.String[] listExtensionNames()
          Gets the list of extension objects' names
 java.lang.String[] listMappingNames()
          Gets the list of the register mappings for this datastore
 java.lang.Object listSchema()
          Deprecated. Replace by listEntities
 java.lang.Object listSchemaAttributes(java.lang.String schemaEntry)
          Deprecated. Replace by listEntityAttributes
 java.lang.Object listServers()
          Deprecated. Replace by listDataSources
 DKNVPair[] parsePidIdString(java.lang.String Id)
          Parses the Pid Id string into column, value pairs
 java.lang.String registerMapping(DKNVPair sourceMap)
          Registers mapping information to this datastore
 void removeExtension(java.lang.String extensionName)
          Remove an existing extension object
 void retrieveObject(dkDataObject ddo)
          Retrieves this ddo from this datastore.
 void rollback()
          Rollback a datastore transaction
 void setOption(int option, java.lang.Object value)
          Sets a datastore option.
 void unRegisterMapping(java.lang.String mappingName)
          Unregisters mapping information for this datastore
 void updateObject(dkDataObject ddo)
          Updates this ddo in this datastore.
 java.lang.String userName()
          Gets the user name for this datastore object
 
Methods inherited from class com.ibm.mm.sdk.server.dkAbstractDatastore
addObject, addObject, addObjects, addObjects, addObjects, changePassword, clearCache, clearCache, deleteObject, deleteObject, deleteObjects, deleteObjects, deleteObjects, evaluate, execute, executeWithCallback, listAvailableServices, listSearchableEntities, listSearchableEntityNames, listSearchTemplateNames, listSearchTemplates, retrieveObject, retrieveObject, retrieveObjects, retrieveObjects, retrieveObjects, serviceMgr, startTransaction, updateObject, updateObject, updateObjects, updateObjects, updateObjects
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.mm.sdk.common.dkDatastore
addObject, addObject, addObjects, addObjects, addObjects, changePassword, clearCache, clearCache, deleteObject, deleteObject, deleteObjects, deleteObjects, deleteObjects, evaluate, execute, executeWithCallback, listAvailableServices, listSearchableEntities, listSearchableEntityNames, listSearchTemplateNames, listSearchTemplates, retrieveObject, retrieveObject, retrieveObjects, retrieveObjects, retrieveObjects, serviceMgr, startTransaction, updateObject, updateObject, updateObjects, updateObjects, updateObjects
 

Constructor Detail

DKDatastoreJDBC

public DKDatastoreJDBC()
                throws DKException,
                       java.lang.Exception
Constructs the datastore and initializes the datastore.

DKDatastoreJDBC

public DKDatastoreJDBC(java.lang.String configuration)
                throws DKException,
                       java.lang.Exception
Method Detail

connect

public void connect(java.lang.String datastore_name,
                    java.lang.String user_name,
                    java.lang.String authentication,
                    java.lang.String connect_string)
             throws DKException,
                    java.lang.Exception
Connects to a datastore.
Specified by:
connect in interface dkDatastore
Overrides:
connect in class dkAbstractDatastore
Parameters:
datastore_name - the datastore name used for connection
user_name - the user name used for connection
authentication - the authentication used for connection
connect_string - the connect string used for connection. This is used to provide additional connection options.

disconnect

public void disconnect()
                throws DKException,
                       java.lang.Exception
Disconnects to a datastore.
Specified by:
disconnect in interface dkDatastore
Overrides:
disconnect in class dkAbstractDatastore

getOption

public java.lang.Object getOption(int option)
                           throws DKException,
                                  java.lang.Exception
Gets a datastore option.
Specified by:
getOption in interface dkDatastore
Overrides:
getOption in class dkAbstractDatastore
Parameters:
option - the option identifier
Returns:
an option value

setOption

public void setOption(int option,
                      java.lang.Object value)
               throws DKException,
                      java.lang.Exception
Sets a datastore option.
Specified by:
setOption in interface dkDatastore
Overrides:
setOption in class dkAbstractDatastore
Parameters:
option - the option identifier
value - the option value

evaluate

public java.lang.Object evaluate(java.lang.String command,
                                 short commandLangType,
                                 DKNVPair[] params)
                          throws DKException,
                                 java.lang.Exception
evaluates the query.
Specified by:
evaluate in interface dkDatastore
Overrides:
evaluate in class dkAbstractDatastore
Parameters:
command - a query string
commandLang - a query type
params - additional query option in name/value pair
Returns:
a collection of the results

evaluate

public java.lang.Object evaluate(dkQuery query)
                          throws DKException,
                                 java.lang.Exception
evaluates the query.
Specified by:
evaluate in interface dkDatastore
Overrides:
evaluate in class dkAbstractDatastore
Parameters:
query - a query object
Returns:
a collection of the results

evaluate

public java.lang.Object evaluate(DKCQExpr qe)
                          throws DKException,
                                 java.lang.Exception
evaluates the query.
Specified by:
evaluate in interface dkDatastore
Overrides:
evaluate in class dkAbstractDatastore
Parameters:
qe - a common query expression object
Returns:
a collection of the results

execute

public dkResultSetCursor execute(java.lang.String command,
                                 short commandLangType,
                                 DKNVPair[] params)
                          throws DKException,
                                 java.lang.Exception
executes the query.
Specified by:
execute in interface dkDatastore
Overrides:
execute in class dkAbstractDatastore
Parameters:
command - a query string
commandLang - a query type
params - additional query option in name/value pair
Returns:
resultSetCursor which represents a datastore cursor.

execute

public dkResultSetCursor execute(dkQuery query)
                          throws DKException,
                                 java.lang.Exception
executes the query.
Specified by:
execute in interface dkDatastore
Overrides:
execute in class dkAbstractDatastore
Parameters:
query - a query object
Returns:
resultSetCursor which represents a datastore cursor.

execute

public dkResultSetCursor execute(DKCQExpr cqe)
                          throws DKException,
                                 java.lang.Exception
executes the query.
Specified by:
execute in interface dkDatastore
Overrides:
execute in class dkAbstractDatastore
Parameters:
cqe - a common query expression object
Returns:
resultSetCursor which represents a datastore cursor.

executeWithCallback

public void executeWithCallback(dkQuery query,
                                dkCallback callbackObj)
                         throws DKException,
                                java.lang.Exception
execute the query with callback function.
Specified by:
executeWithCallback in interface dkDatastore
Overrides:
executeWithCallback in class dkAbstractDatastore
Parameters:
query - a query object
callbackObj - a dkCallback object

executeWithCallback

public void executeWithCallback(java.lang.String command,
                                short commandLangType,
                                DKNVPair[] params,
                                dkCallback callbackObj)
                         throws DKException,
                                java.lang.Exception
execute the query with callback function.
Specified by:
executeWithCallback in interface dkDatastore
Overrides:
executeWithCallback in class dkAbstractDatastore
Parameters:
command - a query string
commandLang - a query type
params - additional query option in name/value pair
callbackObj - a dkCallback object

executeWithCallback

public void executeWithCallback(DKCQExpr qe,
                                dkCallback callbackObj)
                         throws DKException,
                                java.lang.Exception
execute the query with callback function.
Specified by:
executeWithCallback in interface dkDatastore
Overrides:
executeWithCallback in class dkAbstractDatastore
Parameters:
qe - a common query expression object
callbackObj - a dkCallback object

createQuery

public dkQuery createQuery(java.lang.String command,
                           short commandLangType,
                           DKNVPair[] params)
                    throws DKException,
                           java.lang.Exception
Creates a query object.
Specified by:
createQuery in interface dkDatastore
Overrides:
createQuery in class dkAbstractDatastore
Parameters:
command - a query string
commandLang - a query type
params - additional query option in name/value pair
Returns:
a query object

createQuery

public dkQuery createQuery(DKCQExpr qe)
                    throws DKException,
                           java.lang.Exception
Creates a query object.
Specified by:
createQuery in interface dkDatastore
Overrides:
createQuery in class dkAbstractDatastore
Parameters:
qe - a common query expression object

addObject

public void addObject(dkDataObject ddo)
               throws DKException,
                      java.lang.Exception
Adds this ddo to this datastore.
Specified by:
addObject in interface dkDatastore
Overrides:
addObject in class dkAbstractDatastore
Parameters:
ddo - the ddo to be added to this datastore

retrieveObject

public void retrieveObject(dkDataObject ddo)
                    throws DKException,
                           java.lang.Exception
Retrieves this ddo from this datastore.
Specified by:
retrieveObject in interface dkDatastore
Overrides:
retrieveObject in class dkAbstractDatastore
Parameters:
ddo - the ddo to be retrieved from this datastore

updateObject

public void updateObject(dkDataObject ddo)
                  throws DKException,
                         java.lang.Exception
Updates this ddo in this datastore.
Specified by:
updateObject in interface dkDatastore
Overrides:
updateObject in class dkAbstractDatastore
Parameters:
ddo - the ddo to be updated in this datastore

deleteObject

public void deleteObject(dkDataObject ddo)
                  throws DKException,
                         java.lang.Exception
Deletes this ddo from this datastore.
Specified by:
deleteObject in interface dkDatastore
Overrides:
deleteObject in class dkAbstractDatastore
Parameters:
ddo - the ddo to be deleted from this datastore

commit

public void commit()
            throws DKException,
                   java.lang.Exception
Commits a datastore transaction
Specified by:
commit in interface dkDatastore
Overrides:
commit in class dkAbstractDatastore

rollback

public void rollback()
              throws DKException,
                     java.lang.Exception
Rollback a datastore transaction
Specified by:
rollback in interface dkDatastore
Overrides:
rollback in class dkAbstractDatastore

isConnected

public boolean isConnected()
                    throws java.lang.Exception
Checks to see if the datastore is connected.
Specified by:
isConnected in interface dkDatastore
Overrides:
isConnected in class dkAbstractDatastore
Returns:
true if connected

datastoreName

public java.lang.String datastoreName()
                               throws java.lang.Exception
Gets the name of this datastore object. Usually it represents a datastore source's server name.
Specified by:
datastoreName in interface dkDatastore
Overrides:
datastoreName in class dkAbstractDatastore
Returns:
datastore name

datastoreType

public java.lang.String datastoreType()
                               throws java.lang.Exception
Gets the datastore type for this datastore object
Specified by:
datastoreType in interface dkDatastore
Overrides:
datastoreType in class dkAbstractDatastore
Returns:
datastore type

connection

public DKHandle connection()
                    throws java.lang.Exception
Gets the connection handle for a datastore
Specified by:
connection in interface dkDatastore
Overrides:
connection in class dkAbstractDatastore
Returns:
connection handle

handle

public DKHandle handle(java.lang.String type)
                throws java.lang.Exception
Gets a datastore handle
Specified by:
handle in interface dkDatastore
Overrides:
handle in class dkAbstractDatastore
Parameters:
type - type of datastore handle wanted
Returns:
a datastore handle

userName

public java.lang.String userName()
                          throws java.lang.Exception
Gets the user name for this datastore object
Specified by:
userName in interface dkDatastore
Overrides:
userName in class dkAbstractDatastore
Returns:
user name

listDataSources

public dkCollection listDataSources()
                             throws DKException,
                                    java.lang.Exception
List the available datastore sources that can be used to connect with.
Specified by:
listDataSources in interface dkDatastore
Overrides:
listDataSources in class dkAbstractDatastore
Returns:
a collection of server defs

listDataSourceNames

public java.lang.String[] listDataSourceNames()
                                       throws DKException,
                                              java.lang.Exception
List the available datastore source names that can be used to connect with.
Specified by:
listDataSourceNames in interface dkDatastore
Overrides:
listDataSourceNames in class dkAbstractDatastore
Returns:
an array of server names

listServers

public java.lang.Object listServers()
                             throws DKException,
                                    java.lang.Exception
Deprecated. Replace by listDataSources

List the available datastore sources that can be used to connect with.
Specified by:
listServers in interface dkDatastore
Overrides:
listServers in class dkAbstractDatastore
Returns:
a collection of server definitions
See Also:
listDataSources()

listSchema

public java.lang.Object listSchema()
                            throws DKException,
                                   java.lang.Exception
Deprecated. Replace by listEntities

List the entities that belong to this datastore
Specified by:
listSchema in interface dkDatastore
Overrides:
listSchema in class dkAbstractDatastore
Returns:
an object that contains the schema
See Also:
listEntities()

listSchemaAttributes

public java.lang.Object listSchemaAttributes(java.lang.String schemaEntry)
                                      throws DKException,
                                             java.lang.Exception
Deprecated. Replace by listEntityAttributes

List the attributes that belong to a schema.
Specified by:
listSchemaAttributes in interface dkDatastore
Overrides:
listSchemaAttributes in class dkAbstractDatastore
Parameters:
schemaEntry - the name of the schema.
Returns:
an object that contains the attributes that belong to this schema
See Also:
listEntityAttrs(java.lang.String)

listEntities

public dkCollection listEntities()
                          throws DKException,
                                 java.lang.Exception
Gets a list of entities from persistent datastore
Specified by:
listEntities in interface dkDatastore
Overrides:
listEntities in class dkAbstractDatastore
Returns:
a collection of entity defs
Throws:
DKException - if error occurs

listEntityNames

public java.lang.String[] listEntityNames()
                                   throws DKException,
                                          java.lang.Exception
Gets a list of entity names from persistent datastore
Specified by:
listEntityNames in interface dkDatastore
Overrides:
listEntityNames in class dkAbstractDatastore
Returns:
an array of entity names
Throws:
DKException - if error occurs

listEntityAttrs

public dkCollection listEntityAttrs(java.lang.String entityName)
                             throws DKException,
                                    java.lang.Exception
Gets a list of attributes for a given entity name.
Specified by:
listEntityAttrs in interface dkDatastore
Overrides:
listEntityAttrs in class dkAbstractDatastore
Parameters:
entityName - name of entity to retrieve attributes for
Returns:
a dkCollection of dkAttrDef objects
Throws:
DKException - if the entity name does not exist

listEntityAttrNames

public java.lang.String[] listEntityAttrNames(java.lang.String entityName)
                                       throws DKException,
                                              java.lang.Exception
Gets a list of attribute names for a given entity name.
Specified by:
listEntityAttrNames in interface dkDatastore
Overrides:
listEntityAttrNames in class dkAbstractDatastore
Parameters:
entityName - name of entity to retrieve attribute names for
Returns:
an array of attribute names
Throws:
DKException - if the entity name does not exist

datastoreDef

public dkDatastoreDef datastoreDef()
                            throws DKException,
                                   java.lang.Exception
Get datastore definition
Specified by:
datastoreDef in interface dkDatastore
Overrides:
datastoreDef in class dkAbstractDatastore
Returns:
the meta-data (dkDatastoreDef) of this datastore

registerMapping

public java.lang.String registerMapping(DKNVPair sourceMap)
                                 throws DKException,
                                        java.lang.Exception
Registers mapping information to this datastore
Specified by:
registerMapping in interface dkDatastore
Overrides:
registerMapping in class dkAbstractDatastore
Parameters:
sourceMap - source name and mapping
Returns:
the mapping name for the mapping information

unRegisterMapping

public void unRegisterMapping(java.lang.String mappingName)
                       throws DKException,
                              java.lang.Exception
Unregisters mapping information for this datastore
Specified by:
unRegisterMapping in interface dkDatastore
Overrides:
unRegisterMapping in class dkAbstractDatastore
Parameters:
mappingName - name of the mapping information

listMappingNames

public java.lang.String[] listMappingNames()
                                    throws DKException,
                                           java.lang.Exception
Gets the list of the register mappings for this datastore
Specified by:
listMappingNames in interface dkDatastore
Overrides:
listMappingNames in class dkAbstractDatastore
Returns:
an array of register mapping objects' names

getMapping

public dkSchemaMapping getMapping(java.lang.String mappingName)
                           throws DKException,
                                  java.lang.Exception
Get mapping information for this datastore
Specified by:
getMapping in interface dkDatastore
Overrides:
getMapping in class dkAbstractDatastore
Parameters:
mappingName - name of the mapping information
Returns:
the schema mapping object

getExtension

public dkExtension getExtension(java.lang.String extensionName)
                         throws DKException,
                                java.lang.Exception
Gets the extension object from a given extenstion name.
Specified by:
getExtension in interface dkDatastore
Overrides:
getExtension in class dkAbstractDatastore
Parameters:
extensionName - name of the extension object.
Returns:
extension object.

addExtension

public void addExtension(java.lang.String extensionName,
                         dkExtension extensionObj)
                  throws DKException,
                         java.lang.Exception
Adds a new extension object.
Specified by:
addExtension in interface dkDatastore
Overrides:
addExtension in class dkAbstractDatastore
Parameters:
extensionName - name of new extension object
extensionObj - the extension object to be set

removeExtension

public void removeExtension(java.lang.String extensionName)
                     throws DKException,
                            java.lang.Exception
Remove an existing extension object
Specified by:
removeExtension in interface dkDatastore
Overrides:
removeExtension in class dkAbstractDatastore
Parameters:
extensionName - name of extension object to be removed

listExtensionNames

public java.lang.String[] listExtensionNames()
                                      throws DKException,
                                             java.lang.Exception
Gets the list of extension objects' names
Specified by:
listExtensionNames in interface dkDatastore
Overrides:
listExtensionNames in class dkAbstractDatastore
Returns:
an array of extension objects' names

createDDO

public DKDDO createDDO(java.lang.String objectType,
                       int Flags)
                throws DKException,
                       java.lang.Exception
Creates a new DDO with object type, properties and attributes set for a given backend server.
Specified by:
createDDO in interface dkDatastore
Overrides:
createDDO in class dkAbstractDatastore
Parameters:
objectType - the name of the table and (optionally) schema in the form .
Flags - to indicate various options to specify more detail characteristics of the DDO to create. Valid values are: DK_CM_ITEM - to create an item DDO. If no flag is supplied (Flags equals zero) the default will be DK_CM_ITEM.
Returns:
a new DDO of the given object type with all the properties and attributes set, so that the user only need to set the attribute values. The attribute values are initialized to null.

createPidIdString

public java.lang.String createPidIdString(DKNVPair[] list)
                                   throws DKException,
                                          java.lang.Exception
Builds the Pid Id string based on the specified column, value pairs

parsePidIdString

public DKNVPair[] parsePidIdString(java.lang.String Id)
                            throws DKException,
                                   java.lang.Exception
Parses the Pid Id string into column, value pairs

destroy

public void destroy()
             throws DKException,
                    java.lang.Exception
datastore destroy - datastore cleanup if needed
Specified by:
destroy in interface dkDatastore
Overrides:
destroy in class dkAbstractDatastore

getRSCCnt

public int getRSCCnt()

getCallbkCnt

public int getCallbkCnt()

EIP Java APIs

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