Examples of SCABinding


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

    public Class<SCABinding> getModelType() {
        return SCABinding.class;
    }

    public SCABinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        SCABinding scaBinding = scaBindingFactory.createSCABinding();
        IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
        bindingType.setName(getArtifactType());
        bindingType.setUnresolved(true);
        ((PolicySetAttachPoint)scaBinding).setType(bindingType);
       
        // Read policies
        policyProcessor.readPolicies(scaBinding, reader);
       
        // Read binding name
        String name = reader.getAttributeValue(null, NAME);
        if (name != null) {
            scaBinding.setName(name);
        }

        // Read binding URI
        String uri = reader.getAttributeValue(null, URI);
        if (uri != null) {
            scaBinding.setURI(uri);
        }

        // Skip to end element
        while (reader.hasNext()) {
            if (reader.next() == END_ELEMENT && BINDING_SCA_QNAME.equals(reader.getName())) {
View Full Code Here

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

                            for (ComponentReference promotedReference : promotedReferences) {
                                ReferenceConfigurationUtil.reconcileReferenceBindings(
                                        componentReference, promotedReference, assemblyFactory, monitor);
                                if (componentReference.getInterfaceContract() != null && // can be null in unit tests
                                    componentReference.getInterfaceContract().getCallbackInterface() != null) {
                                    SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
                                    if (promotedReference.getCallback() != null) {
                                        promotedReference.getCallback().getBindings().clear();
                                    } else {
                                        promotedReference.setCallback(assemblyFactory.createCallback());
                                    }
View Full Code Here

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

            }
        }
    }   
   
    protected SCABinding createSCABinding(Definitions definitions) {
        SCABinding scaBinding = scaBindingFactory.createSCABinding();
       
        // mark the bindings that are added automatically so that they can
        // be disregarded for overriding purposes
        if (scaBinding instanceof AutomaticBinding){
            ((AutomaticBinding)scaBinding).setIsAutomatic(true);
View Full Code Here

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

                for (ComponentReference promotedReference : promotedReferences) {
                    ReferenceConfigurationUtil.reconcileReferenceBindings(
                            compositeReference, promotedReference, assemblyFactory, monitor);
                    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());
                        }
View Full Code Here

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

    public Class<SCABinding> getModelType() {
        return SCABinding.class;
    }

    public SCABinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
        SCABinding scaBinding = scaBindingFactory.createSCABinding();
        ExtensionType bindingType = intentAttachPointTypeFactory.createBindingType();
        bindingType.setType(getArtifactType());
        bindingType.setUnresolved(true);
        ((PolicySubject)scaBinding).setType(bindingType);
       
        // Read policies
        policyProcessor.readPolicies(scaBinding, reader);
       
        // Read binding name
        String name = reader.getAttributeValue(null, NAME);
        if (name != null) {
            scaBinding.setName(name);
        }

        // Read binding URI
        String uri = reader.getAttributeValue(null, URI);
        if (uri != null) {
            scaBinding.setURI(uri);
        }

        // Skip to end element
        while (reader.hasNext()) {
            if (reader.next() == END_ELEMENT && BINDING_SCA_QNAME.equals(reader.getName())) {
View Full Code Here

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

        for (Service service : compositeServices) {
            // Set default binding names
           
            // Create default SCA binding
            if (service.getBindings().isEmpty()) {
                SCABinding scaBinding = createSCABinding(definitions);
                service.getBindings().add(scaBinding);
            }
        }

        // Initialize reference bindings
        for (Reference reference : composite.getReferences()) {
            // Create default SCA binding
            if (reference.getBindings().isEmpty()) {
                SCABinding scaBinding = createSCABinding(definitions);
                reference.getBindings().add(scaBinding);
            }
        }

        // Initialize all component services and references
        Map<String, Component> components = new HashMap<String, Component>();
        for (Component component : composite.getComponents()) {

            // Index all components and check for duplicates
            if (components.containsKey(component.getName())) {
                error(monitor, "DuplicateComponentName", component, composite.getName().toString(), component.getName());
            } else {
                components.put(component.getName(), component);
            }

            // Propagate the autowire flag from the composite to components
            if (component.getAutowire() == null) {
                component.setAutowire(composite.getAutowire());
            }

            if (component.getImplementation() instanceof ComponentPreProcessor) {
                ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
            }

            // Index properties, services and references
            Map<String, Service> services = new HashMap<String, Service>();
            Map<String, Reference> references = new HashMap<String, Reference>();
            Map<String, Property> properties = new HashMap<String, Property>();
            indexImplementationPropertiesServicesAndReferences(component,
                                                               services,
                                                               references,
                                                               properties,
                                                               monitor);

            // Index component services, references and properties
            // Also check for duplicates
            Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
            Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
            Map<String, ComponentProperty> componentProperties = new HashMap<String, ComponentProperty>();
            indexComponentPropertiesServicesAndReferences(component,
                                                          componentServices,
                                                          componentReferences,
                                                          componentProperties,
                                                          monitor);

            // Reconcile component services/references/properties and
            // implementation services/references and create component
            // services/references/properties for the services/references
            // declared by the implementation
            reconcileServices(component, services, componentServices, monitor);
            reconcileReferences(component, references, componentReferences, monitor);
            reconcileProperties(component, properties, componentProperties, monitor);

            // Configure or create callback services for component's references
            // with callbacks
            configureCallbackServices(component, componentServices);

            // Configure or create callback references for component's services
            // with callbacks
            configureCallbackReferences(component, componentReferences);

            // Initialize service bindings
            for (ComponentService componentService : component.getServices()) {

                // Create default SCA binding
                if (componentService.getBindings().isEmpty()) {
                    SCABinding scaBinding = createSCABinding(definitions);
                    componentService.getBindings().add(scaBinding);
                }
            }

            // Initialize reference bindings
            for (ComponentReference componentReference : component.getReferences()) {

                // Create default SCA binding
                if (componentReference.getBindings().isEmpty()) {
                    SCABinding scaBinding = createSCABinding(definitions);
                    componentReference.getBindings().add(scaBinding);
                }
            }
        }
    }   
View Full Code Here

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

        
          staxProcessor.resolve(composite, resolver);
         
          compositeBuilder.build(composite, null, null);
         
          SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
          SCABinding serviceSCABinding   = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
         
          Assert.assertNotNull(referenceSCABinding);
          Assert.assertNotNull(serviceSCABinding);
      } catch (Exception ex) {
        Assert.fail(ex.getMessage());
View Full Code Here

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

    private Invoker getInvoker(RuntimeWire wire, Operation operation) {
        EndpointReference target = wire.getTarget();
        if (target != null) {
            RuntimeComponentService service = (RuntimeComponentService)target.getContract();
            if (service != null) { // not a callback wire
                SCABinding scaBinding = service.getBinding(SCABinding.class);
                InvocationChain chain =
                    service.getInvocationChain(scaBinding, wire.getSource().getInterfaceContract(), operation);
                return chain == null ? null : new SCABindingInvoker(chain);
            }
        }
View Full Code Here

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

        }
       
        if (distributedBinding != null) {
            // reset the binding URI to null so that if the composite containing the component
            // with the service/binding is restarted the binding will have the correct URI set
            SCABinding scaBinding = distributedBinding.getSCABinding();
            try {
                URI tempURI = new URI(scaBinding.getURI());
                if (!tempURI.isAbsolute()){
                    scaBinding.setURI(null);
                }
            } catch (Exception ex){
                scaBinding.setURI(null);
            }
        }
       
    }
View Full Code Here

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

    public Class<SCABinding> getModelType() {
        return SCABinding.class;
    }

    public SCABinding read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        SCABinding scaBinding = scaBindingFactory.createSCABinding();
        ExtensionType bindingType = intentAttachPointTypeFactory.createBindingType();
        bindingType.setType(getArtifactType());
        bindingType.setUnresolved(true);
        ((PolicySubject)scaBinding).setExtensionType(bindingType);

        // Read policies
        policyProcessor.readPolicies(scaBinding, reader);

        // Read binding name
        String name = reader.getAttributeValue(null, NAME);
        if (name != null) {
            scaBinding.setName(name);
        }

        // Read binding URI
        String uri = getURIString(reader, URI);
        if (uri != null) {
            scaBinding.setURI(uri);
        }

        // Skip to end element
        while (reader.hasNext()) {
            if (reader.next() == END_ELEMENT && BINDING_SCA_QNAME.equals(reader.getName())) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.