public Element elementForProcessor(Processor p) { SoaplabProcessor slp = (SoaplabProcessor) p; Element spec = new Element("soaplabwsdl", XScufl.XScuflNS); String endpointString = slp.getEndpoint().toString(); String[] split = endpointString.split("::"); if (split.length == 2) { endpointString = split[0] + "." + split[1]; } spec.setText(endpointString); if (slp.isPollingDefined()) { // Add attributes for polling... spec.setAttribute("interval", slp.getPollingInterval() + ""); spec.setAttribute("backoff", slp.getPollingBackoff() + ""); spec.setAttribute("maxinterval", slp.getPollingIntervalMax() + ""); } return spec; }
public Processor loadProcessorFromXML(Element processorNode, ScuflModel model, String name) throws ProcessorCreationException, DuplicateProcessorNameException, XScuflFormatException { Element soaplab = processorNode .getChild("soaplabwsdl", XScufl.XScuflNS); String endpoint = soaplab.getTextTrim(); try { new URL(endpoint); } catch (MalformedURLException mue) { throw new XScuflFormatException( "The url specified for the soaplab endpoint for '" + name + "' was invalid : " + mue); } SoaplabProcessor theProcessor = new SoaplabProcessor(model, name, endpoint); // Set the polling properties if they're defined, or just use the // defaults // if not. theProcessor.setPolling(Integer.parseInt(soaplab.getAttributeValue( "interval", "0")), Double.parseDouble(soaplab .getAttributeValue("backoff", "1.0")), Integer.parseInt(soaplab .getAttributeValue("intervalmax", "0"))); return theProcessor; }
/** * Set the endpoint for this soaplab processor */ void setEndpoint(String specifier) throws MalformedURLException, ProcessorCreationException { URL new_endpoint = new URL(specifier); if (endpoint != null) { if (endpoint.equals(new_endpoint) == false) { fireModelEvent(new ScuflModelEvent(this, "Service endpoint changed to '" + specifier + "'")); } else { // Do nothing if the endpoint was the same as before return; } } else { fireModelEvent(new ScuflModelEvent(this, "Service endpoint set to '" + specifier + "'")); } endpoint = new_endpoint; try { if (this.isOffline() == false) { generatePorts(); getDescriptionText(); } } catch (PortCreationException pce) { throw new ProcessorCreationException(getName() + ": Exception when trying to create ports\n from Soaplab endpoint : " + pce.getMessage()); } catch (DuplicatePortNameException dpne) { throw new ProcessorCreationException(getName() + ": Exception when trying to create ports\n from Soaplab endpoint : " + dpne.getMessage()); } }
public void actionPerformed(ActionEvent e) { try { processor.setPolling(Integer.parseInt(interval .getText()), Double.parseDouble(backoff .getText()), Integer.parseInt(intervalmax .getText())); } catch (NumberFormatException nfe) { JOptionPane.showMessageDialog(null, "Fields must be valid numbers!\n" + nfe.getMessage(), "Exception!", JOptionPane.ERROR_MESSAGE); interval.setText(processor.getPollingInterval() + ""); intervalmax.setText(processor.getPollingIntervalMax() + ""); backoff.setText(processor.getPollingBackoff() + ""); } } });
@Before public void setUp() throws Exception { System.setProperty("raven.eclipse", "true"); setUpRavenRepository(); ScuflModel model = loadScufl("soaplab-workflow-t1.xml"); Processor[] processors = model.getProcessors(); assertEquals(1, processors.length); assertTrue(processors[0] instanceof SoaplabProcessor); soaplabProcessor = (SoaplabProcessor) processors[0]; inputPortNames = new HashSet<String>(); for (org.embl.ebi.escience.scufl.InputPort port : soaplabProcessor .getInputPorts()) { inputPortNames.add(port.getName()); } outputPortNames = new HashSet<String>(); for (org.embl.ebi.escience.scufl.OutputPort port : soaplabProcessor .getOutputPorts()) { outputPortNames.add(port.getName()); } translator = new SoaplabActivityTranslator(); }
/** * Get the properties for this processor for display purposes */ public Properties getProperties() { Properties props = new Properties(); props.put("Soaplab URL", getEndpoint().toString()); return props; }
new_port.setSyntacticType("l('application/octet-stream')"); this.addPort(new_port); new_port.setSyntacticType("l('application/octet-stream')"); this.addPort(new_port); throw new ProcessorCreationException(getName() + ": Unable to create a new call to connect\n to soaplab, error was : " + se.getMessage()); } catch (RemoteException re) { throw new ProcessorCreationException(getName() + ": Unable to call the get spec method for\n endpoint : " + endpoint.toString() + "\n Remote exception message " + re.getMessage()); } catch (NullPointerException npe) { generatePorts();
public static void main(String[] args) throws Exception { System.out.println("Starting test : SoaplabProcessorCreation"); // Create a new ScuflModel ScuflModel model = new ScuflModel(); // Register a listener to print to stdout model.addListener(new ScuflModelEventPrinter(null)); // Attempt to create a new SoaplabProcessor model.addProcessor(new SoaplabProcessor(model, "my_processor", "http://industry.ebi.ac.uk/soap/soaplab/nucleic_gene_finding::getorf")); System.out.println("Finished test : SoaplabProcessorCreation"); }
@Ignore("Integration test") @Before public void setUp() throws Exception { System.setProperty("raven.eclipse", "true"); setUpRavenRepository(); ScuflModel model = loadScufl("soaplab-workflow-t1.xml"); Processor[] processors = model.getProcessors(); assertEquals(1, processors.length); assertTrue(processors[0] instanceof SoaplabProcessor); soaplabProcessor = (SoaplabProcessor) processors[0]; inputPortNames = new HashSet<String>(); for (org.embl.ebi.escience.scufl.InputPort port : soaplabProcessor .getInputPorts()) { inputPortNames.add(port.getName()); } outputPortNames = new HashSet<String>(); for (org.embl.ebi.escience.scufl.OutputPort port : soaplabProcessor .getOutputPorts()) { outputPortNames.add(port.getName()); } translator = new SoaplabActivityTranslator(); }
public Set<Scavenger> getFromModel(ScuflModel model) { Set<Scavenger> result = new HashSet<Scavenger>(); List<String> existingLocations = new ArrayList<String>(); Processor[] processors = model.getProcessorsOfType(SoaplabProcessor.class); for (Processor processor : processors) { String endpoint = ((SoaplabProcessor) processor).getEndpoint().toString(); if (!existingLocations.contains(endpoint)) { existingLocations.add(endpoint); String[] parts = endpoint.split("/"); String base = ""; for (int j = 0; j < parts.length - 1; j++) { base = base + parts[j] + "/"; } try { result.add(new SoaplabScavenger(base)); } catch (ScavengerCreationException e) { logger.warn("Error creating SoaplabScavenger", e); } } } return result; }
add(Box.createRigidArea(new Dimension(5, 5)), BorderLayout.SOUTH); final JCheckBox isPolling = new JCheckBox("Polling? ", processor .isPollingDefined()); JButton okayButton = new JButton("Apply"); okayButton.setOpaque(false); interval = new JTextField(processor.getPollingInterval() + ""); intervalmax = new JTextField(processor.getPollingIntervalMax() + ""); backoff = new JTextField(processor.getPollingBackoff() + ""); interval.setEnabled(processor.isPollingDefined()); backoff.setEnabled(processor.isPollingDefined()); intervalmax.setEnabled(processor.isPollingDefined()); isPolling.setOpaque(false); buttonPanel.add(isPolling);
URL soaplabEndpoint = sp.getEndpoint(); Call call = (Call) new Service().createCall(); call.setTimeout(new Integer(0));
URL soaplabWSDLURL = proc.getEndpoint(); call.setTargetEndpointAddress(soaplabWSDLURL); .invoke(new Object[] { soaplabInputMap }); OutputPort[] boundOutputs = this.proc.getBoundOutputPorts(); String[] outputPortNames = new String[boundOutputs.length]; for (int i = 0; i < outputPortNames.length; i++) { if (!this.proc.isPollingDefined()) { int pollingInterval = this.proc.getPollingInterval(); while (polling) { try { || statusString.equals("CREATED")) { pollingInterval = (int) ((double) pollingInterval * this.proc .getPollingBackoff()); if (pollingInterval > this.proc.getPollingIntervalMax()) { pollingInterval = this.proc.getPollingIntervalMax();
@Test public void testCreateConfigTypeProcessor() throws Exception { SoaplabActivityConfigurationBean bean = translator .createConfigType(soaplabProcessor); assertNotNull(bean); assertEquals(soaplabProcessor.getEndpoint().toString(), bean .getEndpoint()); assertEquals(soaplabProcessor.getPollingInterval(), bean .getPollingInterval()); assertEquals(soaplabProcessor.getPollingBackoff(), bean .getPollingBackoff(), 0); assertEquals(soaplabProcessor.getPollingIntervalMax(), bean .getPollingIntervalMax()); }
@Ignore("Integration test") @Test public void testCreateConfigTypeProcessor() throws Exception { SoaplabActivityConfigurationBean bean = translator .createConfigType(soaplabProcessor); assertNotNull(bean); assertEquals(soaplabProcessor.getEndpoint().toString(), bean .getEndpoint()); assertEquals(soaplabProcessor.getPollingInterval(), bean .getPollingInterval()); assertEquals(soaplabProcessor.getPollingBackoff(), bean .getPollingBackoff(), 0); assertEquals(soaplabProcessor.getPollingIntervalMax(), bean .getPollingIntervalMax()); }
@Test public void testDoTranslationProcessor() throws Exception { SoaplabActivity activity = (SoaplabActivity) translator .doTranslation(soaplabProcessor); assertEquals(soaplabProcessor.getEndpoint().toString(), activity .getConfiguration().getEndpoint()); assertEquals(soaplabProcessor.getPollingInterval(), activity .getConfiguration().getPollingInterval()); assertEquals(soaplabProcessor.getPollingBackoff(), activity .getConfiguration().getPollingBackoff(), 0); assertEquals(soaplabProcessor.getPollingIntervalMax(), activity .getConfiguration().getPollingIntervalMax()); assertEquals(inputPortNames.size(), activity.getInputPorts().size()); for (InputPort port : activity.getInputPorts()) { assertTrue(inputPortNames.remove(port.getName())); } assertEquals(outputPortNames.size(), activity.getOutputPorts().size()); for (OutputPort port : activity.getOutputPorts()) { assertTrue(outputPortNames.remove(port.getName())); } }
@Ignore("Integration test") @Test public void testDoTranslationProcessor() throws Exception { SoaplabActivity activity = (SoaplabActivity) translator .doTranslation(soaplabProcessor); assertEquals(soaplabProcessor.getEndpoint().toString(), activity .getConfiguration().getEndpoint()); assertEquals(soaplabProcessor.getPollingInterval(), activity .getConfiguration().getPollingInterval()); assertEquals(soaplabProcessor.getPollingBackoff(), activity .getConfiguration().getPollingBackoff(), 0); assertEquals(soaplabProcessor.getPollingIntervalMax(), activity .getConfiguration().getPollingIntervalMax()); assertEquals(inputPortNames.size(), activity.getInputPorts().size()); for (InputPort port : activity.getInputPorts()) { assertTrue(inputPortNames.remove(port.getName())); } assertEquals(outputPortNames.size(), activity.getOutputPorts().size()); for (OutputPort port : activity.getOutputPorts()) { assertTrue(outputPortNames.remove(port.getName())); } }