Search in sources :

Example 6 with JdbcDataSource

use of com.centurylink.mdw.plugin.project.model.JdbcDataSource in project mdw-designer by CenturyLinkCloud.

the class DataSourcePage method createDbPasswordControls.

private void createDbPasswordControls(Composite parent, int ncol) {
    new Label(parent, SWT.NONE).setText("DB Password:");
    dbPasswordTextField = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 200;
    gd.horizontalSpan = ncol - 1;
    dbPasswordTextField.setLayoutData(gd);
    dbPasswordTextField.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            JdbcDataSource dataSource = getDataSource();
            if (dataSource != null)
                dataSource.setDbPassword(dbPasswordTextField.getText().trim());
            handleFieldChanged();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) JdbcDataSource(com.centurylink.mdw.plugin.project.model.JdbcDataSource) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 7 with JdbcDataSource

use of com.centurylink.mdw.plugin.project.model.JdbcDataSource in project mdw-designer by CenturyLinkCloud.

the class DataSourcePage method initValues.

@Override
public void initValues() {
    String prevDriver = "";
    String prevUrl = "";
    String prevUser = "";
    if (!getProject().isRemote()) {
        String prefix = "MDW" + getProject().getMdwVersion();
        prevDriver = MdwPlugin.getStringPref(prefix + "-" + ProjectPersist.MDW_DB_DRIVER);
        prevUrl = MdwPlugin.getStringPref(prefix + "-" + ProjectPersist.MDW_DB_URL);
        prevUser = MdwPlugin.getStringPref(prefix + "-" + ProjectPersist.MDW_DB_USER);
    }
    boolean isMdw6 = getProject().checkRequiredVersion(6, 0);
    JdbcDataSource dataSource = getDataSource();
    if (dataSource != null) {
        if (isMdw6)
            dataSource.setDriver(JdbcDataSource.DEFAULT_DRIVER_MDW6);
        else if (prevDriver.length() > 0)
            dataSource.setDriver(prevDriver);
        else
            dataSource.setDriver(JdbcDataSource.DEFAULT_DRIVER);
        driverComboBox.setText(dataSource.getDriver());
        if (isMdw6)
            dataSource.setJdbcUrl(JdbcDataSource.DEFAULT_JDBC_URL_MDW6);
        else if (prevUrl.length() > 0)
            dataSource.setJdbcUrl(prevUrl);
        else
            dataSource.setJdbcUrl(JdbcDataSource.DEFAULT_JDBC_URL);
        jdbcUrlTextField.setText(dataSource.getJdbcUrl());
        if (isMdw6) {
            dataSource.setDbUser(JdbcDataSource.DEFAULT_DB_USER_OLD);
            dataSource.setDbPassword(JdbcDataSource.DEFAULT_DB_PASSWORD_OLD);
        } else if (prevUser.length() > 0) {
            dataSource.setDbUser(prevUser);
        } else {
            dataSource.setDbUser(JdbcDataSource.DEFAULT_DB_USER);
            dataSource.setDbPassword(JdbcDataSource.DEFAULT_DB_PASSWORD);
            if (!getProject().isRemote() && !getProject().checkRequiredVersion(5, 5)) {
                // triggers server call to retrieve mdw version -- not for
                // remote
                dataSource.setDbUser(JdbcDataSource.DEFAULT_DB_USER_OLD);
                dataSource.setDbPassword(JdbcDataSource.DEFAULT_DB_PASSWORD_OLD);
            }
        }
        dbUserTextField.setText(dataSource.getDbUser());
        if (prevUser.length() == 0)
            dbPasswordTextField.setText(dataSource.getDbPassword());
    }
}
Also used : JdbcDataSource(com.centurylink.mdw.plugin.project.model.JdbcDataSource)

Example 8 with JdbcDataSource

use of com.centurylink.mdw.plugin.project.model.JdbcDataSource in project mdw-designer by CenturyLinkCloud.

the class DataSourcePage method createJdbcUrlControls.

