User Resolution Transformation

UCS is to resolve the address of a user for a specific channel. When we want to send an EMAIL, we don't need to send actual email address, just need to provide
userId. UCS has to get actual email address from LDAP server based on given userId.

Currently we have a specific in-memory map of users which has to replace with LDAP server. The current MOCK implementation of UserContactInfoResolverService is
MOCKUserContactInfoResolverServiceImpl, this class must be replaced with a real resolver by getting user information from LDAP server.

LDAP Server Information:
Host: 192.168.1.229
Port: 389
bind as uid=admin,ou=system
password: changeme

Below is the example code using ApacheDS LDAP API http://directory.apache.org/api/

LdapConnectionConfig config = new LdapConnectionConfig();
config.setLdapHost("192.168.1.229");
config.setLdapPort(389);
config.setName("uid=admin,ou=system");
config.setCredentials( "secret" );
Dn systemDn = new Dn( "ou=consumers,ou=system" );
LdapConnection myConnection=new LdapNetworkConnection(config);
myConnection.connect();
SearchRequest searchRequest=new SearchRequestImpl();
searchRequest.setBase(systemDn);
searchRequest.setFilter("(objectclass=*)");
searchRequest.setScope(SearchScope.SUBTREE);
searchRequest.setTypesOnly(false);
searchRequest.addAttributes("telephonenumber","sn");
SearchCursor cursor = myConnection.search(searchRequest);
while ( cursor.next() ){
Response resp = cursor.get();
// process the SearchResultEntry
if ( resp instanceof SearchResultEntry ){
org.apache.directory.api.ldap.model.entry.Entry resultEntry = ( ( SearchResultEntry ) resp ).getEntry();
Collection<Attribute> attr = resultEntry.getAttributes();
for (Attribute attribute : attr) {
System.out.println(attribute.getId());
System.out.println(attribute.getString());
}
}
}
cursor.close();