use of org.pentaho.di.trans.steps.ldapoutput.LDAPOutputMeta in project pentaho-kettle by pentaho.
the class LDAPOutputDialog method getLDAPFields.
public RowMetaInterface getLDAPFields() throws KettleException {
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()) {
String username = transMeta.environmentSubstitute(wUserName.getText());
String password = Encr.decryptPasswordOptionallyEncrypted(transMeta.environmentSubstitute(wPassword.getText()));
connection.connect(username, password);
} else {
connection.connect();
}
return connection.getFields(transMeta.environmentSubstitute(wBaseDN.getText()));
} finally {
if (connection != null) {
try {
connection.close();
} catch (Exception e) {
/* Ignore */
}
}
}
}
use of org.pentaho.di.trans.steps.ldapoutput.LDAPOutputMeta 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