Search in sources :

Example 1 with GenericDatabaseMeta

use of org.pentaho.di.core.database.GenericDatabaseMeta in project pentaho-kettle by pentaho.

the class CreateDatabaseWizardPage1 method getNextPage.

/*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.wizard.WizardPage#getNextPage()
   */
public IWizardPage getNextPage() {
    IWizard wiz = getWizard();
    IWizardPage nextPage;
    switch(databaseMeta.getAccessType()) {
        case DatabaseMeta.TYPE_ACCESS_OCI:
            // OCI
            nextPage = wiz.getPage("oci");
            break;
        case DatabaseMeta.TYPE_ACCESS_ODBC:
            // ODBC
            nextPage = wiz.getPage("odbc");
            break;
        case DatabaseMeta.TYPE_ACCESS_PLUGIN:
            // e.g. SAPR3
            nextPage = wiz.getPage(databaseMeta.getPluginId());
            break;
        default:
            // Generic or Native
            if (databaseMeta.getDatabaseInterface() instanceof GenericDatabaseMeta) {
                // Generic
                // generic
                nextPage = wiz.getPage("generic");
            } else {
                // Native
                nextPage = wiz.getPage("jdbc");
                if (nextPage != null) {
                    // Set the port number...
                    ((CreateDatabaseWizardPageJDBC) nextPage).setData();
                }
            }
            break;
    }
    return nextPage;
}
Also used : GenericDatabaseMeta(org.pentaho.di.core.database.GenericDatabaseMeta) IWizard(org.eclipse.jface.wizard.IWizard) IWizardPage(org.eclipse.jface.wizard.IWizardPage)

Example 2 with GenericDatabaseMeta

use of org.pentaho.di.core.database.GenericDatabaseMeta in project pentaho-kettle by pentaho.

the class DataHandler method setConnectionSpecificInfo.

private void setConnectionSpecificInfo(DatabaseMeta meta) {
    getControls();
    if (databaseDialectList != null) {
        databaseDialectList.setElements(databaseDialects);
        DatabaseInterface databaseInterface = meta.getDatabaseInterface();
        if (databaseInterface instanceof GenericDatabaseMeta) {
            databaseDialectList.setSelectedItem(((GenericDatabaseMeta) databaseInterface).getDatabaseDialect());
        }
    }
    if (hostNameBox != null) {
        hostNameBox.setValue(meta.getHostname());
    }
    // Database name:
    if (databaseNameBox != null) {
        databaseNameBox.setValue(meta.getDatabaseName());
    }
    // Username:
    if (userNameBox != null) {
        userNameBox.setValue(meta.getUsername());
    }
    // Password:
    if (passwordBox != null) {
        passwordBox.setValue(meta.getPassword());
    }
    // Streaming result cursor:
    if (resultStreamingCursorCheck != null) {
        resultStreamingCursorCheck.setChecked(meta.isStreamingResults());
    }
    // Data tablespace:
    if (dataTablespaceBox != null) {
        dataTablespaceBox.setValue(meta.getDataTablespace());
    }
    // Index tablespace
    if (indexTablespaceBox != null) {
        indexTablespaceBox.setValue(meta.getIndexTablespace());
    }
    // Strict Number(38) interpretation
    if (strictBigNumberInterpretaion != null) {
        // Check if oracle
        if (meta.getDatabaseInterface() instanceof OracleDatabaseMeta) {
            strictBigNumberInterpretaion.setVisible(true);
            strictBigNumberInterpretaion.setChecked(((OracleDatabaseMeta) meta.getDatabaseInterface()).strictBigNumberInterpretation());
        } else {
            strictBigNumberInterpretaion.setVisible(false);
            strictBigNumberInterpretaion.setChecked(false);
        }
    }
    if (serverInstanceBox != null) {
        serverInstanceBox.setValue(meta.getSQLServerInstance());
    }
    // SQL Server double decimal separator
    if (doubleDecimalSeparatorCheck != null) {
        doubleDecimalSeparatorCheck.setChecked(meta.isUsingDoubleDecimalAsSchemaTableSeparator());
    }
    // SAP Attributes...
    if (languageBox != null) {
        languageBox.setValue(meta.getAttributes().getProperty("SAPLanguage"));
    }
    if (systemNumberBox != null) {
        systemNumberBox.setValue(meta.getAttributes().getProperty("SAPSystemNumber"));
    }
    if (clientBox != null) {
        clientBox.setValue(meta.getAttributes().getProperty("SAPClient"));
    }
    // Generic settings...
    if (customUrlBox != null) {
        customUrlBox.setValue(meta.getAttributes().getProperty(GenericDatabaseMeta.ATRRIBUTE_CUSTOM_URL));
    }
    if (customDriverClassBox != null) {
        customDriverClassBox.setValue(meta.getAttributes().getProperty(GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS));
    }
    // Server Name: (Informix)
    if (serverNameBox != null) {
        serverNameBox.setValue(meta.getServername());
    }
    // Microsoft SQL Server Use Integrated Security
    if (useIntegratedSecurityCheck != null) {
        Object value = meta.getAttributes().get(MSSQLServerNativeDatabaseMeta.ATTRIBUTE_USE_INTEGRATED_SECURITY);
        if (value != null && value instanceof String) {
            String useIntegratedSecurity = (String) value;
            useIntegratedSecurityCheck.setChecked(Boolean.parseBoolean(useIntegratedSecurity));
        } else {
            useIntegratedSecurityCheck.setChecked(false);
        }
    }
    if (webAppName != null) {
        // Insert default value only for new connection, allowing it to be empty in case of editing existing one
        if (databaseMeta == null || Utils.isEmpty(databaseMeta.getDisplayName())) {
            webAppName.setValue(DEFAULT_WEB_APPLICATION_NAME);
        } else {
            webAppName.setValue(meta.getDatabaseName());
        }
    }
}
Also used : DatabaseInterface(org.pentaho.di.core.database.DatabaseInterface) OracleDatabaseMeta(org.pentaho.di.core.database.OracleDatabaseMeta) GenericDatabaseMeta(org.pentaho.di.core.database.GenericDatabaseMeta)