private void createJdbcUrlControls(Composite parent, int ncol) {
    new Label(parent, SWT.NONE).setText("JDBC URL:");
    jdbcUrlTextField = new Text(parent, SWT.SINGLE | SWT.BORDER);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 400;
    gd.horizontalSpan = ncol - 1;
    jdbcUrlTextField.setLayoutData(gd);
    jdbcUrlTextField.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            JdbcDataSource dataSource = getDataSource();
            if (dataSource != null)
                dataSource.setJdbcUrl(jdbcUrlTextField.getText().trim());
            handleFieldChanged();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) JdbcDataSource(com.centurylink.mdw.plugin.project.model.JdbcDataSource) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Example 9 with JdbcDataSource

use of com.centurylink.mdw.plugin.project.model.JdbcDataSource in project mdw-designer by CenturyLinkCloud.

the class DataSourcePage method createDriverControls.

private void createDriverControls(Composite parent, int ncol) {
    new Label(parent, SWT.NONE).setText("Driver:");
    driverComboBox = new Combo(parent, SWT.DROP_DOWN);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.horizontalSpan = ncol - 1;
    gd.widthHint = 200;
    driverComboBox.setLayoutData(gd);
    driverComboBox.removeAll();
    for (int i = 0; i < JdbcDataSource.JDBC_DRIVERS.length; i++) driverComboBox.add(JdbcDataSource.JDBC_DRIVERS[i]);
    driverComboBox.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            String driver = driverComboBox.getText();
            JdbcDataSource dataSource = getDataSource();
            if (dataSource != null)
                dataSource.setDriver(driver);
            handleFieldChanged();
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) JdbcDataSource(com.centurylink.mdw.plugin.project.model.JdbcDataSource) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Combo(org.eclipse.swt.widgets.Combo)

Example 10 with JdbcDataSource

use of com.centurylink.mdw.plugin.project.model.JdbcDataSource in project mdw-designer by CenturyLinkCloud.

the class DataSourcePage method createDbUserControls.

private void createDbUserControls(Composite parent, int ncol) {
    new Label(parent, SWT.NONE).setText("DB User:");
    dbUserTextField = new Text(parent, SWT.SINGLE | SWT.BORDER);
    GridData gd = new GridData(GridData.BEGINNING);
    gd.widthHint = 200;
    gd.horizontalSpan = ncol - 1;
    dbUserTextField.setLayoutData(gd);
    dbUserTextField.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            JdbcDataSource dataSource = getDataSource();
            if (dataSource != null)
                dataSource.setDbUser(dbUserTextField.getText().trim());
            handleFieldChanged();
        }
    });
}
Also used : ModifyEvent(org.eclipse.swt.events.ModifyEvent) ModifyListener(org.eclipse.swt.events.ModifyListener) JdbcDataSource(com.centurylink.mdw.plugin.project.model.JdbcDataSource) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) Text(org.eclipse.swt.widgets.Text)

Aggregations

JdbcDataSource (com.centurylink.mdw.plugin.project.model.JdbcDataSource)11 GridData (org.eclipse.swt.layout.GridData)4 Label (org.eclipse.swt.widgets.Label)4 ServerSettings (com.centurylink.mdw.plugin.project.model.ServerSettings)3 ModifyEvent (org.eclipse.swt.events.ModifyEvent)3 ModifyListener (org.eclipse.swt.events.ModifyListener)3 Text (org.eclipse.swt.widgets.Text)3 MDWException (com.centurylink.mdw.common.exception.MDWException)1 DataAccessOfflineException (com.centurylink.mdw.dataaccess.DataAccessOfflineException)1 DataUnavailableException (com.centurylink.mdw.designer.DataUnavailableException)1 ActivityImpl (com.centurylink.mdw.plugin.designer.model.ActivityImpl)1 AutomatedTestCase (com.centurylink.mdw.plugin.designer.model.AutomatedTestCase)1 WorkflowPackage (com.centurylink.mdw.plugin.designer.model.WorkflowPackage)1 VcsRepository (com.centurylink.mdw.plugin.project.model.VcsRepository)1 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 GeneralSecurityException (java.security.GeneralSecurityException)1 HashMap (java.util.HashMap)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1