Package org.apache.tuscany.core.system.assembly

Examples of org.apache.tuscany.core.system.assembly.SystemImplementation


        mc.initialize(context);
        return mc;
    }

    private static Component bootstrapLoader(SystemAssemblyFactory factory, ComponentTypeIntrospector introspector, Class<?> loaderClass) {
        SystemImplementation implementation = factory.createSystemImplementation();
        implementation.setImplementationClass(loaderClass);
        try {
            implementation.setComponentType(introspector.introspect(loaderClass));
        } catch (ConfigurationException e) {
            throw (AssertionError) new AssertionError("Invalid bootstrap loader").initCause(e);
        }
        Component component = factory.createSimpleComponent();
        component.setName(loaderClass.getName());
View Full Code Here


        s.setServiceContract(jsc);

        ComponentType componentType = factory.createComponentType();
        componentType.getServices().add(s);

        SystemImplementation sysImpl = factory.createSystemImplementation();
        sysImpl.setImplementationClass(impl);
        sysImpl.setComponentType(componentType);

        Component sc = factory.createSimpleComponent();
        sc.setName(name);
        sc.setImplementation(sysImpl);
        return sc;
View Full Code Here

    private AssemblyContext assemblyContext = new AssemblyContextImpl(factory, null, null);
    
    public void testModelVisit() throws Exception {
        ComponentType componentType;
        Service service;
        SystemImplementation impl;
        Component component;

        Module module = factory.createModule();

        // create target component
        componentType = factory.createComponentType();
        service = factory.createService();
        service.setName("target");
        componentType.getServices().add(service);
        impl = factory.createSystemImplementation();
        impl.setComponentType(componentType);
        component = factory.createSimpleComponent();
        component.setName("target");
        component.setImplementation(impl);
        component.initialize(assemblyContext);
        module.getComponents().add(component);

        // create source component
        componentType = factory.createComponentType();
        Reference ref = factory.createReference();
        ref.setName("ref");
        componentType.getReferences().add(ref);
        impl = factory.createSystemImplementation();
        impl.setComponentType(componentType);
        component = factory.createSimpleComponent();
        component.setName("source");
        component.setImplementation(impl);
        ConfiguredReference cRef = factory.createConfiguredReference("ref", "target");
        component.getConfiguredReferences().add(cRef);
View Full Code Here

        return SYSTEM_IMPLEMENTATION;
    }

    public SystemImplementation load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {
        assert SYSTEM_IMPLEMENTATION.equals(reader.getName());
        SystemImplementation implementation = factory.createSystemImplementation();
        String implClass = reader.getAttributeValue(null, "class");
        Class<?> implementationClass;
        try {
            implementationClass = loaderContext.getResourceLoader().loadClass(implClass);
            implementation.setImplementationClass(implementationClass);
        } catch (ClassNotFoundException e) {
            throw new ConfigurationLoadException(e);
        }

        // todo we should allow componentType sidefiles for system implementations
        implementation.setComponentType(introspector.introspect(implementationClass));

        StAXUtil.skipToEndElement(reader);
        return implementation;
    }
View Full Code Here

        s.setServiceContract(jsc);

        ComponentType componentType = createComponentType();
        componentType.getServices().add(s);

        SystemImplementation sysImpl = createSystemImplementation();
        sysImpl.setImplementationClass(impl);
        sysImpl.setComponentType(componentType);

        Component sc = createSimpleComponent();
        sc.setName(name);
        sc.setImplementation(sysImpl);
        return sc;
View Full Code Here

        Implementation componentImplementation = component.getImplementation();
        if (componentImplementation instanceof SystemImplementation
                && component.getContextFactory() == null) {

            // The component is a system component, implemented by a Java class
            SystemImplementation implementation = (SystemImplementation) componentImplementation;
            if (componentImplementation.getComponentType().getServices() == null
                    || componentImplementation.getComponentType().getServices().size() < 1) {
                BuilderConfigException e = new BuilderConfigException("No service configured on component type");
                e.setIdentifier(component.getName());
                throw e;
            }
            implClass = implementation.getImplementationClass();
            Scope previous = null;
            scope = Scope.MODULE;
            List<Service> services = component.getImplementation().getComponentType().getServices();
            for (Service service : services) {
                // calculate and validate the scope of the component; ensure that all service scopes are the same unless
View Full Code Here

        loader.loadProperties(reader, resourceLoader, component);
        component.initialize(modelContext);
    }

    private Component createFooComponent() {
        SystemImplementation impl = assemblyFactory.createSystemImplementation();
        impl.setImplementationClass(ServiceImpl.class);
        try {
            impl.setComponentType(introspector.introspect(ServiceImpl.class));
        } catch (ConfigurationException e) {
            throw new AssertionError();
        }
        impl.initialize(null);
        AtomicComponent component = assemblyFactory.createSimpleComponent();
        component.setImplementation(impl);
        return component;
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.system.assembly.SystemImplementation

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.