/** * Only handles {@link LocalServiceProcessor} based on {@link FlattenList} */ public boolean canHandle(Processor processor) { if (!(processor instanceof LocalServiceProcessor)) { return false; } LocalServiceProcessor proc = (LocalServiceProcessor) processor; return proc.getWorker() instanceof FlattenList; }
public boolean canHandle(Processor processor) { if (processor instanceof LocalServiceProcessor) { LocalServiceProcessor local = (LocalServiceProcessor) processor; return local.getWorkerClassName().matches( "^(\\w+\\.)+\\w+Moby\\w+$"); } return false; }
@Test public void testCantHandleOtherLocalWorkers() throws Exception { XMLOutputSplitterLocalWorkerTranslator translator = new XMLOutputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor(null, "EchoList", new EchoList()); assertFalse("should not be able to handle the local service",translator.canHandle(processor)); }
LocalServiceProcessor processor = new LocalServiceProcessor( model, model.getValidProcessorName(name), splitter); model.addProcessor(processor); model.addDataConstraint(new DataConstraint(model, processor.getOutputPorts()[0], inputPort));
LocalServiceProcessor processor = new LocalServiceProcessor( model, model.getValidProcessorName(name), splitter); model.addProcessor(processor); model.addDataConstraint(new DataConstraint(model, outputPort, processor.getInputPorts()[0]));
@Test public void testCantHandleOtherLocalWorkers() throws Exception { XMLInputSplitterLocalWorkerTranslator translator = new XMLInputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor(null, "EchoList", new EchoList()); assertFalse("should not be able to handle the EchoList localworker",translator.canHandle(processor)); }
@Test public void testLocalWorkerTranslatorCanHandle() throws Exception { XMLInputSplitterLocalWorkerTranslator translator = new XMLInputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor( null, "XMLInputSplitter", new XMLInputSplitter()); assertTrue("should be able to handle XMLInputSplitter",translator.canHandle(processor)); }
/** * Only handles {@link LocalServiceProcessor} based on {@link SliceList} */ public boolean canHandle(Processor processor) { if (!(processor instanceof LocalServiceProcessor)) { return false; } LocalServiceProcessor proc = (LocalServiceProcessor) processor; return proc.getWorker() instanceof SliceList; }
/** * Normally the key is simply the fully qualified class name, unless it is a LocalServiceProcessor. * If a LocalServiceProcessor then the key is LocalServiceProcessor: plus the worker classname. * @param processor * @return the key */ protected static String generateProcessorKey(Processor processor) { if (!(processor instanceof LocalServiceProcessor)) { return processor.getClass().getName(); } else { //TODO: would be more desirable to do this through introspection to avoid the added dependency on taverna-java-processor String key="LocalServiceProcessor:"; key+=((LocalServiceProcessor)processor).getWorkerClassName(); return key; } }
@Test public void testCantHandleInputSplitter() throws Exception { XMLOutputSplitterLocalWorkerTranslator translator = new XMLOutputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor( null, "XMLInputSplitter", new XMLInputSplitter()); assertFalse("should not be able to handle XMLInputSplitter",translator.canHandle(processor)); }
final SliceList slicer = (SliceList) proc.getWorker();
/** * Normally the key is simply the fully qualified class name, unless it is a LocalServiceProcessor. * If a LocalServiceProcessor then the key is LocalServiceProcessor: plus the worker classname. * @param processor * @return the key */ protected static String generateProcessorKey(Processor processor) { if (!(processor instanceof LocalServiceProcessor)) { return processor.getClass().getName(); } else { //TODO: would be more desirable to do this through introspection to avoid the added dependency on taverna-java-processor String key="LocalServiceProcessor:"; key+=((LocalServiceProcessor)processor).getWorkerClassName(); return key; } }
@Test public void testCanHandle() throws Exception { XMLOutputSplitterLocalWorkerTranslator translator = new XMLOutputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor( null, "XMLInputSplitter", new XMLOutputSplitter()); assertTrue("should be able to handle XMLOutputSplitter",translator.canHandle(processor)); }
final FlattenList flattener = (FlattenList) proc.getWorker();
@Test public void testCanHandle() throws Exception { XMLOutputSplitterLocalWorkerTranslator translator = new XMLOutputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor( null, "XMLInputSplitter", new XMLOutputSplitter()); assertTrue("should be able to handle XMLOutputSplitter",translator.canHandle(processor)); }
@Override protected XMLSplitterConfigurationBean createConfigType(Processor processor) throws ActivityTranslationException { XMLSplitterConfigurationBean bean = new XMLSplitterConfigurationBean(); populateConfigurationBeanPortDetails(processor, bean); LocalServiceProcessor localServiceProcessor = (LocalServiceProcessor)processor; //TODO: doing this with introspection would remove the dependency on taverna-java-processor Element element = ((XMLExtensible)localServiceProcessor.getWorker()).provideXML(); String xml = new XMLOutputter().outputString(element); bean.setWrappedTypeXML(xml); return bean; }
@Test public void testCantHandleOtherLocalWorkers() throws Exception { XMLOutputSplitterLocalWorkerTranslator translator = new XMLOutputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor(null, "EchoList", new EchoList()); assertFalse("should not be able to handle the EchoList localworker",translator.canHandle(processor)); }
@Override protected XMLSplitterConfigurationBean createConfigType(Processor processor) throws ActivityTranslationException { XMLSplitterConfigurationBean bean = new XMLSplitterConfigurationBean(); populateConfigurationBeanPortDetails(processor, bean); LocalServiceProcessor localServiceProcessor = (LocalServiceProcessor)processor; //TODO: doing this with introspection would remove the dependency on taverna-java-processor Element element = ((XMLExtensible)localServiceProcessor.getWorker()).provideXML(); String xml = new XMLOutputter().outputString(element); bean.setWrappedTypeXML(xml); return bean; }
@Test public void testLocalWorkerTranslatorCanHandle() throws Exception { XMLInputSplitterLocalWorkerTranslator translator = new XMLInputSplitterLocalWorkerTranslator(); LocalServiceProcessor processor = new LocalServiceProcessor( null, "XMLInputSplitter", new XMLInputSplitter()); assertTrue("should be able to handle XMLInputSplitter",translator.canHandle(processor)); }
@Override protected XMLSplitterConfigurationBean createConfigType(Processor processor) throws ActivityTranslationException { XMLSplitterConfigurationBean bean = new XMLSplitterConfigurationBean(); populateConfigurationBeanPortDetails(processor, bean); //TODO: doing this with introspection would remove the dependency on taverna-java-processor LocalServiceProcessor localServiceProcessor = (LocalServiceProcessor)processor; Element element = ((XMLExtensible)localServiceProcessor.getWorker()).provideXML(); String xml = new XMLOutputter().outputString(element); bean.setWrappedTypeXML(xml); return bean; }