Package org.apache.tuscany.model.assembly

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


    private RuntimeContext createScenario3Runtime() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        runtime.start();
        SystemCompositeContext system = runtime.getSystemContext();
        ModuleComponent system1Component = MockFactory.createSystemCompositeComponent("system1");
        ModuleComponent system2Component = MockFactory.createSystemCompositeComponent("system2");
        ModuleComponent system1aComponent = MockFactory.createSystemCompositeComponent("system1a");
        system1Component.getImplementation().getComponents().add(system1aComponent);

        Component target = MockFactory.createSystemComponent("target", Target.class, TargetImpl.class, Scope.MODULE);
        system2Component.getImplementation().getComponents().add(target);
        EntryPoint ep = MockFactory.createEPSystemBinding("target.ep", Target.class, "target", target);
        system2Component.getImplementation().getEntryPoints().add(ep);
        system.registerModelObject(system2Component);

        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        system1aComponent.getImplementation().getComponents().add(source);
        system.registerModelObject(system1Component);
        system.publish(new ModuleStart(this));
        return runtime;
    }
View Full Code Here


    private RuntimeContext createScenario4Runtime() 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);

        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        system1aComponent.getImplementation().getComponents().add(source);
        system.registerModelObject(system1Component);
        system.publish(new ModuleStart(this));
        return runtime;
    }
View Full Code Here

    private RuntimeContext createScenario5Runtime() 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);
        system.registerModelObject(target);

        Component source = MockFactory.createSystemComponent("source", Source.class, AutowireSourceImpl.class, Scope.MODULE);
        system1aComponent.getImplementation().getComponents().add(source);
        system.registerModelObject(system1Component);
        system.publish(new ModuleStart(this));
        return runtime;
    }
View Full Code Here

        return runtime;
    }

    private ModuleComponent createAppModuleComponent(String name) throws ConfigurationLoadException {
        AssemblyContext assemblyContext = new AssemblyContextImpl(systemFactory, null, null);
        ModuleComponent mc = systemFactory.createModuleComponent();
        mc.setName(name);
        Module module = systemFactory.createModule();
        module.setImplementationClass(CompositeContextImpl.class);
        module.setComponentType(MockFactory.getComponentType());
        module.setName(name);
        module.initialize(assemblyContext);
        mc.setImplementation(module);
        return mc;
    }
View Full Code Here

    private JavaAssemblyFactory factory;
    private RuntimeContext runtime;

    public void testModuleWithOneComponent() throws Exception {
        Module module = factory.createModule();
        ModuleComponent moduleComponent = factory.createModuleComponent();
        moduleComponent.setImplementation(module);

//        runtime.registerModelObject(moduleComponent);
    }
View Full Code Here

        resourceLoader = modelContext.getApplicationResourceLoader();
        assemblyFactory = modelContext.getAssemblyFactory();
    }

    public ModuleComponent loadSystemModuleComponent(String name, String uri) throws ConfigurationLoadException {
        ModuleComponent mc = loadModuleComponent(SYSTEM_MODULE_FILE_NAME, SYSTEM_FRAGMENT_FILE_NAME, name, uri);
        //JFM HACK  - this is completely gross since it overwrites existing component type
        mc.getImplementation().setImplementationClass(SystemCompositeContextImpl.class);
        mc.getImplementation().setComponentType(getSystemCompositeComponentType());
        //END HACK
        return mc;
    }
View Full Code Here

        //END HACK
        return mc;
    }

    public ModuleComponent loadModuleComponent(String name, String uri) throws ConfigurationLoadException {
        ModuleComponent mc = loadModuleComponent(SCA_MODULE_FILE_NAME, SCA_FRAGMENT_FILE_NAME, name, uri);
        //JFM HACK
        mc.getImplementation().setImplementationClass(CompositeContextImpl.class);
        mc.getImplementation().setComponentType(getCompositeComponentType());
        //END HACK
        return mc;
    }
View Full Code Here

                module.getModuleFragments().add(moduleFragment);
            }
        }

        // Create the module component
        ModuleComponent moduleComponent=assemblyFactory.createModuleComponent();
        moduleComponent.setName(name);
        moduleComponent.setURI(uri);
        moduleComponent.setImplementation(module);
        moduleComponent.initialize(modelContext);

        return moduleComponent;
    }
View Full Code Here

        // Load and start the system configuration
        try {
            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));

            TomcatHost host = systemContext.resolveInstance(TomcatHost.class);
            host.setHost(this);
View Full Code Here

public class IntraCompositeWireIntegrationTestCase extends TestCase {

 
    public void testWireConstruction2() throws Exception {
        RuntimeContext runtime = MockFactory.createCoreRuntime();
        ModuleComponent moduleComponent = createSystemCompositeComponent("test.system");
        Module module = MockFactory.createSystemModuleWithWiredComponents("system.module",Scope.MODULE, Scope.MODULE);
        moduleComponent.setImplementation(module);
        runtime.getSystemContext().registerModelObject(moduleComponent);
        CompositeContext context = (CompositeContext) runtime.getSystemContext().getContext("test.system");
        context.publish(new ModuleStart(this));
        //context.registerModelObject(module);
        Source source = (Source) ((AtomicContext)context.getContext("source")).getTargetInstance();
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.