public void actionPerformed(ActionEvent e) { JComponent component = null; try { component = guiRenderer.getComponent(guiContext .getReferenceService(), guiReference); } catch (RendererException e1) {// maybe this should be // Exception // show the user that something unexpected has happened but // continue component = new JTextArea( "Could not render using renderer type " + guiRenderer.getClass().getName() + "\n" + "Please try with a different renderer if available and consult log for details of problem"); logger.warn("Couln not render using " + guiRenderer.getClass().getName(), e1); } // RenderedResultComponent rendererComponent = // RendererResultComponentFactory.getInstance().getRendererComponent(); // rendererComponent.setResultComponent(component); // renderedResultComponent.setResultComponent(component); }
@Override /** * Used to construct a Job of empty lists at the appropriate depth in the * event of a completion hitting the crystalizer before it sees a child * node, i.e. the result of iterating over an empty collection structure of * some kind. */ public Job getEmptyJob(String owningProcess, int[] index, InvocationContext context) { int wrappingDepth = parent.resultWrappingDepth; if (wrappingDepth < 0) throw new RuntimeException( "Processor hasn't been configured, cannot emit empty job"); // The wrapping depth is the length of index array that would be used if // a single item of the output port type were returned. We can examine // the index array for the node we're trying to create and use this to // work out how much we need to add to the output port depth to create // empty lists of the right type given the index array. int depth = wrappingDepth - index.length; // TODO - why was this incrementing? // depth++; DataManager dManager = context.getDataManager(); Map<String, EntityIdentifier> emptyJobMap = new HashMap<String, EntityIdentifier>(); for (OutputPort op : parent.getOutputPorts()) { emptyJobMap.put(op.getName(), dManager.registerEmptyList(depth + op.getDepth())); } return new Job(owningProcess, index, emptyJobMap, context); }
@Override public String getRunId() { return this.callback.getContext() .getEntities(WorkflowRunIdEntity.class).get(0) .getWorkflowRunId(); }
workflowDataProvenanceItem.setInputPort(true); workflowDataProvenanceItem.setData(token.getData()); workflowDataProvenanceItem.setReferenceService(context.getReferenceService()); workflowDataProvenanceItem.setParentId(workflowItem.getIdentifier()); workflowDataProvenanceItem.setWorkflowId(workflowItem.getParentId()); workflowDataProvenanceItem.setIndex(token.getIndex()); workflowDataProvenanceItem.setFinal(token.isFinal()); context.getProvenanceReporter().addProvenanceItem( workflowDataProvenanceItem);
public void run() { ReferenceService referenceService = callback.getContext().getReferenceService(); UseCaseInvocation invoke = null; .getEntities(WorkflowRunIdEntity.class).get(0) .getWorkflowRunId(); logger.info("Run id is " + runId);
portName, token.getData(), context.getReferenceService()); workflowDataProvenanceItem.setParentId(workflowItem.getIdentifier()); workflowDataProvenanceItem.setIdentifier(UUID.randomUUID().toString()); workflowDataProvenanceItem.setParentId(instanceOwningProcessId); workflowDataProvenanceItem.setProcessId(instanceOwningProcessId); context.getProvenanceConnector().addProvenanceItem( workflowDataProvenanceItem); .setProcessId(instanceOwningProcessId); dataflowRunComplete.setIdentifier(UUID.randomUUID().toString()); context.getProvenanceConnector().addProvenanceItem( dataflowRunComplete);
context.addEntity(new WorkflowRunIdEntity(workflowRunId)); this.instanceOwningProcessId = localName; if (context.getProvenanceReporter() != null) { context.getProvenanceReporter().setSessionID(workflowRunId);
public synchronized void fire() throws IllegalStateException { if (getState().equals(State.running)) { throw new IllegalStateException( "Workflow is already running!"); } workflowStarted = new Timestamp(System.currentTimeMillis()); setState(State.running); if (provEnabled) { workflowItem.setInvocationStarted(workflowStarted); context.getProvenanceReporter().addProvenanceItem(workflowItem); } HashSet<MonitorableProperty<?>> properties = new HashSet<MonitorableProperty<?>>(); properties.add(new StateProperty()); monitorManager.registerNode(this, instanceOwningProcessId.split(":"), properties); dataflow.fire(instanceOwningProcessId, context); }
.getReferenceService(); ProvenanceReporter provenanceReporter = context.getProvenanceReporter(); if (provenanceReporter != null) { IntermediateProvenance intermediateProvenance = findIntermediateProvenance();
intermediateProvenance.setWorkflow(workflowItem); intermediateProvenance.setReporter(context .getProvenanceReporter());
@SuppressWarnings("unused") private InvocationContextImpl copyInvocationContext( final AsynchronousActivityCallback callback) { InvocationContext originalContext = callback.getContext(); ReferenceService rs = originalContext.getReferenceService(); InvocationContextImpl newContext = new InvocationContextImpl(rs, null); // for (Object o : originalContext.getEntities(Object.class)) { // newContext.addEntity(o); // } return newContext; }
workflowDataProvenanceItem.setInputPort(false); workflowDataProvenanceItem.setData(token.getData()); workflowDataProvenanceItem.setReferenceService(context.getReferenceService()); workflowDataProvenanceItem.setParentId(workflowItem.getIdentifier()); workflowDataProvenanceItem.setWorkflowId(workflowItem.getParentId()); workflowDataProvenanceItem.setIndex(token.getIndex()); workflowDataProvenanceItem.setFinal(token.isFinal()); context.getProvenanceReporter().addProvenanceItem( workflowDataProvenanceItem);
for (String outputName : listItems.keySet()) { List<EntityIdentifier> idlist = listItems.get(outputName); newDataMap.put(outputName, context.getDataManager().registerList( idlist.toArray(new EntityIdentifier[0])));
@Override public void receiveJob(final DispatchJobEvent jobEvent) { List<WorkflowRunIdEntity> entities = jobEvent.getContext().getEntities( WorkflowRunIdEntity.class); if (entities != null && !entities.isEmpty()) {
.toString()); dataflowRunComplete.setState(getState()); context.getProvenanceReporter().addProvenanceItem( dataflowRunComplete);
public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { int selectedIndex = renderersComboBox.getSelectedIndex(); if (renderersForMimeType != null && renderersForMimeType.size() > selectedIndex) { Renderer renderer = renderersForMimeType.get(selectedIndex); JComponent component = null; try { component = renderer.getComponent(context .getReferenceService(), t2Reference); } catch (RendererException e1) {// maybe this should be // Exception // show the user that something unexpected has happened but // continue component = new JTextArea( "Could not render using renderer type " + renderer.getClass().getName() + "\n" + "Please try with a different renderer if available and consult log for details of problem"); logger.warn("Couln not render using " + renderer.getClass().getName(), e1); } renderedResultPanel.removeAll(); renderedResultPanel.add(component, BorderLayout.CENTER); repaint(); revalidate(); } } } });
public void run() { DataFacade dataFacade = new DataFacade(callback.getContext() .getDataManager());
/** * @param originalCallback * @param invocationContext * @param exceptionHandling2 */ public ProxyCallback(AsynchronousActivityCallback originalCallback, InvocationContext invocationContext, ExceptionHandling exceptionHandling2) { super(); this.originalCallback = originalCallback; this.exceptionHandling = exceptionHandling2; context = invocationContext; referenceService = context.getReferenceService(); listService = referenceService.getListService(); errorService = referenceService.getErrorDocumentService(); }
/** * Construct and send a new result message with error documents in place of * all outputs at the appropriate depth * * @param e */ private void sendErrorOutput(Event<?> e) { DataManager dm = e.getContext().getDataManager(); Processor p = dispatchStack.getProcessor(); Map<String, EntityIdentifier> outputDataMap = new HashMap<String, EntityIdentifier>(); for (OutputPort op : p.getOutputPorts()) { outputDataMap.put(op.getName(), dm.registerError(op.getDepth(), 0, "No message...")); } DispatchResultEvent dre = new DispatchResultEvent(e.getOwningProcess(), e.getIndex(), e.getContext(), outputDataMap, false); getAbove().receiveResult(dre); }
@Override public Map<String, Object> getInputData() { final Map<String, Object> inputData = new HashMap<String, Object>(); final InvocationContext context = this.callback.getContext(); final ReferenceService referenceService = context.getReferenceService(); for (final String inputName : this.inputs.keySet()) { final Object input = referenceService.renderIdentifier(this.inputs .get(inputName), this.getInputPort(inputName) .getTranslatedElementClass(), this.callback.getContext()); inputData.put(inputName, input); } return inputData; }