Package org.cishell.framework.algorithm

Examples of org.cishell.framework.algorithm.Algorithm


    }

    AlgorithmFactory factory = (AlgorithmFactory) Activator.getContext()
        .getService(serviceReference);

    Algorithm algo = factory.createAlgorithm(inputData, parameters,
        Activator.getCiShellContext());
    if (algo instanceof ProgressTrackable) {
      ProgressTrackable pt = (ProgressTrackable) algo;
      pt.setProgressMonitor(new AlgorithmProgressMonitor());
    }
    try {

      Data[] data = algo.execute();
      return data;
    } catch (AlgorithmExecutionException e) {
      String logMessage = String.format(
          "The algorithm \"%s\" failed to execute", name,
          e.getMessage());
View Full Code Here


                }
            }
           
            //TODO: should parse the given hashtable since values may need to
            //be changed to different types (Vector->String[], etc...)
            Algorithm alg = factory.createAlgorithm(dm, dictionary, ciContext);
            if (alg != null) {
                algID = algReg.registerAlgorithm(alg);
            }
        }
       
View Full Code Here

      ProgressMonitor progressMonitor,
      Data[] data,
      Dictionary parameters,
      CIShellContext ciShellContext)
        throws AlgorithmExecutionException {
      Algorithm algorithm = algorithmFactory.createAlgorithm(data, parameters, ciShellContext);

      if ((progressMonitor != null) && (algorithm instanceof ProgressTrackable)) {
        ProgressTrackable progressTrackable = (ProgressTrackable)algorithm;
        progressTrackable.setProgressMonitor(progressMonitor);
      }

      Data[] result = algorithm.execute();

      return result;
    }
View Full Code Here

      ProgressMonitor progressMonitor,
      CIShellContext ciShellContext,
      LogService logger) throws AlgorithmExecutionException {
    Data[] validationData =
      new Data[] { new BasicData(file.getPath(), String.class.getName()) };
    Algorithm algorithm = validator.createAlgorithm(
      validationData, new Hashtable<String, Object>(), ciShellContext);

    if ((progressMonitor != null) && (algorithm instanceof ProgressTrackable)) {
      ProgressTrackable progressTrackable = (ProgressTrackable)algorithm;
      progressTrackable.setProgressMonitor(progressMonitor);
    }

    Data[] validatedData = algorithm.execute();

    if (validatedData != null) {
      logger.log(LogService.LOG_INFO, "Loaded: " + file.getPath());
    }
View Full Code Here

    /**
     * @see org.cishell.remoting.service.framework.AlgorithmRegistry#getAlgorithm(String)
     */
    public Algorithm getAlgorithm(String algorithmID) {
        Algorithm alg = (Algorithm) registry.getObject(algorithmID);
        return alg == null ? NULL_ALG : alg;
    }
View Full Code Here

      Data[] input, Hashtable<String, Object> parameters, CIShellContext ciShellContext)
      throws AlgorithmExecutionException {

    AlgorithmFactory converterFactory =
      (AlgorithmFactory) this.bundleContext.getService(this.serviceReference);
    Algorithm converter = converterFactory.createAlgorithm(input, parameters, ciShellContext);
    Data[] output = converter.execute();
   
    return output;
  }
View Full Code Here

    }

    boolean enabled = false;
   
    if (validSaveFactory) {
      Algorithm algorithm = algorithmFactory.createAlgorithm(
        new Data[] { model },
        new Hashtable<String, Object>(),
        Activator.getCIShellContext());

      if (algorithm != null) {
View Full Code Here

  private class SaveListener implements Listener {
    public void handleEvent(Event event) {
      if (AbstractDataManagerView.this.saveFactory != null) {
        Data data[] = AbstractDataManagerView.this.manager.getSelectedData();
        Algorithm algorithm = AbstractDataManagerView.this.saveFactory.createAlgorithm(
          data, new Hashtable<String, Object>(), Activator.getCIShellContext());

        try {
          algorithm.execute();
        } catch (AlgorithmExecutionException e)  {
          if (AbstractDataManagerView.this.logger != null) {
            AbstractDataManagerView.this.logger.log(
              LogService.LOG_ERROR, e.getMessage(), e);
            e.printStackTrace();
View Full Code Here

  private class ViewListener implements Listener {
    public void handleEvent(Event event) {
      if (AbstractDataManagerView.this.viewFactory != null) {
        Data data[] = AbstractDataManagerView.this.manager.getSelectedData();
        Algorithm algorithm = AbstractDataManagerView.this.viewFactory.createAlgorithm(
          data, new Hashtable<String, Object>(), Activator.getCIShellContext());

        try {
          algorithm.execute();
        } catch (AlgorithmExecutionException e)  {
          if (AbstractDataManagerView.this.logger != null) {
            AbstractDataManagerView.this.logger.log(
              LogService.LOG_ERROR, e.getMessage(), e);
          } else {
View Full Code Here

     * @see org.cishell.framework.algorithm.AlgorithmFactory#createAlgorithm(org.cishell.framework.data.Data[], java.util.Dictionary, org.cishell.framework.CIShellContext)
     */
    public Algorithm createAlgorithm(Data[] dm, Dictionary parameters,
            final CIShellContext context) {
       
        Algorithm algorithm = new Algorithm() {
            public Data[] execute() {
                if (server == null) {
                    startServer(context);
                } else {
                    stopServer(context);
View Full Code Here

TOP

Related Classes of org.cishell.framework.algorithm.Algorithm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.