Java Code Examples for org.pentaho.di.core.Const#getEnvironmentVariable()

The following examples show how to use org.pentaho.di.core.Const#getEnvironmentVariable() . 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: HTTPPOSTDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 2
Source File: XMLJoinDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    } else {
      wEncoding.select( Const.indexOfString( "UTF-8", wEncoding.getItems() ) );
    }
  }
}
 
Example 3
Source File: XMLOutputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 4
Source File: TextFileInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( Charset charSet : values ) {
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 5
Source File: ExcelInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();

    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 6
Source File: TextFileInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<>( Charset.availableCharsets().values() );
    for ( Charset charSet : values ) {
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 7
Source File: CsvInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 8
Source File: RssOutputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 9
Source File: ExcelOutputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 10
Source File: PurRepositoryExporter.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
/**
 * Set the batch size for fetching objects from the repository.
 */
private void initBatchSize() {
  batchSize = DEFAULT_BATCH_SIZE;
  String batchProp = Const.getEnvironmentVariable( REPOSITORY_BATCH_SIZE_PROPERTY, null );
  boolean err = false;
  if ( !Utils.isEmpty( batchProp ) ) {
    try {
      batchSize = Integer.parseInt( batchProp );
      if ( batchSize < 1 ) {
        err = true;
      }
    } catch ( Exception ex ) {
      err = true;
    }
  }
  if ( err ) {
    batchSize = DEFAULT_BATCH_SIZE;
    log.logError( BaseMessages.getString( PKG, "PurRepositoryExporter.ERROR_INVALID_BATCH_SIZE",
        REPOSITORY_BATCH_SIZE_PROPERTY, batchProp, batchSize ), err ); //$NON-NLS-1$
  }
  log.logDetailed( BaseMessages.getString( PKG, "PurRepositoryExporter.DETAILED_USED_BATCH_SIZE", batchSize ) ); //$NON-NLS-1$
}
 
Example 11
Source File: ParGzipCsvInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 12
Source File: TextFileOutputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 13
Source File: PropertyInputDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    ArrayList<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", PropertyInputMeta.DEFAULT_ENCODING );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 14
Source File: HTTPDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 15
Source File: MailDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    ArrayList<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 16
Source File: ConcatFieldsDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 17
Source File: AddXMLDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( int i = 0; i < values.size(); i++ ) {
      Charset charSet = values.get( i );
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    } else {
      wEncoding.select( Const.indexOfString( "UTF-8", wEncoding.getItems() ) );
    }
  }
}
 
Example 18
Source File: JobEntryMailDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    java.util.List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( Charset charSet : values ) {
      wEncoding.add( charSet.displayName() );
    }

    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 19
Source File: JobEntryWriteToFileDialog.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void setEncodings() {
  // Encoding of the text file:
  if ( !gotEncodings ) {
    gotEncodings = true;

    wEncoding.removeAll();
    java.util.List<Charset> values = new ArrayList<Charset>( Charset.availableCharsets().values() );
    for ( Charset charSet : values ) {
      wEncoding.add( charSet.displayName() );
    }
    // Now select the default!
    String defEncoding = Const.getEnvironmentVariable( "file.encoding", "UTF-8" );
    int idx = Const.indexOfString( defEncoding, wEncoding.getItems() );
    if ( idx >= 0 ) {
      wEncoding.select( idx );
    }
  }
}
 
Example 20
Source File: OverlayPropertyHandler.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
protected boolean loadAltProps() {
  // check the -D switch... something like -Dorg.pentaho.di.laf.alt="somefile.properties"
  String altFile = Const.getEnvironmentVariable( "org.pentaho.di.laf.alt", null );
  if ( altFile != null ) {
    return loadProps( altFile );
  }
  return false;
}