Examples of ModelRegistry


Examples of org.gradle.model.internal.registry.ModelRegistry

        }

        services = serviceRegistryFactory.createFor(this);
        taskContainer = services.newInstance(TaskContainerInternal.class);

        final ModelRegistry modelRegistry = services.get(ModelRegistry.class);

        modelRegistry.create(
                ModelCreators.of(ModelReference.of("serviceRegistry", ServiceRegistry.class), services)
                        .simpleDescriptor("Project.<init>.serviceRegistry()")
                        .build()
        );

        modelRegistry.create(
                ModelCreators.of(ModelReference.of("buildDir", File.class), new Factory<File>() {
                    public File create() {
                        return getBuildDir();
                    }
                })
                        .simpleDescriptor("Project.<init>.buildDir()")
                        .build()
        );

        modelRegistry.create(
                ModelCreators.of(ModelReference.of("projectIdentifier", ProjectIdentifier.class), this)
                        .simpleDescriptor("Project.<init>.projectIdentifier()")
                        .build()
        );

        modelRegistry.create(
                ModelCreators.of(ModelReference.of("extensions", ExtensionContainer.class), new Factory<ExtensionContainer>() {
                    public ExtensionContainer create() {
                        return getExtensions();
                    }
                })
                        .simpleDescriptor("Project.<init>.extensions()")
                        .build()
        );

        modelRegistry.create(
                ModelCreators.of(ModelReference.of(TaskContainerInternal.MODEL_PATH, ModelType.of(TaskContainer.class)), taskContainer)
                        .simpleDescriptor("Project.<init>.tasks()")
                        .withProjection(new PolymorphicDomainObjectContainerModelProjection<TaskContainerInternal, Task>(taskContainer, Task.class))
                        .build());

        taskContainer.all(new Action<Task>() {
            public void execute(final Task task) {
                final String name = task.getName();
                final ModelPath modelPath = TaskContainerInternal.MODEL_PATH.child(name);

                ModelState state = modelRegistry.state(modelPath);
                if (state == null || state.getStatus() != ModelState.Status.IN_CREATION) {
                    modelRegistry.create(
                            ModelCreators.of(ModelReference.of(modelPath, ModelType.typeOf(task)), task)
                                    .simpleDescriptor("Project.<init>.tasks." + name + "()")
                                    .build()
                    );
                }
            }
        });

        taskContainer.whenObjectRemoved(new Action<Task>() {
            public void execute(Task task) {
                modelRegistry.remove(TaskContainerInternal.MODEL_PATH.child(task.getName()));
            }
        });

        extensibleDynamicObject = new ExtensibleDynamicObject(this, services.get(Instantiator.class));
        if (parent != null) {
View Full Code Here

Examples of org.openengsb.core.ekb.api.ModelRegistry

        views.add(new XLinkConnectorView(viewId2, toolName, descriptions));
        modelsToViews.put(new ModelDescription(exampleModelClass.getName(), exampleModelClassVersion),
                views.toArray(new XLinkConnectorView[0]));
   
        serviceFinder = mock(OsgiUtilsService.class);
        ModelRegistry registry = mock(ModelRegistry.class);
        when(serviceFinder.getService(ModelRegistry.class)).thenReturn(registry);
       
        when(registry.loadModel(isA(ModelDescription.class))).thenReturn(exampleModelClass);
       
    }
View Full Code Here

Examples of org.openengsb.core.ekb.api.ModelRegistry

    @Before
    public void setup() {
        EngineeringDatabaseService edbService = new TestEngineeringDatabaseService();
        EDBConverter edbConverter = new EDBConverter(edbService);
        TransformationEngine transformationEngine = new TestTransformationEngine();
        ModelRegistry modelRegistry = new TestModelRegistry();
        enhancer = new EngineeringObjectEnhancer(edbService, edbConverter,
            transformationEngine, modelRegistry, mode.toString());
        ContextHolder.get().setCurrentContextId(CONTEXT_ID);
    }   
View Full Code Here

Examples of org.openengsb.core.ekb.api.ModelRegistry

     * Throws a ClassNotFoundException if the Class/Version pair is not found.
     */
    public static Class getClassOfOpenEngSBModel(String clazz,
            String version,
            OsgiUtilsService serviceFinder) throws ClassNotFoundException {
        ModelRegistry registry = serviceFinder.getService(ModelRegistry.class);
        ModelDescription modelDescription = new ModelDescription(clazz, version);
        Class clazzObject = registry.loadModel(modelDescription);  
        return clazzObject;
    }
View Full Code Here

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

Examples of org.openscoring.service.ModelRegistry

    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
Copyright © 2018 www.massapi.com. 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.