📄 stax.java
字号:
fParmsParser.addOption("EVENTSERVICEMACHINE", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("EVENTSERVICENAME", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("NUMTHREADS", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("EXTENSIONXMLFILE", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("EXTENSIONFILE", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("EXTENSION", 0, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("PROCESSTIMEOUT", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("CLEARLOGS", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("LOGTCELAPSEDTIME", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("LOGTCNUMSTARTS", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOption("LOGTCSTARTSTOP", 1, STAFCommandParser.VALUEREQUIRED); // CACHEPYTHONCODE is an undocumented parameter // Mainly there in case any problems arise with the caching // of Python code added in STAX V1.5.0. fParmsParser.addOption("CACHEPYTHONCODE", 1, STAFCommandParser.VALUEREQUIRED); fParmsParser.addOptionGroup( "EXTENSIONFILE EXTENSIONXMLFILE", 0, 1); res = handleParms(info); if (res.rc != STAFResult.Ok) { return new STAFResult( STAFResult.ServiceConfigurationError, "Error validating parameters: RC=" + res.rc + ", Result=" + res.result); } } // Create the STAX Thread Queue fThreadQueue = new STAXThreadQueue(fNumThreads); // Prime the element pump // Note that elements that implement a STAX request handler pass // parameters "this" to the action factory constructor. fActionFactoryMap.put("process", new STAXProcessActionFactory(this)); fActionFactoryMap.put("stafcmd", new STAXSTAFCommandActionFactory(this)); fActionFactoryMap.put("job", new STAXJobActionFactory(this)); fActionFactoryMap.put("block", new STAXBlockActionFactory(this)); fActionFactoryMap.put("testcase", new STAXTestcaseActionFactory(this)); fActionFactoryMap.put("log", new STAXLogActionFactory(this)); fActionFactoryMap.put("message", new STAXMessageActionFactory(this)); fActionFactoryMap.put("function", new STAXFunctionActionFactory()); fActionFactoryMap.put("signalhandler", new STAXSignalHandlerActionFactory()); fActionFactoryMap.put("sequence", new STAXSequenceActionFactory()); fActionFactoryMap.put("parallel", new STAXParallelActionFactory()); fActionFactoryMap.put("call", new STAXCallActionFactory()); fActionFactoryMap.put("call-with-list", new STAXCallWithListActionFactory()); fActionFactoryMap.put("call-with-map", new STAXCallWithMapActionFactory()); fActionFactoryMap.put("script", new STAXScriptActionFactory()); fActionFactoryMap.put("if", new STAXIfActionFactory()); fActionFactoryMap.put("nop", new STAXNopActionFactory()); fActionFactoryMap.put("loop", new STAXLoopActionFactory()); fActionFactoryMap.put("iterate", new STAXIterateActionFactory()); fActionFactoryMap.put("paralleliterate", new STAXParallelIterateActionFactory()); fActionFactoryMap.put("terminate", new STAXTerminateActionFactory()); fActionFactoryMap.put("hold", new STAXHoldActionFactory()); fActionFactoryMap.put("release", new STAXReleaseActionFactory()); fActionFactoryMap.put("tcstatus", new STAXTestcaseStatusActionFactory()); fActionFactoryMap.put("break", new STAXBreakActionFactory()); fActionFactoryMap.put("continue", new STAXContinueActionFactory()); fActionFactoryMap.put("raise", new STAXRaiseActionFactory()); fActionFactoryMap.put("try", new STAXTryActionFactory()); fActionFactoryMap.put("throw", new STAXThrowActionFactory()); fActionFactoryMap.put("rethrow", new STAXRethrowActionFactory()); fActionFactoryMap.put("timer", new STAXTimerActionFactory()); fActionFactoryMap.put("import", new STAXImportActionFactory()); fActionFactoryMap.put("return", new STAXReturnActionFactory()); // Prime the element pump with the Extension elements res = loadExtensions(); if (res.rc != 0) { System.out.println(res.result); logToServiceLog("error", res.result); return res; } // Execute parser fExecuteParser.addOption("EXECUTE", 1, STAFCommandParser.VALUENOTALLOWED); fExecuteParser.addOption("FILE", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("MACHINE", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("DATA", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("JOBNAME", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("FUNCTION", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("ARGS", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("SCRIPT", 0, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("SCRIPTFILE", 0, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("SCRIPTFILEMACHINE", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("HOLD", 1, STAFCommandParser.VALUENOTALLOWED); fExecuteParser.addOption("TEST", 1, STAFCommandParser.VALUENOTALLOWED); // RETURNDETAILS option is un-documented fExecuteParser.addOption("RETURNDETAILS", 1, STAFCommandParser.VALUENOTALLOWED); fExecuteParser.addOption("WAIT", 1, STAFCommandParser.VALUEALLOWED); fExecuteParser.addOption("RETURNRESULT", 1, STAFCommandParser.VALUENOTALLOWED); fExecuteParser.addOption("NOTIFY", 1, STAFCommandParser.VALUENOTALLOWED); fExecuteParser.addOption("ONEND", 1, STAFCommandParser.VALUENOTALLOWED); fExecuteParser.addOption("BYNAME", 1, STAFCommandParser.VALUENOTALLOWED); fExecuteParser.addOption("PRIORITY", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("KEY", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("CLEARLOGS", 1, STAFCommandParser.VALUEALLOWED); fExecuteParser.addOption("LOGTCELAPSEDTIME", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("LOGTCNUMSTARTS", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOption("LOGTCSTARTSTOP", 1, STAFCommandParser.VALUEREQUIRED); fExecuteParser.addOptionGroup("FILE DATA", 0, 1); fExecuteParser.addOptionGroup("HOLD TEST WAIT", 0, 1); fExecuteParser.addOptionNeed("EXECUTE", "FILE DATA"); fExecuteParser.addOptionNeed("MACHINE", "FILE"); fExecuteParser.addOptionNeed("SCRIPTFILEMACHINE", "SCRIPTFILE"); fExecuteParser.addOptionNeed("RETURNRESULT", "WAIT"); fExecuteParser.addOptionNeed("RETURNDETAILS", "TEST"); fExecuteParser.addOptionNeed("NOTIFY", "ONEND"); fExecuteParser.addOptionNeed("ONEND", "NOTIFY"); fExecuteParser.addOptionNeed("BYNAME", "NOTIFY"); fExecuteParser.addOptionNeed("PRIORITY", "NOTIFY"); fExecuteParser.addOptionNeed("KEY", "NOTIFY"); // List parser fListParser.addOption("LIST", 1, STAFCommandParser.VALUENOTALLOWED); fListParser.addOption("JOBS", 1, STAFCommandParser.VALUENOTALLOWED); fListParser.addOption("JOB", 1, STAFCommandParser.VALUEREQUIRED); fListParser.addOption("SETTINGS", 1, STAFCommandParser.VALUENOTALLOWED); fListParser.addOption("EXTENSIONS", 1, STAFCommandParser.VALUENOTALLOWED); fListParser.addOption("EXTENSIONJARFILES", 1, STAFCommandParser.VALUENOTALLOWED); fListParser.addOption("THREADS", 1, STAFCommandParser.VALUENOTALLOWED); fListParser.addOption("FORMAT", 1, STAFCommandParser.VALUEREQUIRED); StringBuffer jobOptions = new StringBuffer("THREADS"); // Add additional options from registered list handlers synchronized (fListRequestMap) { Iterator iter = fListRequestMap.keySet().iterator(); while (iter.hasNext()) { String typeName = (String)iter.next(); fListParser.addOption(typeName.toUpperCase(), 1, STAFCommandParser.VALUENOTALLOWED); jobOptions.append(" " + typeName.toUpperCase()); } } String listJobOptions = new String(jobOptions); String listOptions = new String( "JOB JOBS SETTINGS EXTENSIONS EXTENSIONJARFILES"); fListParser.addOptionGroup("LIST", 1, 1); fListParser.addOptionGroup(listOptions, 0, 1); fListParser.addOptionNeed("LIST", listOptions); fListParser.addOptionNeed(listOptions, "LIST"); fListParser.addOptionNeed(listJobOptions, "JOB"); fListParser.addOptionNeed("JOB", listJobOptions); // Query parser fQueryParser.addOption("QUERY", 1, STAFCommandParser.VALUENOTALLOWED); fQueryParser.addOption("JOB", 1, STAFCommandParser.VALUEREQUIRED); fQueryParser.addOption("THREAD", 0, STAFCommandParser.VALUEREQUIRED); fQueryParser.addOption("EXTENSIONJARFILE", 1, STAFCommandParser.VALUEREQUIRED); fQueryParser.addOption("EXTENSIONJARFILES", 1, STAFCommandParser.VALUENOTALLOWED); jobOptions = new StringBuffer("THREAD"); String fHelpQueryJobOptions = "THREAD <Thread ID>"; // Add additional options from registered query handlers synchronized (fQueryRequestMap) { Iterator iter = fQueryRequestMap.keySet().iterator(); while (iter.hasNext()) { String typeName = ((String)iter.next()).toUpperCase(); fQueryParser.addOption(typeName, 0, STAFCommandParser.VALUEREQUIRED); jobOptions.append(" " + typeName); } } String queryJobOptions = new String(jobOptions); String queryOptions = "JOB EXTENSIONJARFILE EXTENSIONJARFILES"; fQueryParser.addOptionGroup("QUERY", 1, 1); fQueryParser.addOptionGroup(queryOptions, 0, 1); fQueryParser.addOptionNeed(queryOptions, "QUERY"); fQueryParser.addOptionNeed("QUERY", queryOptions); fQueryParser.addOptionNeed(queryJobOptions, "JOB"); // Get parser fGetParser.addOption("GET", 1, STAFCommandParser.VALUENOTALLOWED); fGetParser.addOption("DTD", 1, STAFCommandParser.VALUENOTALLOWED); fGetParser.addOptionNeed("GET", "DTD"); // Undocumented option STAX-EXTENSIONS-FILE - gets the DTD for // the STAX Extensions XML file fGetParser.addOption("STAX-EXTENSIONS-FILE", 1, STAFCommandParser.VALUENOTALLOWED); fGetParser.addOptionNeed("STAX-EXTENSIONS-FILE", "DTD"); // Set parser fSetParser.addOption("SET", 1, STAFCommandParser.VALUENOTALLOWED); fSetParser.addOption("CLEARLOGS", 1, STAFCommandParser.VALUEREQUIRED); fSetParser.addOption("LOGTCELAPSEDTIME", 1, STAFCommandParser.VALUEREQUIRED); fSetParser.addOption("LOGTCNUMSTARTS", 1, STAFCommandParser.VALUEREQUIRED); fSetParser.addOption("LOGTCSTARTSTOP", 1, STAFCommandParser.VALUEREQUIRED); String setOptions = "CLEARLOGS LOGTCELAPSEDTIME " + "LOGTCNUMSTARTS LOGTCSTARTSTOP"; fSetParser.addOptionNeed("SET", setOptions); fSetParser.addOptionNeed(setOptions, "SET"); // Notify parser fNotifyParser.addOption("NOTIFY", 1, STAFCommandParser.VALUENOTALLOWED); fNotifyParser.addOption("REGISTER", 1, STAFCommandParser.VALUENOTALLOWED); fNotifyParser.addOption("UNREGISTER", 1, STAFCommandParser.VALUENOTALLOWED); fNotifyParser.addOption("LIST", 1, STAFCommandParser.VALUENOTALLOWED); fNotifyParser.addOption("ONENDOFJOB", 1, STAFCommandParser.VALUEREQUIRED); fNotifyParser.addOption("JOB", 1, STAFCommandParser.VALUEREQUIRED); fNotifyParser.addOption("BYNAME", 1, STAFCommandParser.VALUENOTALLOWED); fNotifyParser.addOption("PRIORITY", 1, STAFCommandParser.VALUEREQUIRED); fNotifyParser.addOptionGroup("NOTIFY", 1, 1); fNotifyParser.addOptionGroup("REGISTER UNREGISTER LIST", 1, 1); fNotifyParser.addOptionNeed("ONENDOFJOB", "REGISTER UNREGISTER"); fNotifyParser.addOptionNeed("REGISTER UNREGISTER", "ONENDOFJOB"); fNotifyParser.addOptionNeed("JOB", "LIST"); fNotifyParser.addOptionNeed("BYNAME", "REGISTER"); fNotifyParser.addOptionNeed("PRIORITY", "REGISTER"); // Version parser
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -