1 28 29 package org.objectweb.util.launcher ; 30 31 32 import java.util.Properties ; 33 34 35 54 public class CommandFactory 55 { 56 57 protected static CommandFactory factory_ = null ; 58 59 60 protected Properties default_properties_ ; 61 62 protected StringList default_arguments_ ; 63 64 protected StringList default_classpath_ ; 65 66 67 71 public CommandFactory() { 72 this.default_properties_ = new Properties (); 73 this.default_arguments_ = new StringList(); 74 this.default_classpath_ = new StringList(); 75 } 76 77 81 public Properties getDefaultProperties() { 82 return this.default_properties_; 83 } 84 85 89 public StringList getDefaultArguments() { 90 return this.default_arguments_; 91 } 92 93 97 public StringList getDefaultClasspath() { 98 return this.default_classpath_; 99 } 100 101 105 public CommandJava create() { 106 CommandJava cmd = new CommandJava(new XBootClassLoader()); 107 cmd.addProperties(getDefaultProperties()); 108 cmd.addArguments(getDefaultArguments()); 109 try { 110 cmd.getLoader().addURL(getDefaultClasspath().toStringArray()); 111 } catch (java.net.MalformedURLException ex) { 112 throw new LauncherException(ex); 113 } 114 return cmd; 115 } 116 117 121 public static CommandFactory instance() { 122 if (factory_ == null) factory_ = new CommandFactory(); 123 return factory_ ; 124 } 125 } 126 | Popular Tags |