Package org.apache.tuscany.model.assembly

Examples of org.apache.tuscany.model.assembly.ModuleComponent


        // bootstrap the registries needed by the bootstrap loaders above
        bootstrapService(factory, introspector, module, StAXLoaderRegistry.class, StAXLoaderRegistryImpl.class);
        bootstrapService(factory, introspector, module, SystemAssemblyFactory.class, SystemAssemblyFactoryImpl.class);
        bootstrapService(factory, introspector, module, ComponentTypeIntrospector.class, Java5ComponentTypeIntrospector.class);

        ModuleComponent mc = factory.createModuleComponent();
        mc.setName(name);
        mc.setImplementation(module);
        mc.initialize(context);
        return mc;
    }
View Full Code Here


            AssemblyContextImpl modelContext = new AssemblyContextImpl(modelFactory, modelLoader, resourceLoader, ctx.getName());

            ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(runtime.getSystemContext(), modelContext);

            // Load the SCDL configuration of the application module
            ModuleComponent moduleComponent = loader.loadModuleComponent(ctx.getName(), ctx.getPath());

            // Register it under the root application context
            CompositeContext rootContext = runtime.getRootContext();
            rootContext.registerModelObject(moduleComponent);
            moduleContext = (CompositeContext) rootContext.getContext(moduleComponent.getName());
            //TODO remove the hack below
            moduleContext.setAssemblyContext(modelContext);
        } finally {
            Thread.currentThread().setContextClassLoader(oldCl);
        }
View Full Code Here

        // Load and start the system configuration
        SystemCompositeContext systemContext = runtime.getSystemContext();
        BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext);
        ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext);
        ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT);
        CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent);
        context.publish(new ModuleStart(this));

        // Load the SCDL configuration of the application module
        CompositeContext rootContext = runtime.getRootContext();
        ModuleComponent moduleComponent = loader.loadModuleComponent(name, uri);
        moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent);
        if (moduleContext.getURI() == null){
            moduleContext.setURI(uri);
        }
        //TODO remove hack
View Full Code Here

     * @param modelContext
     * @return the system context for the loader
     * @throws ConfigurationException
     */
    public static CompositeContext bootstrapStaxLoader(SystemCompositeContext parentContext, AssemblyContext modelContext) throws ConfigurationException {
        ModuleComponent loaderComponent = StAXUtil.bootstrapLoader(SYSTEM_LOADER_COMPONENT, modelContext);
        CompositeContext loaderContext = registerModule(parentContext, loaderComponent);
        loaderContext.publish(new ModuleStart(loaderComponent));
        return loaderContext;
    }
View Full Code Here

    /**
     * Tests registration of a 3-level deep hierarchy under the top-level system composite context
     */
    public void testSystemContext() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        ModuleComponent child1 = createHierarchy();
        runtime.getSystemContext().registerModelObject(child1);
        CompositeContext child1Ctx = (CompositeContext) runtime.getSystemContext().getContext("child1");
        Assert.assertNotNull(child1Ctx);
        child1Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child1Ctx);
View Full Code Here

    /**
     * Tests registration of a 3-level deep hierarchy under the root application composite context
     */
    public void testRootContext() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        ModuleComponent child1 = createHierarchy();
        runtime.getRootContext().registerModelObject(child1);
        CompositeContext child1Ctx = (CompositeContext) runtime.getRootContext().getContext("child1");
        Assert.assertNotNull(child1Ctx);
        child1Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child1Ctx);
View Full Code Here

        Assert.assertNull(child1Ctx.getContext("child3")); // sanity check
        child1Ctx.publish(new ModuleStop(this));
    }

    private ModuleComponent createHierarchy() throws ConfigurationLoadException {
        ModuleComponent child3 = MockFactory.createSystemModuleComponentWithWiredComponents("child3", Scope.MODULE, Scope.MODULE);
        ModuleComponent child2 = MockFactory.createSystemModuleComponentWithWiredComponents("child2", Scope.MODULE, Scope.MODULE);
        child2.getImplementation().getComponents().add(child3);
        ModuleComponent child1 = MockFactory.createSystemModuleComponentWithWiredComponents("child1", Scope.MODULE, Scope.MODULE);
        child1.getImplementation().getComponents().add(child2);
        return child1;
    }
View Full Code Here

        // Load and start the system configuration
        SystemCompositeContext systemContext = runtime.getSystemContext();
        BootstrapHelper.bootstrapStaxLoader(systemContext, modelContext);
        ModuleComponentConfigurationLoader loader = BootstrapHelper.getConfigurationLoader(systemContext, modelContext);
        ModuleComponent systemModuleComponent = loader.loadSystemModuleComponent(SYSTEM_MODULE_COMPONENT, SYSTEM_MODULE_COMPONENT);
        CompositeContext context = BootstrapHelper.registerModule(systemContext, systemModuleComponent);
        context.publish(new ModuleStart(this));

        // Load the SCDL configuration of the application module
        CompositeContext rootContext = runtime.getRootContext();
        ModuleComponent moduleComponent = loader.loadModuleComponent(name, uri);
        moduleContext = BootstrapHelper.registerModule(rootContext, moduleComponent);

        moduleContext.publish(new ModuleStart(this));
    }
View Full Code Here

    private RuntimeContext createScenario1Runtime() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        runtime.start();
        SystemCompositeContext system = runtime.getSystemContext();
        ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1");
        ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a");
        system1Component.getImplementation().getComponents().add(system1aComponent);
        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        system1Component.getImplementation().getComponents().add(target);

        EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target);
        system1Component.getImplementation().getEntryPoints().add(ep);
        system.registerModelObject(system1Component);
        EntryPoint systemEp = MockFactory.createEPSystemBinding("target.system.ep", Target.class, "ref");

        systemEp.getBindings().add(systemFactory.createSystemBinding());
        Service service = systemFactory.createService();
        service.setName("system1/target.ep");
        (systemEp.getConfiguredReference().getTargetConfiguredServices().get(0)).setPort(service);

        system.registerModelObject(systemEp);
        ModuleComponent app1Component = createAppModuleComponent("app1");
        ModuleComponent app1aComponent = createAppModuleComponent("app1a");
        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        app1aComponent.getImplementation().getComponents().add(source);
        app1Component.getImplementation().getComponents().add(app1aComponent);
        CompositeContext root = runtime.getRootContext();
        root.registerModelObject(app1Component);
        system.publish(new ModuleStart(this));
        return runtime;
View Full Code Here

    private RuntimeContext createScenario2Runtime() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        runtime.start();

        ModuleComponent app1Component = createAppModuleComponent("app1");
        ModuleComponent app1aComponent = createAppModuleComponent("app1a");
        ModuleComponent app1bComponent = createAppModuleComponent("app1b");
        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        app1aComponent.getImplementation().getComponents().add(source);
        app1Component.getImplementation().getComponents().add(app1aComponent);
        app1Component.getImplementation().getComponents().add(app1bComponent);

        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        app1bComponent.getImplementation().getComponents().add(target);

        EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target);
        ep.getBindings().add(systemFactory.createSystemBinding());
        Service service = systemFactory.createService();
        service.setName("target.ep");
        ep.getConfiguredReference().getTargetConfiguredServices().get(0).setPort(service);
        app1bComponent.getImplementation().getEntryPoints().add(ep);

        CompositeContext root = runtime.getRootContext();
        root.registerModelObject(app1Component);
        return runtime;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.model.assembly.ModuleComponent

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.