Class UserRegistryConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- com.ibm.di.connector.sapr3.user.UserRegistryConnector
-
- All Implemented Interfaces:
ConnectorInterface
,AbapErrorCache
,VersionInfoInterface
public final class UserRegistryConnector extends Connector implements ConnectorInterface, AbapErrorCache
The SAP R/3 User Registry Connector. Version %sapurcn.release.version% Build %sapurcn.release.build.version%.
The connector enables external applications, using IBM Tivoli Directory Integrator, to manage users in SAP R/3. It projects the SAP user database as a "registry" into the IBM Tivoli Directory Integrator infrastructure. It supports the following IBM Tivoli Directory Integrator Connector Modes: Add Only, Delete, Update, Iterator, Lookup. The connector supports design time schema query via
querySchema(java.lang.Object)
.A note about ABAP errors and warnings
The connector invokes BAPI/RFC functions in SAP to perform the connector mode operations. In some cases, data passed to the BAPI/RFC functions from the XML input, may result in ABAP data validation failures. An example of this case could be the value for post code is not valid within the country region. The BAPI/RFC functions return the results of validation checks in the "RETURN" parameter of the RFC.
The connector has been desingned to make the RFC return status available to the Assembly Line. The connector does not interpret, or translate, ABAP errors or warnings into thrown exceptions. The connector registers a script bean named "urcAbapErrorCache". The bean is registered for all connector modes and can be accessed in connector hooks. The bean is an instance ofAbapErrorCache
. Script code in a connector hook can use this information to perform contingency actions as required. The cache is reset before the execution of each connector method. Example script code is shown below:
var errs = urcAbapErrorCache.getLastErrorSet();
if (errs.size() > 0) {
  task.logmsg("********** There were ABAP Errors *********");
  for (var i = 0; i < errs.size(); ++i) {
   var errInfo = errs.get(i);
   task.logmsg("The message is: " + errInfo.getMsg());
   task.logmsg("The message number is: " + errInfo.getMsgNum().toString());
  }
}
var warns = urcAbapErrorCache.getLastWarningSet();
if (warns.size() > 0) {
  task.logmsg("********** There were ABAP Warnings *********");
  for (var i = 0; i < warns.size(); ++i) {
   var errInfo = warns.get(i);
   task.logmsg("The message is: " + errInfo.getMsg());
   task.logmsg("The message number is: " + errInfo.getMsgNum().toString());
  }
}
A given SAP user entry is represented as XML by the connector, and is set as the value of the connector attribute named "sapUserXml". The value if this attribute is always an XML string. Its XSchema is defined in the user guide for the connector. An example XML instance is shown below.
<User> <sapUserName></sapUserName> <sapUserPassword></sapUserPassword> <sapUserAlias> <aliasName></aliasName> </sapUserAlias> <sapAddress> <title></title> <academicTitle></academicTitle> <firstName></firstName> <lastName></lastName> <namePrefix></namePrefix> <nameFormat></nameFormat> <nameFormatRuleCountry></nameFormatRuleCountry> <isoLanguage></isoLanguage> <language></language> <searchSortTerm></searchSortTerm> <department></department> <function></function> <buildingNumber></buildingNumber> <buildingFloor></buildingFloor> <roomNumber></roomNumber> <name></name> <name2></name2> <name3></name3> <name4></name4> <city></city> <postCode></postCode> <poBoxPostCode></poBoxostCode> <poBox></poBox> <street></street> <streetNumber></streetNumber> <houseNumber></houseNumber> <country></country> <countryIso></countryIso> <region></region> <timeZone></timeZone> <primaryPhoneNumber></primaryPhoneNumber> <primaryPhoneExtension></primaryPhoneExtension> <primaryFaxNumber></primaryFaxNumber> <primaryFaxExtension></primaryFaxExtension> </sapAddress> <sapCompany> <companyNameKey></companyNameKey> </sapCompany> <sapDefaults> <startMenu></startMenu> <outputDevice></outputDevice> <printTimeAndDate></printTimeAndDate> <printDelete></printDelete> <dateFormat></dateFormat> <decimalFormat></decimalFormat> <logonLanguage></logonLanguage> <cattTestStatus></cattTestStatus> <costCenter></costCenter> </sapDefaults> <sapLogonData> <validFromDate></validFromDate> <validToDate></validToDate> <userType></userType> <userGroup></userGroup> <accountId></accountId> <timeZone></timeZone> <lastLogonTime></lastLogonTime> <codeVerEncryption></codeVerEncryption> </sapLogonData> <sapSncData> <printableName></printableName> <allowUnsecure></allowUnsecure> </sapSncData> <sapUserGroupList> <group> <name></name> </group> <group> <name></name> </group> </sapUserGroupList> <sapParameterList> <parameter> <parameterId></parameterId> <parameterValue></parameterValue> </parameter> <parameter> <parameterId></parameterId> <parameterValue></parameterValue> </parameter> </sapParameterList> <sapUserEmailAddressList> <email> <defaultNumber></defaultNumber> <smtpAddress></smtpAddress> <isHomeAddress></isHomeAddress> <sequenceNumber></sequenceNumber> </email> <email> <defaultNumber></defaultNumber> <smtpAddress></smtpAddress> <isHomeAddress></isHomeAddress> <sequenceNumber></sequenceNumber> </email> </sapUserEmailAddressList> <sapRoleList> <role> <name></name> <validFromDate></validFromDate> <validToDate></validToDate> </role> <role> <name></name> <validFromDate></validFromDate> <validToDate></validToDate> </role> </sapRoleList> <sapProfileList> <profile> <name></name> </profile> <profile> <name></name> </profile> </sapProfileList> </User>
For a description of Add Only mode requirements, see
putEntry(com.ibm.di.entry.Entry)
.For a description of Update mode requirements, see
modEntry(com.ibm.di.entry.Entry, com.ibm.di.server.SearchCriteria)
.For a description of Delete mode requirements, see
deleteEntry(com.ibm.di.entry.Entry, com.ibm.di.server.SearchCriteria)
.For a description of Lookup mode requirements, see
findEntry(com.ibm.di.server.SearchCriteria)
.For a description of Iterator mode requirements, see
getNextEntry()
andselectEntries()
.
-
-
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 UserRegistryConnector()
Construct the Connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteEntry(Entry entry, SearchCriteria search)
Called by IBM Tivoli Directory Integrator AL to remove an existing user and associated attributes from SAP R/3.Entry
findEntry(SearchCriteria search)
Called by IBM Tivoli Directory Integrator AL to find an existing user and associated attributes in SAP R/3.java.util.List
getLastErrorSet()
Allows the caller to obtain a list of ABAP errors that might have occured during the execution of any supported Connector method.java.util.List
getLastWarningSet()
Allows the caller to obtain a list of ABAP warnings that might have occured during the execution of any supported Connector method.Entry
getNextEntry()
This method is called to retrieve the next entry from the connector.java.lang.String
getVersion()
Get the version string.void
initialize(java.lang.Object o)
This method is called once after the connector configuration file has been provided by the caller.void
modEntry(Entry entry, SearchCriteria search)
Called by IBM Tivoli Directory Integrator AL to update an existing user and associated attributes in SAP R/3.void
putEntry(Entry entry)
Called by IBM Tivoli Directory Integrator AL to add a new user and associated attributes to SAP R/3.java.lang.Object
querySchema(java.lang.Object source)
Return the IBM Tivoli Directory Integrator Entry schema supported by this connector.void
registerScriptBeans(ScriptEngine se)
This method is called to register specific objects in the script context.void
selectEntries()
Called by IBM Tivoli Directory Integrator AL when the connector operates in Iterator mode inside an assembly line.-
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, modEntry, pushback, queryOperations, queryReply, queryTables, reconnect, reconnect, replyEntry, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, terminate, 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, modEntry, pushback, queryOperations, queryReply, reconnect, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminate, terminateServer
-
-
-
-
Method Detail
-
registerScriptBeans
public void registerScriptBeans(ScriptEngine se) throws java.lang.Exception
Description copied from class:Connector
This method is called to register specific objects in the script context. If the connector has a parser, the parser's registerScriptBeans method is also called.- Specified by:
registerScriptBeans
in interfaceConnectorInterface
- Overrides:
registerScriptBeans
in classConnector
- Parameters:
se
- The script engine context- Throws:
java.lang.Exception
- if an error occurs.
-
getLastWarningSet
public java.util.List getLastWarningSet()
Allows the caller to obtain a list of ABAP warnings that might have occured during the execution of any supported Connector method.- Specified by:
getLastWarningSet
in interfaceAbapErrorCache
- Returns:
- a list of warning severity AbapErrorInfo. Minimum length will be zero.
-
getLastErrorSet
public java.util.List getLastErrorSet()
Allows the caller to obtain a list of ABAP errors that might have occured during the execution of any supported Connector method.- Specified by:
getLastErrorSet
in interfaceAbapErrorCache
- Returns:
- a list of error severity AbapErrorInfo. Minimum length will be zero.
-
initialize
public void initialize(java.lang.Object o) throws UserRegistryConnectorException, ConfigurationException
This method is called once after the connector configuration file has been provided by the caller.- Specified by:
initialize
in interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- Parameters:
o
- IBM Tivoli Directory Integrator config object. Not used.- Throws:
UserRegistryConnectorException
- When an error happens during super class init.ConfigurationException
- if SAP connection parameters are invalid or XSL files are invalid.
-
querySchema
public java.lang.Object querySchema(java.lang.Object source) throws UserRegistryConnectorException
Return the IBM Tivoli Directory Integrator Entry schema supported by this connector. The connector supports two attributes named "sapUserXml" and "sapUserName". sapUserXml is an XML string representing the attributes of a user to be operated on. sapUserName is a string representing a given user name in SAP. It is supported to allow the definition of IBM Tivoli Directory Integrator "LinkCriteria" when the connector is deployed in Lookup, Delete, or Update modes.- Specified by:
querySchema
in interfaceConnectorInterface
- Overrides:
querySchema
in classConnector
- Parameters:
source
- not used.- Returns:
- A vector containg one Entry for IBM Tivoli Directory Integrator schema display.
- Throws:
UserRegistryConnectorException
- If an error occurs.- See Also:
Entry
,Vector
-
putEntry
public void putEntry(Entry entry) throws ConnectorMethodException, UserRegistryConnectorException
Called by IBM Tivoli Directory Integrator AL to add a new user and associated attributes to SAP R/3.- Specified by:
putEntry
in interfaceConnectorInterface
- Overrides:
putEntry
in classConnector
- Parameters:
entry
- The AL connector entry input. This connector must have an attribute named "sapUserXml". Its value must be an XML string conforming to the SAP User XML Schema. See user guide for more details.- Throws:
UserRegistryConnectorException
- If the attribute is missing from the entry.ConnectorMethodException
- if the SAP network call fails, or an XSL transform error occurs.- See Also:
Connector.putEntry(com.ibm.di.entry.Entry)
-
deleteEntry
public void deleteEntry(Entry entry, SearchCriteria search) throws ConnectorMethodException, UserRegistryConnectorException
Called by IBM Tivoli Directory Integrator AL to remove an existing user and associated attributes from SAP R/3.- Specified by:
deleteEntry
in interfaceConnectorInterface
- Overrides:
deleteEntry
in classConnector
- Parameters:
entry
- The AL connector entry input. This connector must have an attribute named "sapUserXml". Its value must be an XML string conforming to the SAP User XML Schema. The XML must, at a minimum, contain the "sapUserName" element. Typically, the entry will be populated by the findEntry method, which is called by the AL before this method. See user guide for more details.search
- Passed through to XSL style sheet as an XSL param.- Throws:
UserRegistryConnectorException
- If the attribute is missing from the entry.ConnectorMethodException
- if the SAP network call fails, or an XSL transform error occurs.- See Also:
Connector.deleteEntry(com.ibm.di.entry.Entry, com.ibm.di.server.SearchCriteria)
,findEntry(com.ibm.di.server.SearchCriteria)
-
modEntry
public void modEntry(Entry entry, SearchCriteria search) throws ConnectorMethodException, UserRegistryConnectorException
Called by IBM Tivoli Directory Integrator AL to update an existing user and associated attributes in SAP R/3.- Specified by:
modEntry
in interfaceConnectorInterface
- Overrides:
modEntry
in classConnector
- Parameters:
entry
- The AL connector entry input. This connector must have an attribute named "sapUserXml". Its value must be an XML string conforming to the SAP User XML Schema. The XML must, at a minimum, contain the "sapUserName" element. Typically, the entry will be populated by the findEntry method, which is called by the AL before this method. See user guide for more details.search
- Passed through to XSL style sheet as an XSL param.- Throws:
UserRegistryConnectorException
- If the attribute is missing from the entry.ConnectorMethodException
- if the SAP network call fails, or an XSL transform error occurs.- See Also:
Connector.modEntry(com.ibm.di.entry.Entry, com.ibm.di.server.SearchCriteria)
,findEntry(com.ibm.di.server.SearchCriteria)
-
findEntry
public Entry findEntry(SearchCriteria search) throws ConnectorMethodException, UserRegistryConnectorException
Called by IBM Tivoli Directory Integrator AL to find an existing user and associated attributes in SAP R/3.- Specified by:
findEntry
in interfaceConnectorInterface
- Overrides:
findEntry
in classConnector
- Parameters:
search
- Defined in the "LinkCriteria" tab of the AL. Must have a criteria name "sapUserName". Its value is the name of the user to be found.- Returns:
- The entry populated with attribute "sapUserXml", or
null
if the user could not be found. - Throws:
UserRegistryConnectorException
- If the attribute is missing from the entry.ConnectorMethodException
- if the SAP network call fails, or an XSL transform error occurs.- See Also:
Connector.findEntry(com.ibm.di.server.SearchCriteria)
-
selectEntries
public void selectEntries() throws ConnectorMethodException, UserRegistryConnectorException
Called by IBM Tivoli Directory Integrator AL when the connector operates in Iterator mode inside an assembly line. It finds all user names currently managed by the connected SAP R/3 instance. It stores all users names in a cached R3UsernameIterator following a RFC lookup to obtain the names.- Specified by:
selectEntries
in interfaceConnectorInterface
- Overrides:
selectEntries
in classConnector
- Throws:
UserRegistryConnectorException
- If the attribute is missing from the entry.ConnectorMethodException
- if the SAP network call fails, or an XSL transform error occurs.- See Also:
Connector.selectEntries()
,R3UsernameIterator
-
getNextEntry
public Entry getNextEntry() throws ConnectorMethodException
This method is called to retrieve the next entry from the connector. When there are no more entries to retrieve the function should return a null value indicating a logical end of file. This method uses the cached Iterator fromselectEntries()
.- Specified by:
getNextEntry
in interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- Returns:
- An entry containing sapUserXml attribute. Its value is an XML
string representing the user attributes. The result will be
null
when no more user entries are available. - Throws:
ConnectorMethodException
- if the SAP network call fails, or an XSL transform error occurs.- See Also:
ConnectorInterface.selectEntries()
-
getVersion
public java.lang.String getVersion()
Get the version string. Used by IBM Tivoli Directory Integrator to log version info at AL startup.- Specified by:
getVersion
in interfaceVersionInfoInterface
- Returns:
- The version info string for this connector.
-
-