Package org.apache.tuscany.sca.assembly

Examples of org.apache.tuscany.sca.assembly.Implementation


    private void indexImplementationPropertiesServicesAndReferences(Component component,
                                                                    Map<String, Service> services,
                                                                    Map<String, Reference> references,
                                                                    Map<String, Property> properties) {
        // First check that the component has a resolved implementation
        Implementation implementation = component.getImplementation();
        if (implementation == null) {
            // A component must have an implementation
            warning("NoComponentImplementation", component, component.getName());

        } else if (implementation.isUnresolved()) {

            // The implementation must be fully resolved
            warning("UnresolvedComponentImplementation", component, component.getName(), implementation.getURI());

        } else {

            // Index properties, services and references, also check for
            // duplicates
            for (Property property : implementation.getProperties()) {
                if (properties.containsKey(property.getName())) {
                    warning("DuplicateImplementationPropertyName", component, component.getName(), property.getName());
                } else {
                    properties.put(property.getName(), property);
                }
            }
            for (Service service : implementation.getServices()) {
                if (services.containsKey(service.getName())) {
                    warning("DuplicateImplementationServiceName", component, component.getName(), service.getName());
                } else {
                    services.put(service.getName(), service);
                }
            }
            for (Reference reference : implementation.getReferences()) {
                if (references.containsKey(reference.getName())) {
                    warning("DuplicateImplementationReferenceName", component, component.getName(), reference.getName());
                } else {
                    references.put(reference.getName(), reference);
                }
View Full Code Here


                PropertyConfigurationUtil.sourceComponentProperties(compositeProperties, component);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Implementation impl = component.getImplementation();
            if (impl instanceof Composite) {
                configureSourcedProperties((Composite)impl, component.getProperties());
            }
        }
    }
View Full Code Here

            } else {
                componentURI = URI.create(parentComponentURI + '/').resolve(component.getName()).toString();
            }
            component.setURI(componentURI);

            Implementation implementation = component.getImplementation();
            if (implementation instanceof Composite) {

                // Process nested composite
                configureBindingURIs((Composite)implementation, componentURI, defaultBindings);
            }
View Full Code Here

    private void configureBindingNames(Composite composite) {
       
        // Process nested composites recursively
        for (Component component : composite.getComponents()) {

            Implementation implementation = component.getImplementation();
            if (implementation instanceof Composite) {

                // Process nested composite
                configureBindingNames((Composite)implementation);
            }
View Full Code Here

                       new XAttr(URI, component.getURI()),
                       new XAttr(AUTOWIRE, component.getAutowire()),
                       policyProcessor.writePolicies(component));
           
            // Write the component implementation
            Implementation implementation = component.getImplementation();
            if (implementation instanceof Composite) {
                writeStart(writer, IMPLEMENTATION_COMPOSITE, new XAttr(NAME, ((Composite)implementation).getName()));
                writeEnd(writer);
            } else {
                extensionProcessor.write(component.getImplementation(), writer);
View Full Code Here

                    }
                }
            }
           
            //resolve component implementation
            Implementation implementation = component.getImplementation();
            if (implementation != null) {
                try {
                    //resolve intents and policysets specified on this implementation
                    //before copying them over to the component.  Before that, from the component
                    //copy over the applicablePolicySets alone as it might have to be
View Full Code Here

        Contract contract = wire.getSource().getContract();
        if (!(contract instanceof RuntimeComponentReference)) {
            return;
        }
        RuntimeComponent component = wire.getSource().getComponent();
        Implementation implementation = component.getImplementation();
        if (!(implementation instanceof JavaImplementation)) {
            return;
        }
        JavaImplementation javaImpl = (JavaImplementation)implementation;
        EndpointReference callbackEndpoint = wire.getSource().getCallbackEndpoint();
View Full Code Here

     */
    public void wireComposite(Composite composite) {

        // Wire nested composites recursively
        for (Component component : composite.getComponents()) {
            Implementation implementation = component.getImplementation();
            if (implementation instanceof Composite) {
                wireComposite((Composite)implementation);
            }
        }

View Full Code Here

     */
    public void wireCompositeReferences(Composite composite) {
   
        // Process nested composites recursively
        for (Component component : composite.getComponents()) {
            Implementation implementation = component.getImplementation();
            if (implementation instanceof Composite) {
                wireCompositeReferences((Composite)implementation);
            }
        }
   
        // Process composite references declared in this composite
        for (Reference reference : composite.getReferences()) {
            CompositeReference compositeReference = (CompositeReference)reference;
            List<ComponentReference> promotedReferences = getPromotedComponentReferences(compositeReference);
            for (ComponentReference promotedReference : promotedReferences) {
   
                reconcileReferenceBindings(compositeReference, promotedReference);
                if (compositeReference.getInterfaceContract() != null && // can be null in unit tests
                compositeReference.getInterfaceContract().getCallbackInterface() != null) {
                    SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
                    if (promotedReference.getCallback() != null) {
                        promotedReference.getCallback().getBindings().clear();
                    } else {
                        promotedReference.setCallback(assemblyFactory.createCallback());
                    }
                    if (scaCallbackBinding != null) {
                        promotedReference.getCallback().getBindings().add(scaCallbackBinding);
                    }
                    if (compositeReference.getCallback() != null) {
                        promotedReference.getCallback().getBindings().addAll(compositeReference.getCallback()
                            .getBindings());
                    }
                }
            }
        }
   
        // Process the component references declared on components
        // in this composite
        for (Component component : composite.getComponents()) {
            Implementation implementation = component.getImplementation();
            if (implementation instanceof Composite) {
                for (ComponentReference componentReference : component.getReferences()) {
                    Reference implReference = componentReference.getReference();
                    if (implReference != null && implReference instanceof CompositeReference) {
                        CompositeReference compositeReference = (CompositeReference)implReference;
View Full Code Here

                //throw new RuntimeException(e);
            }
        }
   
        for (Component component : composite.getComponents()) {
            Implementation implemenation = component.getImplementation();
            try {
                implPolicyComputer.computeImplementationIntentsAndPolicySets(implemenation, component);
            } catch ( Exception e ) {
                warning("Policy related exception: " + e, e);
                //throw new RuntimeException(e);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.assembly.Implementation

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.