/** * @param key * The key, the name of the environment variable to return * @return The value of a System environment variable in the java virtual machine. If the key is not present, the * variable is not defined and null returned. */ public static final String getSystemProperty( String key ) { return getSystemProperty( key, null ); }
private void loadSettings() throws IOException { Properties properties = new Properties(); FileInputStream fis = new FileInputStream( getSettingsFilename() ); try { properties.load( fis ); } finally { try { fis.close(); } catch ( IOException ignored ) { // Ignore closure exceptions } } String defaultLocaleStr = properties.getProperty( STRING_DEFAULT_LOCALE, Const.DEFAULT_LOCALE.toString() ); defaultLocale = EnvUtil.createLocale( defaultLocaleStr ); }
/** * Adds the kettle properties the the global system properties. * * @throws KettleException * in case the properties file can't be read. */ public static void environmentInit() throws KettleException { // Workaround for a Mac OS/X Leopard issue where getContextClassLoader() is returning // null when run from the eclipse IDE // http://lists.apple.com/archives/java-dev/2007/Nov/msg00385.html - DM // Moving this hack to the first place where the NPE is triggered so all entrypoints can be debugged in Mac Eclipse if ( Thread.currentThread().getContextClassLoader() == null ) { Thread.currentThread().setContextClassLoader( ClassLoader.getSystemClassLoader() ); } Map<Object, Object> kettleProperties = EnvUtil.readProperties( Const.KETTLE_PROPERTIES ); insertDefaultValues( kettleProperties ); applyKettleProperties( kettleProperties ); // Also put some default values for obscure environment variables in there... // Place-holders if you will. // System.getProperties().put( Const.INTERNAL_VARIABLE_CLUSTER_SIZE, "1" ); System.getProperties().put( Const.INTERNAL_VARIABLE_SLAVE_SERVER_NUMBER, "0" ); System.getProperties().put( Const.INTERNAL_VARIABLE_SLAVE_SERVER_NAME, "slave-trans-name" ); System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_COPYNR, "0" ); System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_NAME, "step-name" ); System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_PARTITION_ID, "partition-id" ); System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_PARTITION_NR, "0" ); System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_UNIQUE_COUNT, "1" ); System.getProperties().put( Const.INTERNAL_VARIABLE_STEP_UNIQUE_NUMBER, "0" ); }
/** * @return an array of strings, made up of all the environment variables available in the VM, format var=value. To be * used for Runtime.exec(cmd, envp) */ public static final String[] getEnvironmentVariablesForRuntimeExec() { Properties sysprops = new Properties(); sysprops.putAll( getEnv() ); sysprops.putAll( System.getProperties() ); addInternalVariables( sysprops ); String[] envp = new String[sysprops.size()]; List<Object> list = new ArrayList<Object>( sysprops.keySet() ); for ( int i = 0; i < list.size(); i++ ) { String var = (String) list.get( i ); String val = sysprops.getProperty( var ); envp[i] = var + "=" + val; } return envp; }
dateFormatLocale = null; } else { dateFormatLocale = EnvUtil.createLocale( strDateFormatLocale ); dateFormatTimeZone = TimeZone.getDefault(); } else { dateFormatTimeZone = EnvUtil.createTimeZone( strTimeZone );
EnvUtil.environmentInit(); initLogginPlugins( logginPlugins ); String passwordEncoderPluginID = Const.NVL( EnvUtil.getSystemProperty( Const.KETTLE_PASSWORD_ENCODER_PLUGIN ), "Kettle" );
@Override WebResult generateBody( HttpServletRequest request, HttpServletResponse response, boolean useXML ) throws Exception { ServletOutputStream out = response.getOutputStream(); Properties kettleProperties = EnvUtil.readProperties( Const.KETTLE_PROPERTIES ); ByteArrayOutputStream os = new ByteArrayOutputStream(); if ( useXML ) { kettleProperties.storeToXML( os, "" ); } else { kettleProperties.store( os, "" ); } out.write( Encr.encryptPassword( os.toString() ).getBytes() ); return null; }
public static void applyKettleProperties( Map<?, ?> kettleProperties ) { applyKettleProperties( kettleProperties, false ); }
String dateFormatLocaleString = XMLHandler.getTagValue( node, "date_format_locale" ); if ( !Utils.isEmpty( dateFormatLocaleString ) ) { dateFormatLocale = EnvUtil.createLocale( dateFormatLocaleString ); dateFormatTimeZone = EnvUtil.createTimeZone( dateTimeZoneString ); } else { dateFormatTimeZone = TimeZone.getDefault();
Properties properties = EnvUtil.readProperties( getKettlePropertiesFilename() );
EnvUtil.applyKettleProperties( masterProperties, slaveServer.isOverrideExistingProperties() );
/** * Initialize the central log store with optional limitation to the size * * @param maxSize * the maximum size * @param maxLogTimeoutMinutes * The maximum time that a log line times out in hours. */ public static void init( int maxSize, int maxLogTimeoutMinutes ) { init( maxSize, maxLogTimeoutMinutes, EnvUtil .getSystemProperty( Const.KETTLE_REDIRECT_STDOUT, "N" ).equalsIgnoreCase( "Y" ), EnvUtil .getSystemProperty( Const.KETTLE_REDIRECT_STDERR, "N" ).equalsIgnoreCase( "Y" ) ); }
String sArg3 = (String) ArgList[2]; if ( sArg3.length() == 2 ) { DecimalFormatSymbols dfs = new DecimalFormatSymbols( EnvUtil.createLocale( sArg3.toLowerCase() ) ); DecimalFormat formatter = new DecimalFormat( sArg2, dfs ); dRC = ( formatter.parse( sArg1 ) ).doubleValue();
valueMeta.setDateFormatLocale( EnvUtil.createLocale( change.getDateFormatLocale() ) ); valueMeta.setDateFormatTimeZone( EnvUtil.createTimeZone( change.getDateFormatTimeZone() ) ); valueMeta.setLenientStringToNumber( change.isLenientStringToNumber() );
public static void init() { init( EnvUtil.getSystemProperty( Const.KETTLE_REDIRECT_STDOUT, "N" ).equalsIgnoreCase( "Y" ), EnvUtil .getSystemProperty( Const.KETTLE_REDIRECT_STDERR, "N" ).equalsIgnoreCase( "Y" ) ); }
String sArg3 = (String) ArgList[2]; if ( sArg3.length() == 2 ) { DecimalFormatSymbols dfs = new DecimalFormatSymbols( EnvUtil.createLocale( sArg3.toLowerCase() ) ); DecimalFormat formatter = new DecimalFormat( sArg2, dfs ); sRC = formatter.format( sArg1 );
v.setDateFormatLocale( EnvUtil.createLocale( metaChange.getDateFormatLocale() ) ); v.setDateFormatTimeZone( EnvUtil.createTimeZone( metaChange.getDateFormatTimeZone() ) ); v.setLenientStringToNumber( metaChange.isLenientStringToNumber() );
public String getXML() throws KettleException { // See PDI-15781 boolean sendResultXmlWithStatus = EnvUtil.getSystemProperty( "KETTLE_COMPATIBILITY_SEND_RESULT_XML_WITH_FULL_STATUS", "N" ).equalsIgnoreCase( "Y" ); return getXML( sendResultXmlWithStatus ); }
String sArg3 = (String) ArgList[2]; if ( sArg3.length() == 2 ) { Locale dfLocale = EnvUtil.createLocale( sArg3.toLowerCase() ); dfFormatter = new SimpleDateFormat( sArg2, dfLocale ); oRC = dfFormatter.format( dArg1 ); Locale dfLocale = EnvUtil.createLocale( sArg3.toLowerCase() ); dfFormatter = new SimpleDateFormat( sArg2, dfLocale ); dfFormatter.setTimeZone( tz );
/** * @param jobMeta * the job metadata to keep track of (with maximum 5000 children) */ public JobTracker( JobMeta jobMeta ) { this( jobMeta, Const.toInt( EnvUtil.getSystemProperty( Const.KETTLE_MAX_JOB_TRACKER_SIZE ), 5000 ) ); }