/**
* This is the main procedure for Spoon.
*
* @param a
* Arguments are available in the "Get System Info" step.
*/
public static void main(String[] a) throws KettleException {
try {
// Bootstrap Kettle
//
// We start Sleak if the VM argument RUN_SLEAK was provided
Display display = null;
if (System.getProperties().containsKey("SLEAK")) {
DeviceData data = new DeviceData();
data.tracking = true;
display = new Display(data);
Sleak sleak = new Sleak();
sleak.open();
}
else {
display = new Display();
}
// The core plugin types don't know about UI classes. Add them in now
// before the PluginRegistry inits.
splash = new Splash(display);
registerUIPluginObjectTypes();
KettleEnvironment.init();
List<String> args = new ArrayList<String>(java.util.Arrays.asList(a));
CommandLineOption[] commandLineOptions = getCommandLineArgs(args);
initLogging(commandLineOptions);
PropsUI.init(display, Props.TYPE_PROPERTIES_SPOON);
CentralLogStore.init(
PropsUI.getInstance().getMaxNrLinesInLog(),
PropsUI.getInstance().getMaxLogLineTimeoutMinutes());
// remember...
staticSpoon = new Spoon(display);
staticSpoon.init(null);
SpoonFactory.setSpoonInstance(staticSpoon);
staticSpoon.setDestroy(true);
GUIFactory.setThreadDialogs(new ThreadGuiResources());
// listeners
//
try {
staticSpoon.lifecycleSupport.onStart(staticSpoon);
} catch (LifecycleException e) {
// if severe, we have to quit
MessageBox box = new MessageBox(staticSpoon.shell, (e.isSevere() ? SWT.ICON_ERROR : SWT.ICON_WARNING) | SWT.OK);
box.setMessage(e.getMessage());
box.open();
}
staticSpoon.setArguments(args.toArray(new String[args.size()]));
staticSpoon.start(commandLineOptions);
} catch (Throwable t) {
// avoid calls to Messages i18n method getString() in this block
// We do this to (hopefully) also catch Out of Memory Exceptions
//
t.printStackTrace();
if (staticSpoon != null) {
log.logError("Fatal error : " + Const.NVL(t.toString(), Const.NVL(t.getMessage(), "Unknown error"))); //$NON-NLS-1$ //$NON-NLS-2$
log.logError(Const.getStackTracker(t));
}
}
// Kill all remaining things in this VM!
System.exit(0);
}
Spoon.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:read-open-source-code
作者:
评论列表
文章目录