Example 3 with GenericDatabaseMeta

use of org.pentaho.di.core.database.GenericDatabaseMeta in project pentaho-kettle by pentaho.

the class DataHandler method getConnectionSpecificInfo.

private void getConnectionSpecificInfo(DatabaseMeta meta) {
    // Hostname:
    if (hostNameBox != null) {
        meta.setHostname(hostNameBox.getValue());
    }
    // Database name:
    if (databaseNameBox != null) {
        meta.setDBName(databaseNameBox.getValue());
    }
    // Username:
    if (userNameBox != null) {
        meta.setUsername(userNameBox.getValue());
    }
    // Password:
    if (passwordBox != null) {
        meta.setPassword(passwordBox.getValue());
    }
    if (databaseDialectList != null) {
        DatabaseInterface databaseInterface = meta.getDatabaseInterface();
        if (databaseInterface instanceof GenericDatabaseMeta) {
            ((GenericDatabaseMeta) databaseInterface).setDatabaseDialect(databaseDialectList.getValue());
        }
    }
    // Streaming result cursor:
    if (resultStreamingCursorCheck != null) {
        meta.setStreamingResults(resultStreamingCursorCheck.isChecked());
    }
    // Data tablespace:
    if (dataTablespaceBox != null) {
        meta.setDataTablespace(dataTablespaceBox.getValue());
    }
    // Index tablespace
    if (indexTablespaceBox != null) {
        meta.setIndexTablespace(indexTablespaceBox.getValue());
    }
    if (serverInstanceBox != null) {
        meta.setSQLServerInstance(serverInstanceBox.getValue());
        if (optionsParameterTree != null && optionsParameterTree.getRootChildren() != null) {
            for (int i = 0; i < optionsParameterTree.getRootChildren().getItemCount(); i++) {
                XulTreeItem potRow = optionsParameterTree.getRootChildren().getItem(i);
                if (potRow != null && potRow.getRow() != null) {
                    XulTreeCell cell = potRow.getRow().getCell(0);
                    XulTreeCell cell2 = potRow.getRow().getCell(1);
                    if (cell != null && cell.getLabel() != null && cell.getLabel().equals("instance")) {
                        cell2.setLabel(serverInstanceBox.getValue());
                        if (serverInstanceBox.getValue().trim().length() == 0) {
                            cell.setLabel("");
                        }
                    }
                }
            }
        }
    }
    // SQL Server double decimal separator
    if (doubleDecimalSeparatorCheck != null) {
        meta.setUsingDoubleDecimalAsSchemaTableSeparator(doubleDecimalSeparatorCheck.isChecked());
    }
    // SAP Attributes...
    if (languageBox != null) {
        meta.getAttributes().put("SAPLanguage", languageBox.getValue());
    }
    if (systemNumberBox != null) {
        meta.getAttributes().put("SAPSystemNumber", systemNumberBox.getValue());
    }
    if (clientBox != null) {
        meta.getAttributes().put("SAPClient", clientBox.getValue());
    }
    // Generic settings...
    if (customUrlBox != null) {
        meta.getAttributes().put(GenericDatabaseMeta.ATRRIBUTE_CUSTOM_URL, customUrlBox.getValue());
    }
    if (customDriverClassBox != null) {
        meta.getAttributes().put(GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS, customDriverClassBox.getValue());
    }
    // Server Name: (Informix)
    if (serverNameBox != null) {
        meta.setServername(serverNameBox.getValue());
    }
    // Microsoft SQL Server Use Integrated Security
    if (useIntegratedSecurityCheck != null) {
        Boolean useIntegratedSecurity = useIntegratedSecurityCheck.isChecked();
        meta.getAttributes().put(MSSQLServerNativeDatabaseMeta.ATTRIBUTE_USE_INTEGRATED_SECURITY, useIntegratedSecurity != null ? useIntegratedSecurity.toString() : "false");
    }
    if (webAppName != null) {
        meta.setDBName(webAppName.getValue());
    }
}
Also used : DatabaseInterface(org.pentaho.di.core.database.DatabaseInterface) XulTreeItem(org.pentaho.ui.xul.containers.XulTreeItem) XulTreeCell(org.pentaho.ui.xul.components.XulTreeCell) GenericDatabaseMeta(org.pentaho.di.core.database.GenericDatabaseMeta)

Aggregations

GenericDatabaseMeta (org.pentaho.di.core.database.GenericDatabaseMeta)3 DatabaseInterface (org.pentaho.di.core.database.DatabaseInterface)2 IWizard (org.eclipse.jface.wizard.IWizard)1 IWizardPage (org.eclipse.jface.wizard.IWizardPage)1 OracleDatabaseMeta (org.pentaho.di.core.database.OracleDatabaseMeta)1 XulTreeCell (org.pentaho.ui.xul.components.XulTreeCell)1 XulTreeItem (org.pentaho.ui.xul.containers.XulTreeItem)1