Package org.apache.tuscany.model.assembly

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


        }

        // Derive the component type from the entry points and external services in the composite
        // Also derive properties from the overridable properties of the components in the composite
        if (componentType == null) {
            AssemblyFactory factory = modelContext.getAssemblyFactory();
            componentType = factory.createComponentType();
            for (EntryPoint entryPoint : getEntryPoints()) {
                Service service = factory.createService();
                service.setName(entryPoint.getName());
                ServiceContract serviceContract = entryPoint.getConfiguredService().getPort().getServiceContract();
                if (serviceContract != null)
                    service.setServiceContract(serviceContract);
                componentType.getServices().add(service);

                ConfiguredReference configuredReference = entryPoint.getConfiguredReference();
                ServiceURI sourceURI = factory.createServiceURI(null, entryPoint, configuredReference);
                for (String target : configuredReference.getTargets()) {
                    ServiceURI targetURI = factory.createServiceURI(null, target);
                    Wire wire = factory.createWire();
                    wire.setSource(sourceURI);
                    wire.setTarget(targetURI);
                    getWires().add(wire);
                }
            }
            for (ExternalService externalService : getExternalServices()) {
                if (externalService.getOverrideOption() == null || externalService.getOverrideOption() == OverrideOption.NO)
                    continue;
                Reference reference = factory.createReference();
                reference.setName(externalService.getName());
                ServiceContract serviceContract = externalService.getConfiguredService().getPort().getServiceContract();
                if (serviceContract != null)
                    reference.setServiceContract(serviceContract);
                componentType.getReferences().add(reference);
            }
            for (Component<Implementation> component : getComponents()) {
                for (ConfiguredProperty configuredProperty : component.getConfiguredProperties()) {
                    if (configuredProperty.getOverrideOption() == null || configuredProperty.getOverrideOption() == OverrideOption.NO)
                        continue;
                    componentType.getProperties().add(configuredProperty.getProperty());
                }

                for (ConfiguredReference configuredReference : component.getConfiguredReferences()) {
                    // Create a wire
                    ServiceURI sourceURI = factory.createServiceURI(null, component, configuredReference);
                    for (String target : configuredReference.getTargets()) {
                        ServiceURI targetURI = factory.createServiceURI(null, target);
                        Wire wire = factory.createWire();
                        wire.setSource(sourceURI);
                        wire.setTarget(targetURI);
                        getWires().add(wire);
                    }
                }
View Full Code Here


        }
        implementation.initialize(modelContext);

        // Derive the configured services from the component implementation
        ComponentType componentType=implementation.getComponentType();
        AssemblyFactory factory = modelContext.getAssemblyFactory();
        for (Service service : componentType.getServices()) {
            ConfiguredService configuredService = factory.createConfiguredService();
            configuredService.setPort(service);
            configuredServices.add(configuredService);
            configuredService.initialize(modelContext);
        }

        // Derive the configured references from the references on the component info
        for (Reference reference : componentType.getReferences()) {
            ConfiguredReference configuredReference = configuredReferencesMap.get(reference.getName());
            if (configuredReference==null) {
                configuredReference=factory.createConfiguredReference();
                configuredReference.setPort(reference);
                configuredReferences.add(configuredReference);
                configuredReference.initialize(modelContext);
            } else {
                configuredReference.setPort(reference);
View Full Code Here

     * @param classLoader the classloader to use for application artifacts
     * @return a default AssemblyModelContext
     */
    public static AssemblyContext getModelContext(ClassLoader classLoader) {
        // Create an assembly model factory
        AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl();

        // Create a default assembly model loader
        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl();

        // Create a resource loader from the supplied classloader
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        factory = new JNDIPropertyFactory();
        xmlFactory = XMLInputFactory.newInstance();
        AssemblyFactory assemblyFactory = new AssemblyFactoryImpl();
        property = assemblyFactory.createProperty();

        oldICF = System.getProperty(INITIAL_CONTEXT_FACTORY);
        System.setProperty(INITIAL_CONTEXT_FACTORY, MockContextFactory.class.getName());
    }
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        factory = new StringParserPropertyFactory();
        xmlFactory = XMLInputFactory.newInstance();
        AssemblyFactory assemblyFactory = new AssemblyFactoryImpl();
        property = assemblyFactory.createProperty();
    }
View Full Code Here

     * @param classLoader the classloader to use for application artifacts
     * @return a default AssemblyModelContext
     */
    public static AssemblyModelContext getModelContext(ClassLoader classLoader) {
        // Create an assembly model factory
        AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl();

        // Create a default assembly model loader
        List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
        scdlLoaders.add(new SystemSCDLModelLoader());
        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);
View Full Code Here

     * @param classLoader the classloader to use for application artifacts
     * @return a default AssemblyModelContext
     */
    public static AssemblyModelContext getModelContext(ClassLoader classLoader) {
        // Create an assembly model factory
        AssemblyFactory modelFactory = new SystemAssemblyFactoryImpl();

        // Create a default assembly model loader
        List<SCDLModelLoader> scdlLoaders = new ArrayList<SCDLModelLoader>();
        scdlLoaders.add(new SystemSCDLModelLoader());
        AssemblyModelLoader modelLoader = new SCDLAssemblyModelLoaderImpl(scdlLoaders);
View Full Code Here

TOP

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

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.