Java Code Examples for org.pentaho.di.core.Props#isInitialized()

The following examples show how to use org.pentaho.di.core.Props#isInitialized() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RestorePDIEnvironment.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
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();
  }
 
Example 2
Source File: SQLModelGenerator.java    From pentaho-metadata with GNU Lesser General Public License v2.1 6 votes vote down vote up
public SQLModelGenerator( String modelName, String connectionName, int[] columnTypes, String[] columnNames,
    String query, Boolean securityEnabled, List<String> users, List<String> roles, int defaultAcls, String createdBy ) {
  if ( !Props.isInitialized() ) {
    Props.init( Props.TYPE_PROPERTIES_EMPTY );
  }
  this.query = query;
  this.connectionName = connectionName;
  this.columnTypes = columnTypes;
  this.columnNames = columnNames;
  this.modelName = modelName;
  this.securityEnabled = securityEnabled;
  this.users = users;
  this.roles = roles;
  this.defaultAcls = defaultAcls;
  this.createdBy = createdBy;
}
 
Example 3
Source File: JobEntryJobIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 4
Source File: JmsConsumerMetaTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
  StepPluginType.getInstance().handlePluginAnnotation(
    JmsConsumerMeta.class,
    JmsConsumerMeta.class.getAnnotation( org.pentaho.di.core.annotations.Step.class ),
    Collections.emptyList(), false, null );
}
 
Example 5
Source File: TransMetaConverterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 6
Source File: TransWebSocketEngineAdapterTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 7
Source File: JobMetaPrivateDbTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void initKettle() throws Exception {
  if ( Props.isInitialized() ) {
    Props.getInstance().setOnlyUsedConnectionsSavedToXML( false );
  }
  KettleEnvironment.init();
}
 
Example 8
Source File: SafeStopTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 9
Source File: TextFileInputIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void init() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 10
Source File: PropertyOutputIT.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
}
 
Example 11
Source File: MQTTConsumerTest.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setupClass() throws Exception {
  KettleClientEnvironment.init();
  PluginRegistry.addPluginType( StepPluginType.getInstance() );
  PluginRegistry.init();
  if ( !Props.isInitialized() ) {
    Props.init( 0 );
  }
  StepPluginType.getInstance().handlePluginAnnotation(
    MQTTConsumerMeta.class,
    MQTTConsumerMeta.class.getAnnotation( org.pentaho.di.core.annotations.Step.class ),
    Collections.emptyList(), false, null );
}
 
Example 12
Source File: AutoModeler.java    From pentaho-metadata with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * @param locale
 * @param modelName
 * @param databaseMeta
 * @param tableNames
 */
public AutoModeler( String locale, String modelName, DatabaseMeta databaseMeta, SchemaTable[] tableNames ) {
  this.locale = locale;
  this.modelName = modelName;
  this.databaseMeta = databaseMeta;
  this.tableNames = tableNames;

  if ( !Props.isInitialized() ) {
    Props.init( Props.TYPE_PROPERTIES_EMPTY );
  }
}
 
Example 13
Source File: MonetDBAgileMartMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static long getLongProperty( String name, long defaultValue ) {

    String valueStr = Props.isInitialized() ? Props.getInstance().getProperty( name ) : null;
    try {
      long value = Long.parseLong( valueStr );
      return value;
    } catch ( NumberFormatException e ) {
      // the value for this property is not a valid number
    }
    return defaultValue;
  }
 
Example 14
Source File: MonetDBAgileMartMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static String getStringProperty( String name, String defaultValue ) {

    String value = Props.isInitialized() ? Props.getInstance().getProperty( name ) : null;
    if ( value == null ) {
      value = defaultValue;
    }
    return value;

  }
 
Example 15
Source File: TableAgileMartMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static long getLongProperty( String name, long defaultValue ) {

    String valueStr = Props.isInitialized() ? Props.getInstance().getProperty( name ) : null;
    try {
      long value = Long.parseLong( valueStr );
      return value;
    } catch ( NumberFormatException e ) {
      // the value for this property is not a valid number
    }
    return defaultValue;
  }
 
Example 16
Source File: TableAgileMartMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public static String getStringProperty( String name, String defaultValue ) {

    String value = Props.isInitialized() ? Props.getInstance().getProperty( name ) : null;
    if ( value == null ) {
      value = defaultValue;
    }
    return value;

  }
 
Example 17
Source File: AbstractMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 18
Source File: SQLModelGeneratorIT.java    From pentaho-metadata with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testToLegacy() throws ObjectAlreadyExistsException {
  if ( !Props.isInitialized() ) {
    Props.init( Props.TYPE_PROPERTIES_EMPTY );
  }
  SchemaMeta meta = ThinModelConverter.convertToLegacy( domain );
  String locale = Locale.getDefault().toString();
  // verify conversion worked.
  BusinessModel model = meta.findModel( "MODEL_1" );
  assertNotNull( model );
  String local = model.getName( locale );
  assertEquals( "newdatasource", model.getName( locale ) );
  BusinessCategory cat =  model.getRootCategory().findBusinessCategory( Settings.getBusinessCategoryIDPrefix() + "newdatasource" );
  assertNotNull( cat );
  assertEquals( "newdatasource", cat.getName( locale ) );
  assertEquals( 1, cat.getBusinessColumns().size() );
  // this tests the inheritance of physical cols made it through
  BusinessColumn col = cat.getBusinessColumn( 0 );
  assertEquals( "CUSTOMERNAME", col.getName( locale ) );
  assertNotNull( col.getBusinessTable() );
  assertEquals( "LOGICAL_TABLE_1", col.getBusinessTable().getId() );
  assertEquals( col.getDataType(), DataTypeSettings.STRING );
  assertEquals( "select customername from customers where customernumber < 171", col.getBusinessTable().getTargetTable() );
  assertEquals( "select customername from customers where customernumber < 171", col.getPhysicalColumn().getTable().getTargetTable() );
  assertEquals( "CUSTOMERNAME", col.getPhysicalColumn().getFormula() );
  assertEquals( false, col.getPhysicalColumn().isExact() );
}
 
Example 19
Source File: SQLModelGenerator.java    From pentaho-metadata with GNU Lesser General Public License v2.1 4 votes vote down vote up
public SQLModelGenerator() {
  super();
  if ( !Props.isInitialized() ) {
    Props.init( Props.TYPE_PROPERTIES_EMPTY );
  }
}
 
Example 20
Source File: InlineEtlModelGenerator.java    From pentaho-metadata with GNU Lesser General Public License v2.1 4 votes vote down vote up
public InlineEtlModelGenerator() {
  if ( !Props.isInitialized() ) {
    Props.init( Props.TYPE_PROPERTIES_EMPTY );
  }
}