LdapSender extends JNDIBase implements ISenderWithParameters { private XmlBuilder getTree(DirContext parentContext, String context, IPipeLineSession session, Map paramValueMap) { XmlBuilder contextElem = new XmlBuilder("context"); contextElem.addAttribute("name", context); String[] subCtxList = getSubContextList(parentContext, context, session); try { if (subCtxList.length == 0) { XmlBuilder attrs = attributesToXml(parentContext.getAttributes(context, getAttributesReturnedParameter())); contextElem.addSubElement(attrs); } else { for (int i = 0; i < subCtxList.length; i++) { contextElem.addSubElement( getTree((DirContext)parentContext.lookup(context), subCtxList[i], session, paramValueMap) ); } contextElem.addSubElement( attributesToXml(parentContext.getAttributes(context, getAttributesReturnedParameter()))); } } catch (NamingException e) { storeLdapException(e, session); log.error("Exception in operation [" + getOperation()+ "]: ", e); } return contextElem; } LdapSender(); @Override void configure(); void storeLdapException(Throwable t, IPipeLineSession session); @Override void open(); @Override boolean isSynchronous(); String performOperation(Message message, IPipeLineSession session); String[] getSubContextList(DirContext parentContext, String relativeContext, IPipeLineSession session); @Override Message sendMessage(Message message, IPipeLineSession session); @Override void addParameter(Parameter p); @Override ParameterList getParameterList(); @IbisDoc({"name of the sender", ""}) @Override void setName(String name); @Override String getName(); @IbisDoc({"specifies operation to perform. Must be one of <ul><li><code>read</code>: read the contents of an entry</li><li><code>create</code>: create an attribute or an entry</li><li><code>update</code>: update an attribute or an entry</li><li><code>delete</code>: delete an attribute or an entry</li><li><code>search</code>: search for an entry in the direct children of the specified root</li><li><code>deepSearch</code>: search for an entry in the complete tree below the specified root</li><li><code>getSubContexts</code>: get a list of the direct children of the specifed root</li><li><code>getTree</code>: get a copy of the complete tree below the specified root</li><li><code>challenge</code>: check username and password against LDAP specifying principal and credential using parameters</li><li><code>changeUnicodePwd</code>: typical user change-password operation (one of the two methods to modify the unicodePwd attribute in AD (http://support.microsoft.com/kb/263991))</li></ul>", "read"}) void setOperation(String string); String getOperation(); @IbisDoc({"url to context to search in, e.g. 'ldap://edsnlm01.group.intranet/ou=people, o=ing' to search in te people group of ing cds. used to overwrite the providerurl specified in jmsrealm.", ""}) void setLdapProviderURL(String string); String getLdapProviderURL(); @IbisDoc({"specifies subject to perform operation on. must be one of 'entry' or 'attribute'", "attribute"}) void setManipulationSubject(String string); String getManipulationSubject(); @IbisDoc({"comma separated list of attributes to return. when no are attributes specified, all the attributes from the object read are returned.", "<i>all attributes</i>"}) void setAttributesToReturn(String string); String getAttributesToReturn(); @IbisDoc({"specifies whether connection pooling is used or not", "true when principal not set as parameter, false otherwise"}) void setUsePooling(boolean b); boolean isUsePooling(); @IbisDoc({"specifies the time (in ms) that is spent searching for results for operation search", "20000 ms"}) void setSearchTimeout(int i); int getSearchTimeout(); @IbisDoc({"key of session variable used to store cause of errors", "errorreason"}) void setErrorSessionKey(String string); String getErrorSessionKey(); @IbisDoc({"the maximum number of entries to be returned by a search query, or 0 for unlimited", "<i>0 (unlimited)</i>"}) void setMaxEntriesReturned(int i); int getMaxEntriesReturned(); @IbisDoc({"when true the attributes passed by the input xml are scanned for an attribute with id unicodepwd, when found the value of this attribute will be encoded as required by active directory (a utf-16 encoded unicode string containing the password surrounded by quotation marks) before sending it to the ldap server", "false"}) void setUnicodePwd(boolean b); boolean getUnicodePwd(); @IbisDoc({"(only used when <code>operation=search/deepsearch</code>) when <code>true</code> the xml '&lt;ldapresult&gt;object not found&lt;/ldapresult&gt;' is returned instead of the partialresultexception 'unprocessed continuation reference(s)'", "false"}) void setReplyNotFound(boolean b); boolean isReplyNotFound(); static final String LDAP_ERROR_MAGIC_STRING; static final String OPERATION_READ; static final String OPERATION_CREATE; static final String OPERATION_UPDATE; static final String OPERATION_DELETE; static final String OPERATION_SEARCH; static final String OPERATION_DEEP_SEARCH; static final String OPERATION_SUB_CONTEXTS; static final String OPERATION_GET_TREE; static final String OPERATION_CHALLENGE; static final String OPERATION_CHANGE_UNICODE_PWD; static final String MANIPULATION_ENTRY; static final String MANIPULATION_ATTRIBUTE; }
@Test public void init() throws SAXException, IOException, ConfigurationException, SenderException, LDAPException, TimeOutException { compareXML("Ldap/expected/init.xml", getTree()); }