public DatabaseMeta getDatabaseInfo() { if ( wURL.getText() != null && wURL.getText().length() > 0 ) { info.getAttributes().put( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_URL, wURL.getText() ); } if ( wDriverClass.getText() != null && wDriverClass.getText().length() > 0 ) { info.getAttributes().put( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS, wDriverClass.getText() ); } return info; }
public DatabaseMeta getDatabaseInfo() { if ( wHostname.getText() != null && wHostname.getText().length() > 0 ) { info.setHostname( wHostname.getText() ); } if ( wSAPLanguage.getText() != null && wSAPLanguage.getText().length() > 0 ) { info.getAttributes().put( SAPR3DatabaseMeta.ATTRIBUTE_SAP_LANGUAGE, wSAPLanguage.getText() ); } if ( wSAPSystemNumber.getText() != null && wSAPSystemNumber.getText().length() > 0 ) { info.getAttributes().put( SAPR3DatabaseMeta.ATTRIBUTE_SAP_SYSTEM_NUMBER, wSAPSystemNumber.getText() ); } if ( wSAPClient.getText() != null && wSAPClient.getText().length() > 0 ) { info.getAttributes().put( SAPR3DatabaseMeta.ATTRIBUTE_SAP_CLIENT, wSAPClient.getText() ); } return info; }
public void setData() { wHostname.setText( Const.NVL( info.getHostname(), "" ) ); wSAPLanguage.setText( Const.NVL( info.getAttributes().getProperty( SAPR3DatabaseMeta.ATTRIBUTE_SAP_LANGUAGE, "" ), "" ) ); wSAPSystemNumber.setText( Const.NVL( info.getAttributes().getProperty( SAPR3DatabaseMeta.ATTRIBUTE_SAP_SYSTEM_NUMBER, "" ), "" ) ); wSAPClient.setText( Const.NVL( info.getAttributes().getProperty( SAPR3DatabaseMeta.ATTRIBUTE_SAP_CLIENT, "" ), "" ) ); }
private StringBuilder appendConnectionInfo( StringBuilder report, Database db, DatabaseMeta databaseMeta ) { // Check to see if the interface is of a type GenericDatabaseMeta, since it does not have hostname and port fields if ( databaseMeta.getDatabaseInterface() instanceof GenericDatabaseMeta ) { String customUrl = databaseMeta.getAttributes().getProperty( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_URL ); String customDriverClass = databaseMeta.getAttributes().getProperty( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS ); return report.append( BaseMessages.getString( PKG, "GenericDatabaseMeta.report.customUrl" ) ).append( db.environmentSubstitute( customUrl ) ).append( Const.CR ).append( BaseMessages.getString( PKG, "GenericDatabaseMeta.report.customDriverClass" ) ).append( db.environmentSubstitute( customDriverClass ) ).append( Const.CR ); } return appendConnectionInfo( report, db.environmentSubstitute( databaseMeta.getHostname() ), db .environmentSubstitute( databaseMeta.getDatabasePortNumberString() ), db .environmentSubstitute( databaseMeta.getDatabaseName() ) ); }
public static SAPConnectionParams getFromDatabaseMeta( DatabaseMeta sapConnection ) { String name = sapConnection.getName(); String host = sapConnection.environmentSubstitute( sapConnection.getHostname() ); String sysnr = sapConnection.environmentSubstitute( sapConnection.getAttributes().getProperty( "SAPSystemNumber" ) ); String client = sapConnection.environmentSubstitute( sapConnection.getAttributes().getProperty( "SAPClient" ) ); String user = sapConnection.environmentSubstitute( sapConnection.getUsername() ); String password = sapConnection.environmentSubstitute( sapConnection.getPassword() ); String lang = ""; return new SAPConnectionParams( name, host, sysnr, client, user, password, lang ); } }
Set<Object> keySet = getAttributes().keySet(); for ( Object object : keySet ) { list.add( (String) object ); String attribute = getAttributes().getProperty( code ); if ( !Utils.isEmpty( attribute ) ) { retval.append( " <attribute>"
cp.getAttributes().setProperty( SAPR3DatabaseMeta.ATTRIBUTE_SAP_SYSTEM_NUMBER, "00" ); cp.getAttributes().setProperty( SAPR3DatabaseMeta.ATTRIBUTE_SAP_CLIENT, "100" ); cp.getAttributes().setProperty( SAPR3DatabaseMeta.ATTRIBUTE_SAP_LANGUAGE, "DE" ); sc.open( cp );
meta.getAttributes().put( "SAPLanguage", languageBox.getValue() ); meta.getAttributes().put( "SAPSystemNumber", systemNumberBox.getValue() ); meta.getAttributes().put( "SAPClient", clientBox.getValue() ); meta.getAttributes().put( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_URL, customUrlBox.getValue() ); .getAttributes() .put( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS, customDriverClassBox.getValue() ); meta.getAttributes().put( MSSQLServerNativeDatabaseMeta.ATTRIBUTE_USE_INTEGRATED_SECURITY, useIntegratedSecurity != null ? useIntegratedSecurity.toString() : "false" );
return false; Map<Object, Object> databaseMeta2Attributes = new HashMap<Object, Object>( databaseMeta2.getAttributes() ); for ( Entry<Object, Object> databaseMetaEntry : new HashMap<Object, Object>( databaseMeta.getAttributes() ) .entrySet() ) { Object value = databaseMeta2Attributes.remove( databaseMetaEntry.getKey() );
Properties attributes = databaseMeta.getAttributes(); Enumeration<Object> keys = databaseMeta.getAttributes().keys(); while ( keys.hasMoreElements() ) { String code = (String) keys.nextElement();
languageBox.setValue( meta.getAttributes().getProperty( "SAPLanguage" ) ); systemNumberBox.setValue( meta.getAttributes().getProperty( "SAPSystemNumber" ) ); clientBox.setValue( meta.getAttributes().getProperty( "SAPClient" ) ); customUrlBox.setValue( meta.getAttributes().getProperty( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_URL ) ); customDriverClassBox.setValue( meta.getAttributes().getProperty( GenericDatabaseMeta.ATRRIBUTE_CUSTOM_DRIVER_CLASS ) ); Object value = meta.getAttributes().get( MSSQLServerNativeDatabaseMeta.ATTRIBUTE_USE_INTEGRATED_SECURITY ); if ( value != null && value instanceof String ) { String useIntegratedSecurity = (String) value;
if ( meta.getAttributes().containsKey( EXTRA_OPTION_WEB_APPLICATION_NAME ) ) { meta.setDBName( (String) meta.getAttributes().get( EXTRA_OPTION_WEB_APPLICATION_NAME ) ); meta.getAttributes().remove( EXTRA_OPTION_WEB_APPLICATION_NAME ); meta.setChanged();
list.add( r ); Enumeration<Object> keys = getAttributes().keys(); while ( keys.hasMoreElements() ) { String key = (String) keys.nextElement(); String value = getAttributes().getProperty( key ); r = new RowMetaAndData(); r.addValue( par, ValueMetaInterface.TYPE_STRING, "Extra attribute [" + key + "]" );
public void dataNodeToElement( final DataNode rootNode, final RepositoryElementInterface element ) throws KettleException { DatabaseMeta databaseMeta = (DatabaseMeta) element; databaseMeta.setDatabaseType( getString( rootNode, PROP_TYPE ) ); databaseMeta.setAccessType( DatabaseMeta.getAccessType( getString( rootNode, PROP_CONTYPE ) ) ); databaseMeta.setHostname( getString( rootNode, PROP_HOST_NAME ) ); databaseMeta.setDBName( getString( rootNode, PROP_DATABASE_NAME ) ); databaseMeta.setDBPort( getString( rootNode, PROP_PORT ) ); databaseMeta.setUsername( getString( rootNode, PROP_USERNAME ) ); databaseMeta.setPassword( Encr.decryptPasswordOptionallyEncrypted( getString( rootNode, PROP_PASSWORD ) ) ); databaseMeta.setServername( getString( rootNode, PROP_SERVERNAME ) ); databaseMeta.setDataTablespace( getString( rootNode, PROP_DATA_TBS ) ); databaseMeta.setIndexTablespace( getString( rootNode, PROP_INDEX_TBS ) ); // Also, load all the properties we can find... DataNode attrNode = rootNode.getNode( NODE_ATTRIBUTES ); for ( DataProperty property : attrNode.getProperties() ) { String code = property.getName(); String attribute = property.getString(); // We need to unescape the code as it was escaped to handle characters that JCR does not handle String unescapeCode = RepositoryFilenameUtils.unescape( code ); databaseMeta.getAttributes().put( unescapeCode, Const.NVL( attribute, "" ) ); //$NON-NLS-1$ } }
Properties attributes = databaseMeta.getAttributes(); Enumeration<Object> keys = databaseMeta.getAttributes().keys(); while ( keys.hasMoreElements() ) { String code = (String) keys.nextElement();
String code = row.getString( KettleDatabaseRepository.FIELD_DATABASE_ATTRIBUTE_CODE, "" ); String attribute = row.getString( KettleDatabaseRepository.FIELD_DATABASE_ATTRIBUTE_VALUE_STR, "" ); databaseMeta.getAttributes().put( code, Const.NVL( attribute, "" ) );
Properties attributes = databaseMeta.getAttributes(); for ( IMetaStoreAttribute attr : attributesChild.getChildren() ) { String code = attr.getId();
insertDatabaseAttributes( databaseMeta.getObjectId(), databaseMeta.getAttributes() ); } catch ( KettleDatabaseException dbe ) { throw new KettleException(
public static SqlDataSource convertFromLegacy( DatabaseMeta database ) { SqlDataSource dataSource = new SqlDataSource(); dataSource.setDialectType( database.getDatabaseTypeDesc() ); dataSource.setDatabaseName( database.environmentSubstitute( database.getDatabaseName() ) ); dataSource.setHostname( database.environmentSubstitute( database.getHostname() ) ); dataSource.setPort( database.environmentSubstitute( database.getDatabasePortNumberString() ) ); dataSource.setUsername( database.environmentSubstitute( database.getUsername() ) ); dataSource.setPassword( database.environmentSubstitute( database.getPassword() ) ); dataSource.setServername( database.environmentSubstitute( database.getServername() ) ); if ( database.getAccessType() == DatabaseMeta.TYPE_ACCESS_JNDI ) { dataSource.setType( DataSourceType.values()[database.getAccessType()] ); } else if ( database.getAccessType() == DatabaseMeta.TYPE_ACCESS_NATIVE ) { dataSource.setType( DataSourceType.NATIVE ); } // And now load the attributes... if ( database.getAttributes() != null ) { for ( Object key : database.getAttributes().keySet() ) { dataSource.getAttributes().put( (String) key, database.environmentSubstitute( (String) database.getAttributes().get( key ) ) ); } } return dataSource; }
public static DatabaseMeta convertToLegacy( String name, SqlDataSource datasource ) { // make sure that the Kettle environment is initialized before DatabaseMeta creation try { KettleEnvironment.init( false ); } catch ( KettleException e ) { logger.error( "Error initializing the Kettle Environment", e ); throw new RuntimeException( "Error initializing the Kettle Environment", e ); } DatabaseMeta databaseMeta = new DatabaseMeta(); databaseMeta.setName( name ); databaseMeta.setHostname( datasource.getHostname() ); if ( datasource.getDialectType() == null ) { // default to mysql if dialect is null databaseMeta.setDatabaseType( "GENERIC" ); //$NON-NLS-1$ } else { databaseMeta.setDatabaseType( datasource.getDialectType() ); } databaseMeta.setAccessType( DatabaseMeta.getAccessType( datasource.getType().toString() ) ); databaseMeta.setDBName( datasource.getDatabaseName() ); databaseMeta.setDBPort( datasource.getPort() ); databaseMeta.setUsername( datasource.getUsername() ); databaseMeta.setPassword( datasource.getPassword() ); databaseMeta.setServername( datasource.getServername() ); // And now load the attributes... for ( String key : datasource.getAttributes().keySet() ) { databaseMeta.getAttributes().put( key, datasource.getAttributes().get( key ) ); } return databaseMeta; }