当前位置: 首页>>代码示例>>Java>>正文


Java AsynchronousActivityCallback.requestRun方法代码示例

本文整理汇总了Java中net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback.requestRun方法的典型用法代码示例。如果您正苦于以下问题:Java AsynchronousActivityCallback.requestRun方法的具体用法?Java AsynchronousActivityCallback.requestRun怎么用?Java AsynchronousActivityCallback.requestRun使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback的用法示例。


在下文中一共展示了AsynchronousActivityCallback.requestRun方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    callback.requestRun(new Runnable() {
        public void run() {
            logger.info("Activity started");

            // Read images
            BufferedImage[] images = readImages(inputs, callback);
            if (images == null) {
                return;
            }

            executeQa(new PaeQa(), images[0], images[1], callback);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:17,代码来源:PAEActivity.java

示例2: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    callback.requestRun(new Runnable() {
        public void run() {
            logger.info("Activity started");

            // Read images
            BufferedImage[] images = readImages(inputs, callback);
            if (images == null) {
                return;
            }

            executeQa(new AeQa(), images[0], images[1], callback);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:17,代码来源:AEActivity.java

示例3: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    callback.requestRun(new Runnable() {
        public void run() {
            logger.info("Activity started");

            // Read images
            BufferedImage[] images = readImages(inputs, callback);
            if (images == null) {
                return;
            }

            executeQa(new MaeQa(), images[0], images[1], callback);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:17,代码来源:MAEActivity.java

示例4: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    callback.requestRun(new Runnable() {
        public void run() {
            logger.info("Activity started");

            // Read images
            BufferedImage[] images = readImages(inputs, callback);
            if (images == null) {
                return;
            }

            SsimQa ssimQa = new SsimQa();
            if (getConfiguration().getTargetSize() > 0) {
                ssimQa.targetSize(getConfiguration().getTargetSize());
            }
            if (!getConfiguration().isDoThreaded()) {
                ssimQa.numThreads(0);
            } else {
                ssimQa.numThreads(getConfiguration().getThreadPoolSize());
            }

            executeQa(new SsimQa(), images[0], images[1], callback);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:27,代码来源:SimpleSSIMActivity.java

示例5: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    callback.requestRun(new Runnable() {
        public void run() {
            logger.info("Activity started");

            // Read images
            BufferedImage[] images = readImages(inputs, callback);
            if (images == null) {
                return;
            }

            executeQa(new MseQa(), images[0], images[1], callback);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:17,代码来源:MSEActivity.java

示例6: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    callback.requestRun(new Runnable() {
        public void run() {
            logger.info("Activity started");

            // Read images
            BufferedImage[] images = readImages(inputs, callback);
            if (images == null) {
                return;
            }

            // Process images
            Map<String, T2Reference> outputs = null;
            if (images[0].getWidth() != images[1].getWidth() || images[0].getHeight() != images[1].getHeight()) {
                logger.debug("Images have different size");
                InvocationContext context = callback.getContext();
                ReferenceService referenceService = context.getReferenceService();
                outputs = new HashMap<String, T2Reference>();

                T2Reference aggregatedRef = referenceService.register(false, 0, true, context);
                outputs.put(OUT, aggregatedRef);
            } else {
                EqualQa equalQa = new EqualQa();
                TransientOperation<Boolean, Boolean> op = equalQa.evaluate(images[0], images[1]);
                outputs = registerOutputs(callback, op);
            }

            // Return results
            callback.receiveResult(outputs, new int[0]);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:34,代码来源:EqualActivity.java

示例7: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    // Don't execute service directly now, request to be run ask to be run
    // from thread pool and return asynchronously
    callback.requestRun(new Runnable() {

        public void run() {
            logger.info("Activity started");

            InvocationContext context = callback.getContext();
            ReferenceService referenceService = context.getReferenceService();

            // Resolve inputs
            String fits1 = (String) referenceService.renderIdentifier(inputs.get(IN_FITS_1), String.class, context);
            String fits2 = (String) referenceService.renderIdentifier(inputs.get(IN_FITS_2), String.class, context);

            if (logger.isInfoEnabled()) {
                logger.info("Image paths: " + fits1 + ", " + fits2);
            }

            // Evaluate FITS
            JavaFITSEvaluator evaluator = new JavaFITSEvaluator();
            HashMap<MeasurementInfoUri, Value> results = new HashMap<MeasurementInfoUri, Value>();

            try {
                results = evaluator.evaluate(fits1, fits2, measurementInfoUris);
            } catch (EvaluatorException e) {
                logger.error("Error evaluating " + IN_FITS_2 + " and " + IN_FITS_2, e);
                callback
                    .fail("JavaImageEvalutatorActivity: Error evaluating " + IN_FITS_2 + " and " + IN_FITS_2, e);
                return;
            }

            // Register outputs
            Map<String, T2Reference> outputs = registerOutputs(callback, results);

            // Return map of output data, with empty index array as this is
            // the only and final result (this index parameter is used if
            // pipelining output)
            callback.receiveResult(outputs, new int[0]);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:44,代码来源:JavaFITSEvaluatorActivity.java

示例8: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    // Don't execute service directly now, request to be run ask to be run
    // from thread pool and return asynchronously
    callback.requestRun(new Runnable() {

        public void run() {
            InvocationContext context = callback.getContext();
            ReferenceService referenceService = context.getReferenceService();
            // Resolve inputs
            String firstInput = (String) referenceService.renderIdentifier(inputs.get(IN_FIRST_INPUT),
                String.class, context);

            // Support our configuration-dependendent input
            boolean optionalPorts = configBean.getExampleString().equals("specialCase");

            List<byte[]> special = null;
            // We'll also allow IN_EXTRA_DATA to be optionally not provided
            if (optionalPorts && inputs.containsKey(IN_EXTRA_DATA)) {
                // Resolve as a list of byte[]
                special = (List<byte[]>) referenceService.renderIdentifier(inputs.get(IN_EXTRA_DATA), byte[].class,
                    context);
            }

            // TODO: Do the actual service invocation
            // try {
            // results = this.service.invoke(firstInput, special)
            // } catch (ServiceException ex) {
            // callback.fail("Could not invoke RAWverna service " +
            // configBean.getExampleUri(),
            // ex);
            // // Make sure we don't call callback.receiveResult later
            // return;
            // }

            // Register outputs
            Map<String, T2Reference> outputs = new HashMap<String, T2Reference>();
            String simpleValue = "simple";
            T2Reference simpleRef = referenceService.register(simpleValue, 0, true, context);
            outputs.put(OUT_SIMPLE_OUTPUT, simpleRef);

            // For list outputs, only need to register the top level list
            List<String> moreValues = new ArrayList<String>();
            moreValues.add("Value 1");
            moreValues.add("Value 2");
            T2Reference moreRef = referenceService.register(moreValues, 1, true, context);
            outputs.put(OUT_MORE_OUTPUTS, moreRef);

            if (optionalPorts) {
                // Populate our optional output port
                // NOTE: Need to return output values for all defined output
                // ports
                String report = "Everything OK";
                outputs.put(OUT_REPORT, referenceService.register(report, 0, true, context));
            }

            // return map of output data, with empty index array as this is
            // the only and final result (this index parameter is used if
            // pipelining output)
            callback.receiveResult(outputs, new int[0]);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:65,代码来源:RAWvernaActivity.java

示例9: executeAsynch

import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback; //导入方法依赖的package包/类
@Override
public void executeAsynch(final Map<String, T2Reference> inputs, final AsynchronousActivityCallback callback) {
    // Don't execute service directly now, request to be run
    // from thread pool and return asynchronously
    callback.requestRun(new Runnable() {

        public void run() {
            logger.info("Activity started");

            // Get context and reference service
            InvocationContext context = callback.getContext();
            ReferenceService referenceService = context.getReferenceService();

            // Wrap image 1
            logger.info("Loading image on port " + IN_IMAGE_1);
            BufferedImage image1 = wrapInputImage(callback, inputs.get(IN_IMAGE_1));
            if (null == image1) {
                callback.fail("JavaImageEvalutatorActivity: 2 Could not read image on port " + IN_IMAGE_1);
                logger.error("Could not read image on port " + IN_IMAGE_1);
                return;
            }

            // Wrap image 2
            logger.info("Loading image on port " + IN_IMAGE_2);
            BufferedImage image2 = wrapInputImage(callback, inputs.get(IN_IMAGE_2));
            if (null == image2) {
                callback.fail("JavaImageEvalutatorActivity: 2 Could not read image on port " + IN_IMAGE_2);
                logger.error("Could not read image on port " + IN_IMAGE_2);
                return;
            }

            // Evaluate Images
            JavaImageComparisonEvaluator evaluator = new JavaImageComparisonEvaluator();
            HashMap<MeasurementInfoUri, Value> results = new HashMap<MeasurementInfoUri, Value>();

            try {
                logger.info("Evaluating images");
                results = evaluator.evaluate(image1, image2, measurementInfoUris);
            } catch (EvaluatorException e) {
                logger.error("Error evaluating " + IN_IMAGE_1 + " and " + IN_IMAGE_2, e);
                callback.fail("JavaImageEvalutatorActivity: Error evaluating " + IN_IMAGE_1 + " and " + IN_IMAGE_2,
                    e);
                return;
            }

            // Register outputs
            Map<String, T2Reference> outputs = registerOutputs(callback, results);

            // Return map of output data, with empty index array as this is
            // the only and final result (this index parameter is used if
            // pipelining output)
            callback.receiveResult(outputs, new int[0]);
        }
    });
}
 
开发者ID:datascience,项目名称:photohawk,代码行数:56,代码来源:JavaImageEvaluatorActivity.java


注:本文中的net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback.requestRun方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。