com.ibm.di.connector
Class DSMLv2SOAPConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by com.ibm.di.connector.DSMLv2SOAPConnector
All Implemented Interfaces:
ConnectorInterface, VersionInfoInterface

public class DSMLv2SOAPConnector
extends Connector
implements ConnectorInterface

The DSMLv2 SOAP Connector implements the DSMLv2 standard (http://www.oasis-open.org/committees/dsml/docs/DSMLv2.doc). It is able to execute DSMLv2 requests against a DSML Server. It also provides the option to use DSML SOAP binding.


Field Summary
static String ATTR_NAME_HTTP_BODY
          An attribute name: "http.body"
static String ATTR_NAME_HTTP_CHARACTER_SET
          An attribute name: "characterSet"
static String ATTR_NAME_HTTP_CONTENT_TYPE
          An attribute name: "http.Content-Type"
static String ATTR_NAME_HTTP_METHOD
          An attribute name: "http.method"
static String ATTR_NAME_HTTP_REMOTE_PASSWORD
          An attribute name: "http.remote_pass"
static String ATTR_NAME_HTTP_REMOTE_USER
          An attribute name: "http.remote_user"
static String ATTR_NAME_HTTP_SOAPACTION
          An attribute name: "http.SOAPAction"
static String ATTR_NAME_HTTP_URL
          An attribute name: "http.url"
static String BASE_OBJECT
          IBM TDS DSMLv2 String constant.
static String HTTP_BASIC_AUTH
          String constant.
static String PARAMETER_AUTH_METHOD
          A parameter name: "authenticationMethod"
static String PARAMETER_BINARY_ATTRIBUTES
          A parameter name: "binaryAttributes"
static String PARAMETER_PASSWORD
          A parameter name: "password"
static String PARAMETER_SEARCH_BASE
          A parameter name: "searchBase"
static String PARAMETER_SEARCH_FILTER
          A parameter name: "searchFilter"
static String PARAMETER_SEARCH_SCOPE
          A parameter name: "searchScope"
static String PARAMETER_SOAPACTION
          A parameter name: "soapAction"
static String PARAMETER_SOAPBINDING
          A parameter name: "soapbinding"
static String PARAMETER_URL
          A parameter name: "url"
static String PARAMETER_USERNAME
          A parameter name: "username"
static String SINGLE_LEVEL
          IBM TDS DSMLv2 String constant.
static String WHOLE_SUBTREE
          IBM TDS DSMLv2 String constant.
 
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
 
Constructor Summary
DSMLv2SOAPConnector()
          Default constructor.
 
Method Summary
 void deleteEntry(Entry aEntry, SearchCriteria aSearch)
          This method first look for an attribute with name Dsmlv2Parser.ATTR_NAME_DN in the provided entry if not found it looks the first criteria in the SearchCriteria object for the same name.
 Entry findEntry(SearchCriteria aSearch)
          Finds an existing entry.
 Entry getNextEntry()
          Gets an entry form the resultSet.
 String getVersion()
          Version information.
 void initialize(Object o)
          Initializes the connector.
 boolean isDeltaSupported()
          Delta mode supported.
 void modEntry(Entry entry, SearchCriteria search)
          Modifies an existing entry.
 void modEntry(Entry entry, SearchCriteria search, Entry old)
          Modifies an existing entry.
 void putEntry(Entry aPutEntry)
          Sends the DSML request to the DSML Server.
 Entry queryReply(Entry aQueryEntry)
          Sends the DSML request to the DSML Server.
 void selectEntries()
          Initializes the connection with the server and sends a request based on the configured parameters.
 
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextClient, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isExceptionFatal, isIOException, logError, logmsg, pushback, queryOperations, querySchema, queryTables, reconnect, reconnect, registerScriptBeans, 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, isExceptionFatal, isIOException, pushback, queryOperations, querySchema, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminate, terminateServer
 

Field Detail

PARAMETER_URL

public static final String PARAMETER_URL
A parameter name: "url"

See Also:
Constant Field Values

PARAMETER_AUTH_METHOD

public static final String PARAMETER_AUTH_METHOD
A parameter name: "authenticationMethod"

See Also:
Constant Field Values

PARAMETER_USERNAME

public static final String PARAMETER_USERNAME
A parameter name: "username"

See Also:
Constant Field Values

PARAMETER_PASSWORD

public static final String PARAMETER_PASSWORD
A parameter name: "password"

See Also:
Constant Field Values

PARAMETER_BINARY_ATTRIBUTES

public static final String PARAMETER_BINARY_ATTRIBUTES
A parameter name: "binaryAttributes"

See Also:
Constant Field Values

PARAMETER_SEARCH_BASE

public static final String PARAMETER_SEARCH_BASE
A parameter name: "searchBase"

See Also:
Constant Field Values

PARAMETER_SEARCH_FILTER

public static final String PARAMETER_SEARCH_FILTER
A parameter name: "searchFilter"

See Also:
Constant Field Values

PARAMETER_SEARCH_SCOPE

public static final String PARAMETER_SEARCH_SCOPE
A parameter name: "searchScope"

See Also:
Constant Field Values

PARAMETER_SOAPBINDING

public static final String PARAMETER_SOAPBINDING
A parameter name: "soapbinding"

See Also:
Constant Field Values

PARAMETER_SOAPACTION

public static final String PARAMETER_SOAPACTION
A parameter name: "soapAction"

See Also:
Constant Field Values

ATTR_NAME_HTTP_SOAPACTION

public static final String ATTR_NAME_HTTP_SOAPACTION
An attribute name: "http.SOAPAction"

See Also:
Constant Field Values

ATTR_NAME_HTTP_URL

public static final String ATTR_NAME_HTTP_URL
An attribute name: "http.url"

See Also:
Constant Field Values

ATTR_NAME_HTTP_METHOD

public static final String ATTR_NAME_HTTP_METHOD
An attribute name: "http.method"

See Also:
Constant Field Values

ATTR_NAME_HTTP_REMOTE_USER

public static final String ATTR_NAME_HTTP_REMOTE_USER
An attribute name: "http.remote_user"

See Also:
Constant Field Values

ATTR_NAME_HTTP_REMOTE_PASSWORD

public static final String ATTR_NAME_HTTP_REMOTE_PASSWORD
An attribute name: "http.remote_pass"

See Also:
Constant Field Values

ATTR_NAME_HTTP_BODY

public static final String ATTR_NAME_HTTP_BODY
An attribute name: "http.body"

See Also:
Constant Field Values

ATTR_NAME_HTTP_CONTENT_TYPE

public static final String ATTR_NAME_HTTP_CONTENT_TYPE
An attribute name: "http.Content-Type"

See Also:
Constant Field Values

ATTR_NAME_HTTP_CHARACTER_SET

public static final String ATTR_NAME_HTTP_CHARACTER_SET
An attribute name: "characterSet"

See Also:
Constant Field Values

HTTP_BASIC_AUTH

public static final String HTTP_BASIC_AUTH
String constant.

See Also:
Constant Field Values

BASE_OBJECT

public static final String BASE_OBJECT
IBM TDS DSMLv2 String constant.

See Also:
Constant Field Values

SINGLE_LEVEL

public static final String SINGLE_LEVEL
IBM TDS DSMLv2 String constant.

See Also:
Constant Field Values

WHOLE_SUBTREE

public static final String WHOLE_SUBTREE
IBM TDS DSMLv2 String constant.

See Also:
Constant Field Values
Constructor Detail

DSMLv2SOAPConnector

public DSMLv2SOAPConnector()
Default constructor. Instantiates the internally used DSMLv2 Parser and HTTP Parser.

Method Detail

initialize

public void initialize(Object o)
                throws Exception
Initializes the connector. Parses all the configuration parameters.

Specified by:
initialize in interface ConnectorInterface
Overrides:
initialize in class Connector
Parameters:
o - - ignored
Throws:
Exception - if the "url" parameter is missing or the protocol used is neither "http" nor "https".

putEntry

public void putEntry(Entry aPutEntry)
              throws Exception
Sends the DSML request to the DSML Server. The entry is first parsed. If the server response indicates that an error has occurred then an exception with that error will be thrown.

Specified by:
putEntry in interface ConnectorInterface
Overrides:
putEntry in class Connector
Parameters:
aPutEntry - the DSML request as an Entry object, used by the DSMLv2Parser.
Throws:
Exception - if the distinguish parameter is missing or the DSML Server replied with an error code.

queryReply

public Entry queryReply(Entry aQueryEntry)
                 throws Exception
Sends the DSML request to the DSML Server. The entry is first parsed. If the server response indicates that an error has occurred then an exception with that error will be thrown. If the response is not an error then that response is parsed back as an Entry object.

Specified by:
queryReply in interface ConnectorInterface
Overrides:
queryReply in class Connector
Parameters:
aQueryEntry - the DSML request as an Entry object, used by the DSMLv2Parser.
Returns:
the DSML response as an Entry object, used by the DSMLv2Parser.
Throws:
Exception - if the DSML Server replied with an error code.

selectEntries

public void selectEntries()
                   throws Exception
Initializes the connection with the server and sends a request based on the configured parameters. This operation prepares the result set so the getNextEntry() could return single entry at a time.

Specified by:
selectEntries in interface ConnectorInterface
Overrides:
selectEntries in class Connector
Throws:
Exception - if the server responded with an error message.

getNextEntry

public Entry getNextEntry()
                   throws Exception
Gets an entry form the resultSet. The resultSet is created during the selectEntries() operation.

Specified by:
getNextEntry in interface ConnectorInterface
Overrides:
getNextEntry in class Connector
Returns:
The next entry in the resultSet.
Throws:
Exception - - never
See Also:
ConnectorInterface.selectEntries()

findEntry

public Entry findEntry(SearchCriteria aSearch)
                throws Exception
Finds an existing entry. The search criteria specifies which entry to locate

Here 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:
findEntry in interface ConnectorInterface
Overrides:
findEntry in class Connector
Parameters:
aSearch - The search criteria used to locate the entry to be modified
Returns:
The entry found, or null if no or multiple entries found
Throws:
Exception - if an error occurs.

modEntry

public void modEntry(Entry entry,
                     SearchCriteria search)
              throws Exception
Modifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.

Specified by:
modEntry in interface ConnectorInterface
Overrides:
modEntry in class Connector
Parameters:
entry - The entry data
search - The search criteria used to locate the entry to be modified
Throws:
Exception - if an error occurs.

modEntry

public void modEntry(Entry entry,
                     SearchCriteria search,
                     Entry old)
              throws Exception
Modifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.

Specified by:
modEntry in interface ConnectorInterface
Overrides:
modEntry in class Connector
Parameters:
entry - The entry data
search - The search criteria used to locate the entry to be modified
old - The old entry found by the search criteria
Throws:
Exception - if an error occurs.

deleteEntry

public void deleteEntry(Entry aEntry,
                        SearchCriteria aSearch)
                 throws Exception
This method first look for an attribute with name Dsmlv2Parser.ATTR_NAME_DN in the provided entry if not found it looks the first criteria in the SearchCriteria object for the same name. If not found an exception is thrown. After the distinguished name is found the entry is parsed as a DSMLv2 request and sent. If the returned response indicates that an error had occurred then an exception is thrown.

Specified by:
deleteEntry in interface ConnectorInterface
Overrides:
deleteEntry in class Connector
Parameters:
aEntry - the entry which is the result of the attribute mapping
aSearch - the search criteria object.
Throws:
Exception - if an error while deleting the entry has occurred.

isDeltaSupported

public boolean isDeltaSupported()
Delta mode supported.

Specified by:
isDeltaSupported in interface ConnectorInterface
Overrides:
isDeltaSupported in class Connector
Returns:
true

getVersion

public String getVersion()
Version information.

Specified by:
getVersion in interface VersionInfoInterface
Returns:
version information.