return out;
}
public static StdParams processStdArgs(String[] args, ArgSpec argSpecs[], Class classInMainPackage, String appName) throws FileNotFoundException, IOException {
StdParams p = new StdParams();
ArgSpec internalArgSpecs[] = addStdArgSpecs(argSpecs);
Set specs = ACommandLineUtilities.addArgFileArgSpecs(internalArgSpecs);
//internalArgSpecs = ACommandLineUtilities.addArgFileArgSpecs(internalArgSpecs);
/*ArgSpec argFileArgSpecs[] = ACommandLineUtilities.getArgFileArgSpecs();
ArgSpec internalArgSpecs[] = new ArgSpec[argSpecs.length + 8 + argFileArgSpecs.length];
int offset = 0;
internalArgSpecs[offset++] = new ArgSpec(ARG_HELP, ARG_HELP_ID);
internalArgSpecs[offset++] = new ArgSpec(ARG_SET_CONF_FOLDER, ARG_SET_CONF_FOLDER_ID, 0);
internalArgSpecs[offset++] = new ArgSpec(ARG_ADD_JAR_FILE, ARG_ADD_JAR_FILE_ID, 0);
internalArgSpecs[offset++] = new ArgSpec(ARG_ADD_TERMINAL_MANAGER, ARG_ADD_TERMINAL_MANAGER_ID, ArgSpec.UNLIMITED_OCCURENCE);
internalArgSpecs[offset++] = new ArgSpec(ARG_TASK, ARG_TASK_ID, ArgSpec.UNLIMITED_OCCURENCE);
internalArgSpecs[offset++] = new ArgSpec(ARG_STAR_SCRIPT_FILE, ARG_STAR_SCRIPT_FILE_ID, ArgSpec.UNLIMITED_OCCURENCE);
internalArgSpecs[offset++] = new ArgSpec(ARG_SET_NRUN, ARG_SET_NRUN_ID, ArgSpec.UNLIMITED_OCCURENCE);
internalArgSpecs[offset++] = new ArgSpec(ARG_SET_PRINT_STREAM_LOG, ARG_SET_PRINT_STREAM_LOG_ID, ArgSpec.UNLIMITED_OCCURENCE);
for (int i = 0; i < argFileArgSpecs.length; i++) {
internalArgSpecs[offset++] = argFileArgSpecs[i];
}
for (int i = 0; i < argSpecs.length; i++) {
internalArgSpecs[offset++] = argSpecs[i];
}*/
//p.argSpecs = ACommandLineUtilities.addArgFileArgSpecs(internalArgSpecs);
p.argSpecs = new ArgSpec[specs.size()];
specs.toArray(p.argSpecs);
p.args = ACommandLineUtilities.processArgFile(new File("").getAbsoluteFile(), args);
//ACommandLineUtilities clContext=new ACommandLineUtilities(new File("").getAbsoluteFile(),args,internalArgSpecs,null);
//clContext.processArgs();
argSpecs = p.argSpecs;
args = p.args;
//ACommandLineUtilities.checkArgs(p.args, p.argSpecs);
List<Class> registeredTerminalManagers = new LinkedList<Class>();
boolean nimpHomeNotDefined = false;
String confFolderName = ACommandLineUtilities.getArgValue(p.args, ARG_SET_CONF_FOLDER, null);
if (null != confFolderName) {
//force the path to be absolute
File f = new File(confFolderName);
if (false == f.exists()) {
throw new RuntimeException("Folder specified by \"" + ARG_SET_CONF_FOLDER + "\" argument does not exist:\n" + f.getAbsolutePath());
}
confFolderName = f.getAbsolutePath() + System.getProperty("file.separator");
} else {
try {
confFolderName = getDefaultConfFolder();
} catch (RuntimeException e) {
Logger.getLogger(classInMainPackage.getName()).log(Level.SEVERE, null, e);
confFolderName = (new File("")).getAbsolutePath() + System.getProperty("file.separator");
nimpHomeNotDefined = true;
}
}
try {
List<String> names = ACommandLineUtilities.getArgValues(p.args, p.argSpecs, ARG_ADD_JAR_FILE, null);
Set<String> uniqueNames = new HashSet<String>();
uniqueNames.addAll(names);
if (uniqueNames.size() >= 1) {
for (String jarName : uniqueNames) {
File jarFile = new File(jarName);
if (null == pluginJarClassLoader) {
pluginJarClassLoader = new JarClassLoader(jarFile.toURI().toURL());
} else {
pluginJarClassLoader.addJarURL(jarFile.toURI().toURL());
}
}
} else {
File appJarFile = new File(AFileUtilities.getPackagePath(classInMainPackage, "packageLocator"));
pluginJarClassLoader = new JarClassLoader(appJarFile.toURI().toURL());
}
names = ACommandLineUtilities.getArgValues(p.args, p.argSpecs, ARG_ADD_TERMINAL_MANAGER, null);
if (0 == names.size()) {
//look for app default conf
File argFile = new File(confFolderName + appName + DEFAULT_CONF_EXTENSION);
if (false == argFile.exists()) {
//look for framework default conf
argFile = new File(confFolderName + DEFAULT_CONF_FILENAME);
}
ArgSpec confArgSpecs[] = {
new ArgSpec(ARG_HELP, ARG_HELP_ID),
new ArgSpec(ARG_ADD_TERMINAL_MANAGER, ARG_ADD_TERMINAL_MANAGER_ID, ArgSpec.UNLIMITED_OCCURENCE)
};
try {
if (argFile.exists()) {
List<String> confArgsList = ACommandLineUtilities.processArgFile(argFile);
String confArgs[] = new String[confArgsList.size()];