private static String ENTRYDN = null;
final static String[] attrNames = { "sn", "mobile", "mail", "cn" };
private static LDAPConnection getConnection() {
DODataSource dss1 = DODataSource.parseConfigHelper("/ds_ldap_url.xml",
"ds_ldap_url");
String dn = dss1.getUserName();
if (dn != null && dn.trim().length() > 0)
if (dn.trim().substring(0, 1).matches("^\\W$"))
ENTRYDN = dn.trim().substring(1);
else
ENTRYDN = dn.trim();
String MY_URL = dss1.getDriverUrl();
if (MY_URL != null && MY_URL.trim().length() > 0) {
if (MY_URL.trim().contains("//")
&& MY_URL.trim().substring(MY_URL.trim().length() - 1).equals("/"))
MY_URL = MY_URL.trim().substring(MY_URL.trim().indexOf("//")+2,
MY_URL.trim().length() - 1);
else if (MY_URL.trim().contains("//")
&& !MY_URL.trim().substring(MY_URL.trim().length() - 1).equals("/"))
MY_URL = MY_URL.trim().substring(MY_URL.trim().indexOf("//")+2);
}
DODataSource dss2 = DODataSource.parseConfigHelper("/ds_ldap.xml",
"ds_ldap");
final String MY_USER = dss2.getUserName();
final String password = dss2.getPassword();
String url = dss2.getDriverUrl();
String sPort1 = null;
if (MY_URL.substring(MY_URL.length() - 1).equals("/"))
sPort1 = url.substring(url.indexOf(MY_URL.substring(0, MY_URL
.lastIndexOf("/")))
+ MY_URL.length());