public static String getStringProperty( String name, String defaultValue ) { String value = Props.isInitialized() ? Props.getInstance().getProperty( name ) : null; if ( value == null ) { value = defaultValue; } return value; }
protected Props( int t ) { type = t; filename = getFilename(); init(); }
public void setValue( Boolean val ) { // just save it back into kettle Props.getInstance().setProperty( PDI_CHECK_VERSION_FLAG, val.toString() ); }
public Boolean getLastValue() { // the default is true String prop = Props.getInstance().getProperty( PDI_CHECK_VERSION_FLAG ); return prop == null ? true : new Boolean( prop ); }
@BeforeClass public static void init() throws Exception { KettleClientEnvironment.init(); PluginRegistry.addPluginType( StepPluginType.getInstance() ); PluginRegistry.init(); if ( !Props.isInitialized() ) { Props.init( 0 ); } }
public static final String getBusinessColumnIDPrefix() { return Props.getInstance().getCustomParameter( BUSINESS_COLUMN_ID_PREFIX, "bc_" ); //$NON-NLS-1$ }
public static final void setBusinessModelIDPrefix( String prefix ) { Props.getInstance().setCustomParameter( BUSINESS_MODEL_ID_PREFIX, prefix ); }
if ( Props.isInitialized() ) { props = Props.getInstance(); if ( props != null && props.areOnlyUsedConnectionsSavedToXML() ) { if ( usedDatabaseMetas.contains( dbMeta ) ) { retval.append( dbMeta.getXML() );
@Test public void testShouldOverwrite() { assertTrue( meta.shouldOverwrite( null, null, null, null ) ); Props.init( Props.TYPE_PROPERTIES_EMPTY ); assertTrue( meta.shouldOverwrite( null, Props.getInstance(), "message", "remember" ) ); Props.getInstance().setProperty( Props.STRING_ASK_ABOUT_REPLACING_DATABASES, "Y" ); OverwritePrompter prompter = mock( OverwritePrompter.class ); when( prompter.overwritePrompt( "message", "remember", Props.STRING_ASK_ABOUT_REPLACING_DATABASES ) ) .thenReturn( false ); assertFalse( meta.shouldOverwrite( prompter, Props.getInstance(), "message", "remember" ) ); }
boolean ignoreRepositorySharedObjects, OverwritePrompter prompter ) throws KettleXMLException { Props props = null; if ( Props.isInitialized() ) { props = Props.getInstance();
@BeforeClass public static void initKettle() throws Exception { if ( Props.isInitialized() ) { Props.getInstance().setOnlyUsedConnectionsSavedToXML( false ); } KettleEnvironment.init(); }
String[] saved = Props.isInitialized() ? Props.getInstance().getLastArguments() : null;
this.needToCheckPathForVariables = "N".equalsIgnoreCase( importPathCompatibility ); askReplace = Props.getInstance().askAboutReplacingDatabaseConnections(); Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_CS, "Y" ); Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_DB, "Y" ); Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_PS, "Y" ); Props.getInstance().setProperty( IMPORT_ASK_ABOUT_REPLACE_SS, "Y" ); this.overwritePrompter = ( (HasOverwritePrompter) feedback ).getOverwritePrompter(); } else { final boolean replaceExisting = Props.getInstance().replaceExistingDatabaseConnections(); this.overwritePrompter = new OverwritePrompter() {
void cleanUp() { KettleClientEnvironment.reset(); PluginRegistry.getInstance().reset(); MetricsRegistry.getInstance().reset(); ExtensionPointMap.getInstance().reset(); if ( KettleLogStore.isInitialized() ) { KettleLogStore.getInstance().reset(); } KettleLogStore.setLogChannelInterfaceFactory( new LogChannelFactory() ); if ( Props.isInitialized() ) { Props.getInstance().reset(); } KettleVFS.getInstance().reset(); XMLHandlerCache.getInstance().clear(); ValueMetaFactory.pluginRegistry = PluginRegistry.getInstance(); // under no circumstance reset the LoggingRegistry // LoggingRegistry.getInstance().reset(); }
private boolean getHistoryData( final int index, final Mode mode ) { final int BATCH_SIZE = Props.getInstance().getLinesInHistoryFetchSize(); boolean moreRows = false; JobHistoryLogTab model = models[index]; case ALL: model.batchCount = 0; queryLimit = Props.getInstance().getMaxNrLinesInHistory(); break; case NEXT_BATCH:
transGraph.extraViewTabFolder.setSelection( transHistoryTab ); if ( !Props.getInstance().disableInitialExecutionHistory() ) { refreshAllHistory();
protected boolean shouldOverwrite( OverwritePrompter prompter, Props props, String message, String rememberMessage ) { boolean askOverwrite = Props.isInitialized() ? props.askAboutReplacingDatabaseConnections() : false; boolean overwrite = Props.isInitialized() ? props.replaceExistingDatabaseConnections() : true; if ( askOverwrite ) { if ( prompter != null ) { overwrite = prompter.overwritePrompt( message, rememberMessage, Props.STRING_ASK_ABOUT_REPLACING_DATABASES ); } } return overwrite; }
protected Props() { init(); }
@Override public boolean overwritePrompt( String message, String rememberText, String rememberPropertyName ) { Object[] res = messageDialogWithToggle( "Warning", null, message, Const.WARNING, new String[] { BaseMessages.getString( Spoon.class, "System.Button.Yes" ), BaseMessages.getString( Spoon.class, "System.Button.No" ) }, 1, rememberText, !"Y".equalsIgnoreCase( props .getProperty( rememberPropertyName ) ) ); int idx = ( (Integer) res[0] ).intValue(); boolean overwrite = ( ( idx & 0xFF ) == 0 ); boolean toggleState = ( (Boolean) res[1] ).booleanValue(); props.setProperty( rememberPropertyName, ( !toggleState ) ? "Y" : "N" ); return overwrite; }
public void connect() { NamedCluster nc = getNamedClusterWidget().getSelectedNamedCluster(); HadoopVfsConnection hdfsConnection = new HadoopVfsConnection( nc, getVariableSpace() ); hdfsConnection.setCustomParameters( Props.getInstance() ); // The Named Cluster may be hdfs, maprfs or wasb. We need to detect it here since the named // cluster was just selected. //schemeName = "wasb".equals( nc.getStorageScheme() ) ? "wasb" : "hdfs"; String connectionString = Schemes.NAMED_CLUSTER_SCHEME + "://" + nc.getName(); FileSystemOptions fsoptions = new FileSystemOptions(); FileObject root = rootFile; try { root = KettleVFS.getFileObject( connectionString, fsoptions ); } catch ( KettleFileException exc ) { showMessageAndLog( BaseMessages.getString( PKG, "HadoopVfsFileChooserDialog.error" ), BaseMessages.getString( PKG, "HadoopVfsFileChooserDialog.Connection.error" ), exc.getMessage() ); } vfsFileChooserDialog.setRootFile( root ); vfsFileChooserDialog.setSelectedFile( root ); rootFile = root; }