Package org.apache.tuscany.model.assembly

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


    /**
     * Creates an composite component with the given name
     */
    public static ModuleComponent createCompositeComponent(String name) throws ConfigurationLoadException {
        ModuleComponent sc = systemFactory.createModuleComponent();
        Module impl = systemFactory.createModule();
        impl.setName(name);
        //impl.setImplementationClass(CompositeContextImpl.class);
        sc.setImplementation(impl);
        impl.setImplementationClass(CompositeContextImpl.class);
        impl.setComponentType(getCompositeComponentType());
        Service s = systemFactory.createService();
        JavaServiceContract ji = systemFactory.createJavaServiceContract();
        s.setServiceContract(ji);
        ji.setScope(Scope.AGGREGATE);
//        impl.setComponentType(systemFactory.createComponentType());
        impl.getComponentType().getServices().add(s);
        sc.setName(name);
        sc.setImplementation(impl);
        return sc;
    }
View Full Code Here


    /**
     * Creates a test system module with a module-scoped component and entry point
     */
    public static Module createSystemModule() throws ConfigurationLoadException {
        Module module = systemFactory.createSystemModule();
        module.setName("system.module");

        // create test component
        Component component = systemFactory.createSystemComponent("TestService1", ModuleScopeSystemComponent.class,
                ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        component.getImplementation().setComponentType(getIntrospector().introspect(ModuleScopeSystemComponent.class));
        module.getComponents().add(component);

        // create the entry point
        EntryPoint ep = createEPSystemBinding("TestService1EP", ModuleScopeSystemComponent.class, "target", component);
        module.getEntryPoints().add(ep);

        module.initialize(assemblyContext);
        module.setImplementationClass(SystemCompositeContextImpl.class);
        module.setComponentType(getComponentType());
        return module;
    }
View Full Code Here

        configuredReference = systemFactory.createConfiguredReference("setArrayOfTargets", "target");
        configuredReferences.add(configuredReference);

        source.initialize(assemblyContext);

        Module module = systemFactory.createSystemModule();
        module.setImplementationClass(SystemCompositeContextImpl.class);
        module.setComponentType(getComponentType());
        module.setName(moduleName);
        module.getComponents().add(source);
        module.getComponents().add(target);
        module.initialize(assemblyContext);
        return module;
    }
View Full Code Here

    /**
     * Creates a test system module component with a module-scoped component and entry point
     */
    public static Module createSystemChildModule() throws ConfigurationLoadException {
        Module module = systemFactory.createSystemModule();
        module.setName("system.test.module");
        module.setImplementationClass(SystemCompositeContextImpl.class);
        module.setComponentType(getComponentType());

        // create test component
        Component component = systemFactory.createSystemComponent("TestService2", ModuleScopeSystemComponent.class,
                ModuleScopeSystemComponentImpl.class, Scope.MODULE);
        module.getComponents().add(component);

        // create the entry point
        EntryPoint ep = createEPSystemBinding("TestService2EP", ModuleScopeSystemComponent.class, "target", component);
        module.getEntryPoints().add(ep);

        module.initialize(assemblyContext);
        return module;
    }
View Full Code Here

        RuntimeContext runtimeContext = new RuntimeContextImpl(new NullMonitorFactory(), builderRegistry,null);
        runtimeContext.start();

        CompositeContext systemContext = runtimeContext.getSystemContext();
        Assert.assertNotNull(systemContext);
        Module systemModule = MockFactory.createSystemModule();
       // MockSystemAssemblyFactory.buildModule(systemModule, systemContext);
        systemContext.registerModelObject(systemModule);

        // create a test module
        Component moduleComponent = MockFactory.createCompositeComponent("module");
View Full Code Here

    public QName getXMLType() {
        return AssemblyConstants.MODULE;
    }

    public Module load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
        Module module = factory.createModule();
        loadComposite(reader, module, loaderContext);
        // JFM Hack until recursive model in place
        if (module.getName().startsWith("org.apache.tuscany.core.system")) {
            module.setImplementationClass(SystemCompositeContextImpl.class);
        } else {
            module.setImplementationClass(CompositeContextImpl.class);
        }
        return module;
    }
View Full Code Here

   
        tuscanyRuntime = new TuscanyRuntime(getName(), getRootPath(), classLoader, new CommonsLoggingMonitorFactory());
  }
 
  protected void createEndpoints() throws Exception {
        Module module = tuscanyRuntime.getModuleComponent().getModuleImplementation();
        for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
            EntryPoint entryPoint = (EntryPoint) i.next();
            Binding binding = (Binding) entryPoint.getBindings().get(0);
            if (binding instanceof JbiBinding) {
                JbiBinding jbiBinding = (JbiBinding) binding;
                ScaEndpoint endpoint = new ScaEndpoint(entryPoint);
View Full Code Here

        ClassLoader cl = new URLClassLoader(new URL[] { parentUrl }, getClass().getClassLoader());
       
        TuscanyRuntime rt = new TuscanyRuntime(name, uri, cl, new NullMonitorFactory());
        assertNotNull(rt);
       
        Module module = rt.getModuleComponent().getModuleImplementation();

        Assert.assertTrue(module.getName().equals("org.apache.servicemix.sca.bigbank"));

        Component component = module.getComponent("AccountServiceComponent");
        Assert.assertTrue(component != null);

        EntryPoint entryPoint = module.getEntryPoint("AccountService");
        Assert.assertTrue(entryPoint != null);

        ExternalService externalService = module.getExternalService("StockQuoteService");
        Assert.assertTrue(externalService != null);

        Binding binding = externalService.getBindings().get(0);
        Assert.assertTrue(binding instanceof JbiBinding);
    }
View Full Code Here

   
        tuscanyRuntime = new TuscanyRuntime(getName(), getRootPath(), classLoader, new CommonsLoggingMonitorFactory());
  }
 
  protected void createEndpoints() throws Exception {
        Module module = tuscanyRuntime.getModuleComponent().getModuleImplementation();
        for (Iterator i = module.getEntryPoints().iterator(); i.hasNext();) {
            EntryPoint entryPoint = (EntryPoint) i.next();
            Binding binding = (Binding) entryPoint.getBindings().get(0);
            if (binding instanceof JbiBinding) {
                JbiBinding jbiBinding = (JbiBinding) binding;
                ScaEndpoint endpoint = new ScaEndpoint(entryPoint);
View Full Code Here

        ClassLoader cl = new URLClassLoader(new URL[] { parentUrl }, getClass().getClassLoader());
       
        TuscanyRuntime rt = new TuscanyRuntime(name, uri, cl, new NullMonitorFactory());
        assertNotNull(rt);
       
        Module module = rt.getModuleComponent().getModuleImplementation();

        Assert.assertTrue(module.getName().equals("org.apache.servicemix.sca.bigbank"));

        Component component = module.getComponent("AccountServiceComponent");
        Assert.assertTrue(component != null);

        EntryPoint entryPoint = module.getEntryPoint("AccountService");
        Assert.assertTrue(entryPoint != null);

        ExternalService externalService = module.getExternalService("StockQuoteService");
        Assert.assertTrue(externalService != null);

        Binding binding = externalService.getBindings().get(0);
        Assert.assertTrue(binding instanceof JbiBinding);
    }
View Full Code Here

TOP

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

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.