Package org.openscoring.service

Examples of org.openscoring.service.ModelRegistry


      process((WatchEvent.Kind<Path>)event.kind(), directory.resolve((Path)event.context()));
    }
  }

  private void process(WatchEvent.Kind<Path> kind, Path path){
    ModelRegistry modelRegistry = getModelRegistry();

    String id = (path.getFileName()).toString();

    // Remove file name extension
    // Start the search from the beginning of the file name, in case there are multiple extensions
    int dot = id.indexOf('.');
    if(dot > -1){
      id = id.substring(0, dot);
    } // End if

    if(!ModelRegistry.validateId(id)){
      return;
    } // End if

    if((StandardWatchEventKinds.ENTRY_CREATE).equals(kind)){
      ModelEvaluator<?> evaluator;

      try {
        InputStream is = Files.newInputStream(path);

        try {
          evaluator = ModelRegistry.unmarshal(is);
        } finally {
          is.close();
        }
      } catch(Exception e){
        // Ignored

        return;
      }

      modelRegistry.put(id, evaluator);
    } else

    if((StandardWatchEventKinds.ENTRY_DELETE).equals(kind)){
      ModelEvaluator<?> evaluator = modelRegistry.get(id);

      modelRegistry.remove(id, evaluator);
    }
  }
View Full Code Here


    Server server = new Server(address);

    ContextHandlerCollection handlerCollection = new ContextHandlerCollection();

    final
    ModelRegistry modelRegistry = new ModelRegistry();

    final
    MetricRegistry metricRegistry = new MetricRegistry();

    Binder binder = new AbstractBinder(){
View Full Code Here

TOP

Related Classes of org.openscoring.service.ModelRegistry

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.