/** * Go online */ @Override public void setOnline() { try { theInternalModel.setOffline(false); logger.info("Set nested processor online"); } catch (SetOnlineException soe) { logger.warn("Could not set nested processor online", soe); } }
/** * Go offline */ @Override public void setOffline() { try { theInternalModel.setOffline(true); logger.info("Set nested processor offline"); } catch (SetOnlineException soe) { logger.warn("Could not set nested processor offline", soe); } }
public void setSelected(boolean b) { try { model.setOffline(b); } catch (SetOnlineException e) { // TODO Handle SetOnlineException e.printStackTrace(); } }
/** * Construct a new processor with a blank internal workflow */ public WorkflowProcessor(ScuflModel model, String name) throws ProcessorCreationException, DuplicateProcessorNameException { super(model, name); theInternalModel = new ScuflModel(); try { if (model != null) { theInternalModel.setOffline(model.isOffline()); } } catch (SetOnlineException soe) { // } }
"Warning", JOptionPane.WARNING_MESSAGE); try { model.setOffline(true); XScuflParser.populate(urlConnection.getInputStream(), model, null);
/** * Construct a new processor with the given model to bind to, name and URL * of a workflow description to contain. */ public WorkflowProcessor(ScuflModel model, String name, String definitionURL) throws ProcessorCreationException, DuplicateProcessorNameException { super(model, name); this.definitionURL = definitionURL; try { // Create a new model instance theInternalModel = new ScuflModel(); try { theInternalModel.setOffline(model.isOffline()); } catch (SetOnlineException soe) { // } // Populate from the definition URL XScuflParser.populate(new URL(definitionURL).openStream(), theInternalModel, null); buildPorts(); } catch (MalformedURLException mue) { throw new ProcessorCreationException("The supplied definition URL was malformed, specified as '" + definitionURL + "'"); } catch (Exception e) { e.printStackTrace(); throw new ProcessorCreationException("The workflow processor '" + name + "' caused an exception :\n" + e.getMessage() + "\n during creation. The exception had type :\n" + e.getClass().toString()); } }
/** * Create a new Workflow scavenger, the single parameter should be * resolvable to a location from which the definition could be fetched. */ public WorkflowScavenger(String definitionURL) throws ScavengerCreationException { super(new WorkflowProcessorFactory(definitionURL)); // Get a reference back to the processor factory ProcessorFactory rootPF = (ProcessorFactory) getUserObject(); // Crafty addition of a load of the workflow in offline mode // followed by extraction of all the processors... ScuflModel model = new ScuflModel(); try { model.setOffline(true); XScuflParser.populate(new URL(definitionURL).openStream(), model, null); rootPF.setDescription(model.getDescription().getText()); } catch (Exception ex) { ex.printStackTrace(); } doChildren(model); }
/** * Construct a new processor from the supplied JDOM element, this element * being the 'scufl' top level workflow element from an inline nested * workflow declaration */ public WorkflowProcessor(ScuflModel model, String name, Element scuflElement) throws ProcessorCreationException, DuplicateProcessorNameException { super(model, name); // Have to clone the element because it already has a parent // so will not work with a new document instance try { Document doc = new Document((Element) scuflElement.clone()); theInternalModel = new ScuflModel(); try { if (model != null) { theInternalModel.setOffline(model.isOffline()); } } catch (SetOnlineException soe) { // } XScuflParser.populate(doc, theInternalModel, null); setDescription(theInternalModel.getDescription().getText()); buildPorts(); } catch (Exception e) { throw new ProcessorCreationException("The workflow processor '" + name + "' caused an exception :\n" + e.getMessage() + "\n during creation. The exception had type :\n" + e.getClass().toString()); } }
protected Dataflow openDataflowStream(InputStream inputStream, boolean online) throws OpenException { ScuflModel scuflModel = new ScuflModel(); if (!online) { try { scuflModel.setOffline(true); } catch (SetOnlineException e) { throw new OpenException("Could not go offline", e); } } try { XScuflParser.populate(inputStream, scuflModel, null); } catch (ScuflException e1) { throw new OpenException("Could not parse Scufl file", e1); } Dataflow dataflow; try { dataflow = WorkflowModelTranslator.doTranslation(scuflModel); } catch (WorkflowTranslationException e) { throw new OpenException("Could not translate Scufl file:\n " + e.getMessage().toString(), e); } return dataflow; }
/** * Create a new workflow scavenger from a JDOM Document and a name, the name * is required because there's no way to infer this from the document, it's * a property of the storage medium. */ public WorkflowScavenger(Document doc, String workflowName) throws ScavengerCreationException { super(new WorkflowProcessorFactory(doc.getRootElement())); ProcessorFactory rootPF = (ProcessorFactory) getUserObject(); rootPF.setName(workflowName); ScuflModel model = new ScuflModel(); try { model.setOffline(true); XScuflParser.populate(doc, model, null); rootPF.setDescription(model.getDescription().getText()); } catch (Exception ex) { throw new ScavengerCreationException("Cannot create scavenger " + ex); } doChildren(model); }
model.forceUpdate(); assertEquals("Forced update", getEvent(events, model.notifyThread)); model.setOffline(true); assertEquals("Offline status change", getEvent(events, model.notifyThread)); model.addProcessor(new Processor(model, "proc"){
model.setOffline(true); model.locatePortOrCreate(port_name, true); assertEquals("input1", model.locatePort(port_name).getName());