Package org.apache.tuscany.core.context

Examples of org.apache.tuscany.core.context.CompositeContext.publish()


        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);
View Full Code Here


        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);
        CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2");
        Assert.assertNotNull(child2Ctx);
        child2Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child2Ctx);
View Full Code Here

        Assert.assertNotNull(child1Ctx);
        child1Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child1Ctx);
        CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2");
        Assert.assertNotNull(child2Ctx);
        child2Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child2Ctx);
        CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3");
        Assert.assertNotNull(child3Ctx);
        child3Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child3Ctx);
View Full Code Here

        Assert.assertNotNull(child2Ctx);
        child2Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child2Ctx);
        CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3");
        Assert.assertNotNull(child3Ctx);
        child3Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child3Ctx);
       
        Assert.assertNull(child1Ctx.getContext("child3")); // sanity check
    }
View Full Code Here

     * @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;
    }

    public static CompositeContext registerModule(CompositeContext parent, ModuleComponent component) throws ConfigurationException {
        // register the component
View Full Code Here

        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);
        CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2");
        Assert.assertNotNull(child2Ctx);
        child2Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child2Ctx);
View Full Code Here

        Assert.assertNotNull(child1Ctx);
        child1Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child1Ctx);
        CompositeContext child2Ctx = (CompositeContext) child1Ctx.getContext("child2");
        Assert.assertNotNull(child2Ctx);
        child2Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child2Ctx);
        CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3");
        Assert.assertNotNull(child3Ctx);
        child3Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child3Ctx);
View Full Code Here

        Assert.assertNotNull(child2Ctx);
        child2Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child2Ctx);
        CompositeContext child3Ctx = (CompositeContext) child2Ctx.getContext("child3");
        Assert.assertNotNull(child3Ctx);
        child3Ctx.publish(new ModuleStart(this));
        analyzeLeafComponents(child3Ctx);
       
        Assert.assertNull(child1Ctx.getContext("child3")); // sanity check
        child1Ctx.publish(new ModuleStop(this));
    }
View Full Code Here

        Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component);
        childContext.registerModelObject(component);
        childContext.registerModelObject(ep);
        childContext.publish(new ModuleStart(this));
        Assert.assertNotNull(system.getContext("system.child").getInstance(new QualifiedName("./TestService1EP")));
        childContext.publish(new ModuleStop(this));
    }

    public void testAutowireRegisterBeforeStart() throws Exception {
View Full Code Here

        EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component);
        childContext.registerModelObject(component);
        childContext.registerModelObject(ep);
        childContext.publish(new ModuleStart(this));
        Assert.assertNotNull(system.getContext("system.child").getInstance(new QualifiedName("./TestService1EP")));
        childContext.publish(new ModuleStop(this));
    }

    public void testAutowireRegisterBeforeStart() throws Exception {
        Component component = factory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class, ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        EntryPoint ep = MockFactory.createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "TestService1", component);
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.