/** * Creates a new EnvironmentFactory from the list of entries. */ public EnvironmentFactory createEnvironmentFactory() { final String envConfig = createEnvironmentXml(); if (LOG.isLoggable(Level.CONFIG)) { LOG.config("The following environment has been generated by: " + this.getClass().getName() + Misc.LINE_SEPARATOR + envConfig); } EnvironmentFactory environmentFactory = XpdlEnvironmentParser .parseEnvironmentFactoryFromXmlString(envConfig); return environmentFactory; }
/** * Prints the default environment on standard output. * * @param args * @throws IOException */ @SuppressWarnings("unchecked") public static void main(String[] args) throws IOException { if (args.length != 1 && args.length != 2) { System.exit(1); } EnvGenerator envGenerator = null; try { Class <EnvGenerator> envGeneratorClass = (Class<EnvGenerator>) EnvGenerator.class.getClassLoader().loadClass(args[0]); envGenerator = envGeneratorClass.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } if (args.length == 1) { if (LOG.isLoggable(Level.INFO)) { LOG.config(envGenerator.createEnvironmentXml()); } } else { Misc.write(envGenerator.createEnvironmentXml(), new File(args[1])); } }