Package com.ibm.di.connector
Class ITRegistryConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- com.ibm.di.connector.ITRegistryConnector
-
- All Implemented Interfaces:
ConnectorInterface
,VersionInfoInterface
public class ITRegistryConnector extends Connector implements ConnectorInterface
This Connector will add a CI (Configuration Item) or a Relationship to a centralized IT registry database. It depends upon IT registry for working properly.
This Connector supports three modes:- CallReply
- Iterator
- Lookup
Note: The IT registry API uses multiple maps without generic types which cause multiple warnings.
-
-
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 ITRegistryConnector()
Constructor which populates the modes supported by the Connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
checkDbConnection()
Checks if with the currently configured properties, a connection to the IT registry database can be established.Entry
findEntry(SearchCriteria searchCrit)
This will return an Entry (CI\Relationship) based on the conditions specified in the Link Criteria of the Connector.java.lang.String
getAttributeFilter()
Returns the attribute filter configured for an IT registry Ci and Relationship Connector in Iterator mode.java.lang.String
getCdmVersion()
Returns the version of the CDM that this Connector is using.java.lang.String
getDateFilter()
Returns the date filter configured for an IT registry Ci and Relationship Connector in Iterator mode.java.lang.String
getDbUsername()
Returns the username for connection to the IT registry database.java.lang.String
getJdbcDriver()
Returns the JDBC driver for connection to the IT registry database.java.lang.String
getJdbcUrl()
Returns the JDBC URL for connection to the IT registry database.java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>
getMSS()
Returns the Management Software Systems (MSSs) present in IT registry database.Entry
getNextEntry()
This method returns a single entry object for a CI\Relationship searched as per criteria.java.util.Map<java.lang.String,java.lang.Object>
getTypes()
Returns the types of CIs/Relationships available for this Connector.java.lang.String
getUseITRegistry()
Returns whether the Connector relies on a IT registry for its meta-data.java.lang.String
getVersion()
Version information.void
initialize(java.lang.Object entry)
This standard method initializes the Connector with values present in its Configuration panel.Entry
queryReply(Entry entry)
This method is invoke for CallReply mode.java.lang.Object
querySchema(java.lang.Object arg0)
This method populates Output Map for CallReply mode and Input Map for Iterator\Lookup mode.void
selectEntries()
This is preparation method for Iterator mode.void
terminate()
This method will close Connection to the IT registry database and shutdown NRS service.-
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, 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, modEntry, modEntry, pushback, putEntry, queryOperations, 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
deleteEntry, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, modEntry, modEntry, pushback, putEntry, queryOperations, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer
-
-
-
-
Method Detail
-
getDbUsername
public java.lang.String getDbUsername()
Returns the username for connection to the IT registry database.- Returns:
- the dbUsername.
-
getJdbcDriver
public java.lang.String getJdbcDriver()
Returns the JDBC driver for connection to the IT registry database.- Returns:
- the jdbcDriver.
-
getJdbcUrl
public java.lang.String getJdbcUrl()
Returns the JDBC URL for connection to the IT registry database.- Returns:
- the jdbcUrl.
-
getUseITRegistry
public java.lang.String getUseITRegistry()
Returns whether the Connector relies on a IT registry for its meta-data.- Returns:
- the useITRegistry parameter.
-
initialize
public void initialize(java.lang.Object entry) throws java.lang.Exception
This standard method initializes the Connector with values present in its Configuration panel. If database related parameters are not present in the Connector's configuration, they are taken from theIdMLConstants.IT_REGISTRY_PROPERTIES_FILE
file.- Specified by:
initialize
in interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- Parameters:
entry
- 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.Exception
This method populates Output Map for CallReply mode and Input Map for Iterator\Lookup mode. Depending upon the value of "Use IT registry" parameter the attributes for a CI\Relationship are fetched from JAR or the IT registry database.- Specified by:
querySchema
in interfaceConnectorInterface
- Overrides:
querySchema
in 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
-
queryReply
public Entry queryReply(Entry entry) throws java.lang.Exception
This method is invoke for CallReply mode. In this mode the Connector will be used together with an Init IT registry FC in the AssemblyLine. It depends upon Init IT registry FC for statically sharing a book - an object holding needed information, which it looks up using a 'Book Name' parameter. In this mode the Connector can perform the following operations:- create: add a CI or Relationship. If Init IT registry FC has set a
Refresh flag, then the Connector will first remove all entries in the IT
registry database which are older that a given timestamp. The timestamp
is detemined by the Init IT registry FC and made available through the
shared book. To add a CI the Connector should satisfy at least one of its
Naming Rules. A naming rule is a specific list of identifying attributes
that should be passed to the IT registry for a CI to be successfully
registered in its database (please refer to the Tivoli Common Data Model
documentation for more details).
The supported attributes for a CI (identifying and non-identifying) can be discovered in Output Map of the Connector. After registering a CI the Connector will return a $id attribute - a wrapper of the actual GUID returned by the IT registry. It could be latter passed to another IT registry Connector for registering Relationships. However, the value of the wrapped GUID cannot and should not be extracted by users. To add a Relationship the &id-s of two CIs should be passed for the 'source' and 'target' attributes in the Output Map of the Connector. - modify: currently this operation is not supported neither for CIs nor Relationships.
- delete: delete a CI\Relationship. To delete a Relationship the $id-s of the 'source' and 'target' CIs should be supplied.
- Specified by:
queryReply
in interfaceConnectorInterface
- Overrides:
queryReply
in classConnector
- Parameters:
entry
- entry mapped in the Output Map of the FC.- Returns:
- the returned entry object. It contains an attribute $id which will hold a wrapper of the GUID returned by the IT registry upon registering a CI. For the rest of the cases (update and delete) it is null.
- Throws:
java.lang.Exception
- If Book Name is not supplied. If MSS Guid is not supplied. If operation is not supplied.
- create: add a CI or Relationship. If Init IT registry FC has set a
Refresh flag, then the Connector will first remove all entries in the IT
registry database which are older that a given timestamp. The timestamp
is detemined by the Init IT registry FC and made available through the
shared book. To add a CI the Connector should satisfy at least one of its
Naming Rules. A naming rule is a specific list of identifying attributes
that should be passed to the IT registry for a CI to be successfully
registered in its database (please refer to the Tivoli Common Data Model
documentation for more details).
-
selectEntries
public void selectEntries() throws java.lang.Exception
This is preparation method for Iterator mode. This will fetch values of CI\Relationship from the IT registry database. The values will be selected based on 'Attribute Filter' parameter or 'Date Filter' parameter. The 'MSS Name' parameter determines the artifacts for whose MSSs should be searched. All CIs\Relationships will be fetched if no value is supplied in either of the above parameters.- Specified by:
selectEntries
in interfaceConnectorInterface
- Overrides:
selectEntries
in 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:
getNextEntry
in interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- Returns:
- the next read entry.
- Throws:
java.lang.Exception
- if an error occurs.- See Also:
ConnectorInterface.selectEntries()
-
findEntry
public Entry findEntry(SearchCriteria searchCrit) throws java.lang.Exception
This will return an Entry (CI\Relationship) based on the conditions specified in the Link Criteria of the Connector. The returned attributes will comply with the Common Data Model. In case more than one entry is found 'On Multiple Entries' hook should be enabled.
The search criteria should use logical AND conditions between the separate criterion and the comparison should be "equals". Otherwise, an Exception will be thrown.- Specified by:
findEntry
in interfaceConnectorInterface
- Overrides:
findEntry
in classConnector
- Parameters:
searchCrit
- the search criteria.- Returns:
- the found entry.
- Throws:
java.lang.Exception
- if a problem occurs.
-
terminate
public void terminate() throws java.lang.Exception
This method will close Connection to the IT registry database and shutdown NRS service. It will also clear the counter for Iterator mode.- Specified by:
terminate
in interfaceConnectorInterface
- Overrides:
terminate
in 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 IT registry 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.
-
getTypes
public java.util.Map<java.lang.String,java.lang.Object> getTypes() throws java.lang.Exception
Returns the types of CIs/Relationships available for this Connector. Depending on its Configuration we can get the names of all supported CIs, or of all Relationships.- Returns:
- a List with all CI/Relationship types.
- Throws:
java.lang.Exception
- if a problem occurs.
-
getCdmVersion
public java.lang.String getCdmVersion() throws java.lang.Exception
Returns the version of the CDM that this Connector is using. depending on its configuration this can be either the version of CDM that the IT registry is using or the version of the CDM meta-data stored in the locally used jar file.- Returns:
- the CDM version, with format '<version>.<release>.<modifier>'.
- Throws:
java.lang.Exception
- if a problem occurs.
-
getVersion
public java.lang.String getVersion()
Version information.- Specified by:
getVersion
in interfaceVersionInfoInterface
- Returns:
- version information
-
getAttributeFilter
public java.lang.String getAttributeFilter()
Returns the attribute filter configured for an IT registry Ci and Relationship Connector in Iterator mode.- Returns:
- the value of "Attrbute Filter" parameter.
-
getDateFilter
public java.lang.String getDateFilter()
Returns the date filter configured for an IT registry Ci and Relationship Connector in Iterator mode.- Returns:
- the value of "Date Filter" parameter.
-
getMSS
public java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> getMSS() throws java.lang.Exception
Returns the Management Software Systems (MSSs) present in IT registry database. This will help populate 'MSS Guid' parameter and is applicable only for Lookup and Iterator mode.- Returns:
- a HashMap of MSSs. For each entry the key is either the MSSName of the MSS or a combination of its identifying attributes (the format is [ManufacturerName, ProductName, Hostname], and the value is a HashMap containing the full information for the MSS.
- Throws:
java.lang.Exception
- if a problem occurs.
-
-