/// /// <summary> * return the jmf root of the status jmf that contains all modules, null if no modules are active /// * /// * @return </summary> /// public virtual JDFDoc getStatusResponse() { if (counters.Count == 0) { return(null); } StatusCounter root = counters[0]; JDFDoc d = new JDFDoc("JMF"); JDFJMF jmf = d.getJMFRoot(); jmf.mergeElement(root.getDocJMFPhaseTime().getJMFRoot(), false); JDFDeviceInfo di = jmf.getResponse(0).getDeviceInfo(0); for (int i = 1; i < counters.Count; i++) { StatusCounter counter = counters[i]; JDFDoc docJMFPhaseTime = counter.getDocJMFPhaseTime(); if (docJMFPhaseTime == null) { continue; } JDFDeviceInfo di2 = docJMFPhaseTime.getJMFRoot().getResponse(0).getDeviceInfo(0); VElement phases = di2.getChildElementVector(ElementName.JOBPHASE, null, null, true, -1, false); for (int j = 0; j < phases.Count; j++) { di.copyElement(phases[j], null); } di.setDeviceStatus(getDeviceStatus()); } return(d); }
public virtual void testPerfectingJMF() { JDFElement.setLongID(false); JDFJMF jmfStatus = JDFJMF.createJMF(EnumFamily.Signal, EnumType.Status); jmfStatus.setSenderID("thePress"); JDFSignal sig = jmfStatus.getSignal(0); JDFDeviceInfo di = sig.appendDeviceInfo(); di.setDeviceStatus(EnumDeviceStatus.Running); JDFJobPhase jp = di.appendJobPhase(); jp.setJobID("jobID"); jp.setJobPartID("jobPartID"); jp.setStatus(EnumNodeStatus.InProgress); JDFModuleStatus ms = jp.appendModuleStatus(); ms.setModuleID("ID_Perfecting_1"); ms.setModuleType("PerfectingModule"); ms.setDeviceStatus(EnumDeviceStatus.Idle); ms = jp.appendModuleStatus(); ms.setModuleType("PrintModule"); ms.setDeviceStatus(EnumDeviceStatus.Running); ms.setModuleIndex(new JDFIntegerRangeList("0 1 3 4")); ms = jp.appendModuleStatus(); ms.setModuleType("PrintModule"); ms.setDeviceStatus(EnumDeviceStatus.Idle); ms.setModuleIndex(new JDFIntegerRangeList("2")); jmfStatus.getOwnerDocument_JDFElement().write2File(sm_dirTestDataTemp + "StatusPerfecting.jmf", 2, false); Assert.IsTrue(jmfStatus.isValid(EnumValidationLevel.Complete), "known defect - wait for autoclass fix"); }
public virtual void testModules14() { VString v = new VString("orig fullList end", null); for (int i = 0; i < v.Count; i++) { reSetUp(); string testType = v.stringAt(i); JDFAuditPool ap = n.getCreateAuditPool(); ap.appendXMLComment("JDF 1.3 incompatible auditing of module phases the REQUIRED time attributes are not set in the ModulePhase elements\n" + "- note that phases may now arbitrarily overlap\n" + "The modulePhase elements now only specify which modules are involved, times are all defined by the phasetime proper", null); ap.appendXMLComment("The following phaseTime is executed by one module - the RIP,which executes two process steps (Interpreting and Rendering)", null); JDFPhaseTime ptRIP = ap.addPhaseTime(EnumNodeStatus.Setup, null, null); JDFDate date = new JDFDate(); ptRIP.setStart(date); JDFDoc jmfDoc = new JDFDoc("JMF"); JDFJMF jmf = jmfDoc.getJMFRoot(); jmf.setDescriptiveName("Initial phase when the RIP starts up"); JDFSignal signal = jmf.appendSignal(JDFMessage.EnumType.Status); JDFDeviceInfo di = signal.appendDeviceInfo(); JDFJobPhase jpRIP = di.appendJobPhase(); di.setDeviceStatus(EnumDeviceStatus.Setup); jpRIP.setStartTime(date); jpRIP.setStatus(EnumNodeStatus.Setup); jpRIP.setJobID(n.getJobID(true)); jpRIP.setJobPartID(n.getJobPartID(true)); JDFModuleStatus msRIP = jpRIP.appendModuleStatus(); msRIP.setCombinedProcessIndex(new JDFIntegerList("0 1")); msRIP.setModuleType("Imaging"); msRIP.setModuleID("ID_Imaging"); JDFModulePhase mpRIP = ptRIP.appendModulePhase(); mpRIP.setCombinedProcessIndex(new JDFIntegerList("0 1")); mpRIP.setModuleType("Imaging"); mpRIP.setModuleID("ID_Imaging"); JDFModuleStatus msPrint = di.appendModuleStatus(); msPrint.setCombinedProcessIndex(new JDFIntegerList("2")); msPrint.setModuleType("Printer"); msPrint.setModuleID("ID_Printer"); JDFModuleStatus msStitch = di.appendModuleStatus(); msStitch.setCombinedProcessIndex(new JDFIntegerList("3")); msStitch.setModuleType("Stitcher"); msStitch.setModuleID("ID_Stitcher"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "0.jmf", 2, false); date.addOffset(0, 5, 0, 0); jmf.setTimeStamp(date); JDFJobPhase jpPrint = di.appendJobPhase(); di.setDeviceStatus(EnumDeviceStatus.Running); jpPrint.setStatus(EnumNodeStatus.InProgress); jpPrint.setStartTime(date); jpPrint.setJobID(n.getJobID(true)); jpPrint.setJobPartID(n.getJobPartID(true)); msPrint = jpPrint.appendModuleStatus(); msPrint.setCombinedProcessIndex(new JDFIntegerList("2")); msPrint.setModuleType("Printer"); msPrint.setModuleID("ID_Printer"); msStitch = jpPrint.appendModuleStatus(); msStitch.setCombinedProcessIndex(new JDFIntegerList("3")); msStitch.setModuleType("Stitcher"); msStitch.setModuleID("ID_Stitcher"); di.removeChildren(ElementName.MODULESTATUS, null, null); jmf.setDescriptiveName("Phase when the Printer and Finisher start up; RIP is still RIPping"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "1.jmf", 2, false); ap.appendXMLComment("The following phaseTime is executed by two modules - sticher and printer", null); JDFPhaseTime ptPrint = ap.addPhaseTime(EnumNodeStatus.InProgress, null, null); JDFModulePhase mpPrint = ptPrint.appendModulePhase(); mpPrint.setCombinedProcessIndex(new JDFIntegerList("2")); mpPrint.setModuleType("Printer"); mpPrint.setModuleID("ID_Printer"); ptPrint.setStart(date); JDFModulePhase mpStitch = ptPrint.appendModulePhase(); mpStitch.setCombinedProcessIndex(new JDFIntegerList("3")); mpStitch.setModuleType("Stitcher"); mpStitch.setModuleID("ID_Stitcher"); date.addOffset(0, 30, 0, 0); ptRIP.setEnd(date); JDFDeviceInfo di2 = null; if (i < 2) { JDFSignal signal2 = jmf.appendSignal(JDFMessage.EnumType.Status); di2 = (JDFDeviceInfo)signal2.copyElement(di, null); di2.removeChild(ElementName.JOBPHASE, null, 0); if (i == 1) { JDFModuleStatus directMSRip = (JDFModuleStatus)di2.copyElement(msRIP, null); directMSRip.setDeviceStatus(EnumDeviceStatus.Idle); } } else { jpRIP.setAttribute("EndTime", date.DateTimeISO); jpRIP.setDescriptiveName("Added EndTime to explicitly close phase"); } jmf.setTimeStamp(date); jmf.setDescriptiveName("Phase when the RIP has completed, Printer and Finisher are still RIPping"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "2.jmf", 2, false); date.addOffset(0, 70, 0, 0); ptPrint.setEnd(date); jmf.setTimeStamp(date); if (i < 2) { signal.deleteNode(); signal = jmf.appendSignal(JDFMessage.EnumType.Status); di = (JDFDeviceInfo)signal.copyElement(di2, null); di.removeChild(ElementName.JOBPHASE, null, 0); di.removeChild(ElementName.MODULESTATUS, null, 0); di.setDeviceStatus(EnumDeviceStatus.Idle); signal.appendXMLComment("Or should the complete list of modules also be specified here?", di); } else { jpRIP.deleteNode(); jpPrint.setAttribute("EndTime", date.DateTimeISO); jpPrint.setDescriptiveName("Added EndTime to explicitly close phase"); } jmf.setDescriptiveName("Phase when the Printer and Finisher have completed"); jmfDoc.write2File(sm_dirTestDataTemp + "moduleStatus" + testType + "3.jmf", 2, false); doc.write2File(sm_dirTestDataTemp + "DigiPrintModule.1.4" + testType + ".jdf", 2, false); } }
/// /// <summary> * Set the Status and StatusDetails of this node update the PhaseTime audit or append a new phasetime as appropriate /// * also prepare a status JMF /// * </summary> /// * <param name="nodeStatus"> the new status of the node </param> /// * <param name="nodeStatusDetails"> the new statusDetails of the node </param> /// * <param name="deviceStatus"> the new status of the device </param> /// * <param name="deviceStatusDetails"> the new statusDetails of the device </param> /// * <param name="vPartMap"> the vector of parts to that should be set </param> /// * <param name="vResLink"> the resourcelinks that are used to fill the various amount attributes in jobphase and phasetime /// * </param> /// public virtual void setPhase(EnumNodeStatus nodeStatus, string nodeStatusDetails, EnumDeviceStatus deviceStatus, string deviceStatusDetails, AmountBag[] amounts) { docJMFPhaseTime = new JDFDoc(ElementName.JMF); JDFJMF jmf = docJMFPhaseTime.getJMFRoot(); docJMFResource = new JDFDoc(ElementName.JMF); JDFJMF jmfRes = docJMFResource.getJMFRoot(); AmountBag ab = getBag(getFirstRefID(), amounts); LinkAmount la = getLinkAmount(getFirstRefID()); AmountBag lastAb = la == null ? null : la.lastBag; JDFAuditPool ap = m_Node.getCreateAuditPool(); // TODO rethink when to send 2 phases JDFPhaseTime pt1 = ap.getLastPhase(m_vPartMap, null); JDFPhaseTime pt2 = pt1; bool bEnd = nodeStatus.Equals(EnumNodeStatus.Completed) || nodeStatus.Equals(EnumNodeStatus.Aborted); pt2 = ap.setPhase(nodeStatus, nodeStatusDetails, m_vPartMap, null); if (bEnd) { JDFProcessRun pr = (JDFProcessRun)ap.addAudit(EnumAuditType.ProcessRun, null); pr.setPartMapVector(m_vPartMap); VElement audits = ap.getAudits(EnumAuditType.PhaseTime, null, m_vPartMap); for (int i = 0; i < audits.Count; i++) { pr.addPhase((JDFPhaseTime)audits[i]); } pr.setEndStatus(nodeStatus); } if (pt1 != null && pt2 != pt1) // we explicitly added a new phasetime // audit, thus we need to add a closing // JMF for the original jobPhase { JDFSignal s = (JDFSignal)jmf.appendMessageElement(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Status); JDFDeviceInfo deviceInfo = s.appendDeviceInfo(); JDFJobPhase jp = deviceInfo.createJobPhaseFromPhaseTime(pt1); jp.setJobID(m_Node.getJobID(true)); jp.setJobPartID(m_Node.getJobPartID(false)); setJobPhaseAmounts(lastAb, jp); if (m_deviceID != null) { deviceInfo.setDeviceID(m_deviceID); } } if (pt2 != null) { JDFSignal s = (JDFSignal)jmf.appendMessageElement(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Status); JDFDeviceInfo deviceInfo = s.appendDeviceInfo(); if (!bEnd) // don't write a jobphase for an idle device { JDFJobPhase jp = deviceInfo.createJobPhaseFromPhaseTime(pt2); setJobPhaseAmounts(ab, jp); } deviceInfo.setDeviceStatus(deviceStatus); deviceInfo.setStatusDetails(deviceStatusDetails); deviceInfo.setDeviceID(m_deviceID); m_Node.setPartStatus(m_vPartMap, nodeStatus, null); getVResLink(amounts, 2); // update the nodes links generateResourceSignal(amounts, jmfRes); if (bEnd) { pt2.deleteNode(); // zapp the last phasetime } else { pt2.setLinks(getVResLink(amounts, 1)); pt2.eraseEmptyAttributes(true); } } // cleanup! if (vLinkAmount != null) { for (int i = 0; i < vLinkAmount.Length; i++) { string refID = vLinkAmount[i].rl.getrRef(); AmountBag bag = getBag(refID, amounts); vLinkAmount[i].lastBag = new AmountBag(bag); } } jmf.eraseEmptyAttributes(true); }