use of org.pentaho.di.trans.steps.ldapinput.LDAPConnection in project pentaho-kettle by pentaho.
the class LDAPOutputDialog method test.
private void test() {
LDAPConnection connection = null;
try {
LDAPOutputMeta meta = new LDAPOutputMeta();
getInfo(meta);
// Defined a LDAP connection
connection = new LDAPConnection(log, transMeta, meta, null);
// connect...
if (wusingAuthentication.getSelection()) {
connection.connect(transMeta.environmentSubstitute(meta.getUserName()), Encr.decryptPasswordOptionallyEncrypted(transMeta.environmentSubstitute(meta.getPassword())));
} else {
connection.connect();
}
// We are successfully connected
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
mb.setMessage(BaseMessages.getString(PKG, "LDAPOutputDialog.Connected.OK") + Const.CR);
mb.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Connected.Title.Ok"));
mb.open();
} catch (Exception e) {
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "LDAPOutputDialog.Connected.NOK", e.getMessage()));
mb.setText(BaseMessages.getString(PKG, "LDAPOutputDialog.Connected.Title.Error"));
mb.open();
} finally {
if (connection != null) {
// Disconnect ...
try {
connection.close();
} catch (Exception e) {
/* Ignore */
}
}
}
}
Aggregations