Package com.ibm.di.connector.ccmdb
Class CCMDBConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- com.ibm.di.connector.ccmdb.CCMDBConnector
-
- All Implemented Interfaces:
ConnectorInterface,VersionInfoInterface
public class CCMDBConnector extends Connector implements ConnectorInterface
This Connector will read Actual Config Items and relations from MAXIMO database.
This Connector supports two modes:- Iterator
- Lookup
-
-
Field Summary
-
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
-
-
Constructor Summary
Constructors Constructor Description CCMDBConnector()Constructor which populates the modes supported by the Connector.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringcheckDbConnection()Checks if with the currently configured properties, a connection to the MAXIMO database can be established.voiddeleteEntry(Entry entry, SearchCriteria search)Deletes an existing entry.EntryfindEntry(SearchCriteria criteria)Finds an existing entry.java.lang.StringgetCDMType(java.lang.String classification)java.lang.StringgetClassification(java.lang.String cdmType)java.util.List<java.lang.String>getClassTypes(java.lang.String artifactType)java.sql.ConnectiongetConnection()Returns the JDBC Connection to the Maximo database.java.lang.StringgetDbUsername()Returns the username for connection to the Maximo database.java.lang.StringgetJdbcDriver()Returns the JDBC driver for connection to the Maximo database.java.lang.StringgetJdbcUrl()Returns the JDBC URL for connection to the Maximo database.EntrygetNextEntry()This method returns a single entry object for a CI\Relationship searched as per criteria.protected static ResourceHashgetResHash()java.lang.StringgetVersion()Version information.voidinitialize(java.lang.Object entry)This standard method initializes the Connector with values present in its Configuration panel.voidmodEntry(Entry entry, SearchCriteria search)Modifies an existing entry.voidmodEntry(Entry entry, SearchCriteria search, Entry oldEntry)Modifies an existing entry.voidputEntry(Entry entry)Adds a new entry to the data sourcejava.lang.ObjectquerySchema(java.lang.Object arg0)This method populates Output Map for CallReply mode and Input Map for Iterator\Lookup mode.voidselectEntries()This is preparation method for Iterator mode.voidterminate()This method will close Connection to the MAXIMO database.-
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, extractExceptionInformation, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, pushback, queryOperations, queryReply, queryTables, reconnect, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, terminateServer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.di.connector.ConnectorInterface
getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, pushback, queryOperations, queryReply, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
-
-
-
-
Method Detail
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersionin interfaceVersionInfoInterface- Returns:
- version information
-
getDbUsername
public java.lang.String getDbUsername()
Returns the username for connection to the Maximo database.- Returns:
- the dbUsername.
-
getJdbcDriver
public java.lang.String getJdbcDriver()
Returns the JDBC driver for connection to the Maximo database.- Returns:
- the jdbcDriver.
-
getJdbcUrl
public java.lang.String getJdbcUrl()
Returns the JDBC URL for connection to the Maximo database.- Returns:
- the jdbcUrl.
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLExceptionReturns the JDBC Connection to the Maximo database.- Returns:
- the Connection.
- Throws:
java.sql.SQLException
-
getCDMType
public java.lang.String getCDMType(java.lang.String classification) throws java.lang.Exception- Parameters:
classification-- Returns:
- Throws:
java.lang.Exception
-
getClassification
public java.lang.String getClassification(java.lang.String cdmType)
- Parameters:
cdmType-- Returns:
-
getClassTypes
public java.util.List<java.lang.String> getClassTypes(java.lang.String artifactType) throws CCMDBException- Parameters:
artifactType-- Returns:
- List
- Throws:
CCMDBException
-
initialize
public void initialize(java.lang.Object entry) throws java.lang.ExceptionThis standard method initializes the Connector with values present in its Configuration panel. If database related parameters are not present in the Connector's configuration.- Specified by:
initializein interfaceConnectorInterface- Overrides:
initializein classConnector- Parameters:
entry- an initial entry provided to the Connector.- Throws:
java.lang.Exception- if a problem occurs.
-
querySchema
public java.lang.Object querySchema(java.lang.Object arg0) throws java.lang.ExceptionThis method populates Output Map for CallReply mode and Input Map for Iterator\Lookup mode. The attributes for a CI\Relationship are fetched from MAXIMO database.- Specified by:
querySchemain interfaceConnectorInterface- Overrides:
querySchemain classConnector- Parameters:
arg0- an object parameter not used by this method.- Returns:
null, since the Connector handles the schema population on its own.- Throws:
java.lang.Exception- if a problem occurs.- See Also:
Entry,Vector
-
terminate
public void terminate() throws java.lang.ExceptionThis method will close Connection to the MAXIMO database. It will also clear the counter for Iterator mode.- Specified by:
terminatein interfaceConnectorInterface- Overrides:
terminatein classConnector- Throws:
java.lang.Exception- if a problem occur.
-
checkDbConnection
public java.lang.String checkDbConnection()
Checks if with the currently configured properties, a connection to the MAXIMO database can be established.- Returns:
- if the connection was established successfully null is returned, otherwise the method returns a String containing the exception's text.
- Throws:
java.io.IOException- if a problem occurs.
-
selectEntries
public void selectEntries() throws java.lang.ExceptionThis is preparation method for Iterator mode. This will fetch values of CI\Relationship from the MAXIMO database.- Specified by:
selectEntriesin interfaceConnectorInterface- Overrides:
selectEntriesin classConnector- Throws:
java.lang.Exception- if a problem occurs.
-
getNextEntry
public Entry getNextEntry() throws java.lang.Exception
This method returns a single entry object for a CI\Relationship searched as per criteria. Refer to selectEntries for more details.- Specified by:
getNextEntryin interfaceConnectorInterface- Overrides:
getNextEntryin classConnector- Returns:
- the next read entry.
- Throws:
java.lang.Exception- if an error occurs.- See Also:
ConnectorInterface.selectEntries()
-
findEntry
public Entry findEntry(SearchCriteria criteria) throws java.lang.Exception
Finds an existing entry. The search criteria specifies which entry to locateHere is an example of how to find all people with names starting with 'J' which are from IBM organization in US.
Example:
var ctor = input.getConnector(); var crit = new com.ibm.di.SearchCriteria("$dn", com.ibm.di.SearchCriteria.SUBSTRING, "c=US,o=IBM"); crit.addCriteria("name", com.ibm.di.SearchCriteria.INITIAL_STRING, "J"); crit.addCriteria("objectclass", com.ibm.di.SearchCriteria.SUBSTRING, "person"); var res = ctor.findEntry(crit); if (res != null) { main.logmsg("Found entry:"); main.dumpEntry(res); } else { if( getFindEntryCount()> 1 ){ main.logmsg("Found these entries:"); while ( (entry = ctor.getNextFindEntry()) != null ) { main.dumpEntry(entry); } } else { main.logmsg("Entry not found!"); } }- Specified by:
findEntryin interfaceConnectorInterface- Overrides:
findEntryin classConnector- Parameters:
criteria- The search criteria used to locate the entry to be modified- Returns:
- The entry found, or null if no or multiple entries found
- Throws:
java.lang.Exception- if an error occurs.
-
putEntry
public void putEntry(Entry entry) throws java.lang.Exception
Adds a new entry to the data sourceExample:
var ctor = write.getConnector(); for (i = 0; i < 10; i++) { var entry = system.newEntry(); entry.setAttribute("linenumber", i); entry.setAttribute("line", i + " line of text..."); main.logmsg("Writes entry to output..."); main.dumpEntry(entry); ctor.putEntry(entry); }- Specified by:
putEntryin interfaceConnectorInterface- Overrides:
putEntryin classConnector- Parameters:
entry- The entry data to add- Throws:
java.lang.Exception- if an error occurs.
-
modEntry
public void modEntry(Entry entry, SearchCriteria search, Entry oldEntry) throws java.lang.Exception
Description copied from class:ConnectorModifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.- Specified by:
modEntryin interfaceConnectorInterface- Overrides:
modEntryin classConnector- Parameters:
entry- The entry datasearch- The search criteria used to locate the entry to be modifiedoldEntry- The old entry found by the search criteria- Throws:
java.lang.Exception- if an error occurs.
-
modEntry
public void modEntry(Entry entry, SearchCriteria search) throws java.lang.Exception
Description copied from class:ConnectorModifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.- Specified by:
modEntryin interfaceConnectorInterface- Overrides:
modEntryin classConnector- Parameters:
entry- The entry datasearch- The search criteria used to locate the entry to be modified- Throws:
java.lang.Exception- if an error occurs.
-
deleteEntry
public void deleteEntry(Entry entry, SearchCriteria search) throws java.lang.Exception
Description copied from class:ConnectorDeletes an existing entry. The search criteria specifies which entry to modify. Some connectors may silently ignore the search criteria. For example, the LDAP connector will use the distinguished name ($dn) from the entry parameter (if it exists) rather than expanding the search criteria and search for the entry. Each connector's inner semantics governs whether the search parameter is used or not.- Specified by:
deleteEntryin interfaceConnectorInterface- Overrides:
deleteEntryin classConnector- Parameters:
entry- The entry datasearch- The search criteria used to locate the entry to be deleted- Throws:
java.lang.Exception- if an error occurs.
-
getResHash
protected static ResourceHash getResHash()
-
-