initialize
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
package com.itac.mes.datainterface;
|
||||
|
||||
public class DataInterfaceWebstartLauncher {
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
System.setProperty("itac.mainclass", "com.itac.mes.datainterface.DataInterface");
|
||||
setSystemProperties(args[0]);
|
||||
com.itac.mes.datainterface.DataInterface.main(new String[]{});
|
||||
} catch(Exception e) {
|
||||
throw new RuntimeException("Unable to execute com.itac.mes.datainterface.DataInterface.main()", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void setSystemProperties(String complete) {
|
||||
boolean isEscape = false;
|
||||
boolean isValue = false;
|
||||
StringBuilder key = new StringBuilder();
|
||||
StringBuilder value = new StringBuilder();
|
||||
for (int i=0; i<complete.length(); i++) {
|
||||
char c = complete.charAt(i);
|
||||
if (c == ',') {
|
||||
if (isEscape) {
|
||||
if (isValue) {
|
||||
value.append(c);
|
||||
} else {
|
||||
key.append(c);
|
||||
}
|
||||
isEscape = false;
|
||||
} else {
|
||||
System.setProperty(key.toString(), value.toString());
|
||||
key = new StringBuilder();
|
||||
value = new StringBuilder();
|
||||
isEscape = false;
|
||||
isValue = false;
|
||||
}
|
||||
} else if (c == '\\') {
|
||||
if (isEscape) {
|
||||
if (isValue) {
|
||||
value.append(c);
|
||||
} else {
|
||||
key.append(c);
|
||||
}
|
||||
isEscape = false;
|
||||
} else {
|
||||
isEscape = true;
|
||||
}
|
||||
} else if (c == '=') {
|
||||
isValue = true;
|
||||
} else {
|
||||
if (isValue) {
|
||||
value.append(c);
|
||||
} else {
|
||||
key.append(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.setProperty(key.toString(), value.toString());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user