@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; }
/** * 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" ); }
Properties properties = EnvUtil.readProperties( getKettlePropertiesFilename() );