Package org.apache.tuscany.sca.assembly

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


     
      ProcessorContext context = new ProcessorContext();
    try {
      XMLStreamReader reader = inputFactory.createXMLStreamReader(source);
      reader.next();
      Binding newBinding = (Binding) processor.read(reader, context );
      newBinding.setName(reference.getName());
     
      // Create a URI address for the callback based on the Component_Name/Reference_Name pattern
      //String callbackURI = "/" + component.getName() + "/" + reference.getName();
      //newBinding.setURI(callbackURI);
     
      BuilderExtensionPoint builders = registry.getExtensionPoint(BuilderExtensionPoint.class);
      BindingBuilder builder = builders.getBindingBuilder(newBinding.getType());
            if (builder != null) {
              org.apache.tuscany.sca.assembly.builder.BuilderContext builderContext = new BuilderContext(registry);
              builder.build(component, reference, newBinding, builderContext, true);
            } // end if
     
View Full Code Here


        for (EndpointListener listener : listeners) {
            listener.endpointAdded(endpoint);
        }
        if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) {
            String uri = null;
            Binding b = endpoint.getBinding();
            if (b != null) {
                uri = b.getURI();
                if (uri != null && uri.startsWith("/")) {
                    uri = uri.substring(1);
                }
            }
            String msg = "Add endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - " + uri);
            if (quietLogging) {
                logger.fine(msg);
            } else {
                logger.info(msg);
            }
View Full Code Here

    public synchronized void removeEndpoint(Endpoint endpoint) {
        endpoints.remove(endpoint);
        endpointRemoved(endpoint);
        if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) {
            String uri = null;
            Binding b = endpoint.getBinding();
            if (b != null) {
                uri = b.getURI();
                if (uri != null && uri.startsWith("/")) {
                    uri = uri.substring(1);
                }
            }
            String msg = "Remove endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - "+uri);
            if (quietLogging) {
                logger.fine(msg);
            } else {
                logger.info(msg);
            }
View Full Code Here

            service.setInterfaceContract(wsdlInterfaceContract);
        }        

        // Create a binding
        // Mike had to go via the XML but I don't remember why
        Binding binding = null;
        try {
            binding = (Binding)getBinding().clone();
        } catch (Exception ex){
            //
        }
        String callbackURI = "/" + component.getName() + "/" + service.getName();
        binding.setURI(callbackURI);
       
        BuilderExtensionPoint builders = registry.getExtensionPoint(BuilderExtensionPoint.class);
        BindingBuilder builder = builders.getBindingBuilder(binding.getType());
        if (builder != null) {
            org.apache.tuscany.sca.assembly.builder.BuilderContext builderContext = new BuilderContext(registry);
            builder.build(component, service, binding, builderContext, true);
        } // end if
       
View Full Code Here

                    warning("Policy related exception: " + e, e);
                    //throw new RuntimeException(e);
                }

                // Match the binding against the bindings of the target service
                Binding selected = BindingUtil.resolveBindings(componentReference, targetComponent, targetComponentService);
                if (selected == null) {
                    warning("Component reference doesn't have a matching binding", componentReference);
                } else {
                    selectedBindings.add(selected);
                }
                if (bidirectional) {
                    Binding selectedCallback = BindingUtil.resolveCallbackBindings(componentReference, targetComponent, targetComponentService);
                    if (selectedCallback != null) {
                        selectedCallbackBindings.add(selectedCallback);
                    }
                }
            }
View Full Code Here

        Object model = extensionProcessor.read(reader, context);
        if (model instanceof Composite) {
            Composite composite = (Composite)model;
            Component component = composite.getComponents().get(0);
            ComponentReference reference = component.getReferences().get(0);
            Binding binding = reference.getBindings().get(0);
            endpointReference.setComponent(component);
            endpointReference.setReference(reference);
            reference.getEndpointReferences().add(endpointReference);
            endpointReference.setBinding(binding);
           
View Full Code Here

            component.getReferences().clear();
            component.getServices().clear();
            ComponentReference reference = (ComponentReference)endpointReference.getReference().clone();
            component.getReferences().add(reference);
            reference.getBindings().clear();
            Binding binding = (Binding)endpointReference.getBinding().clone();
            reference.getBindings().add(binding);
            //reference.setInterfaceContract(endpointReference.getInterfaceContract());
            if (endpointReference.getStatus() != EndpointReference.Status.RESOLVED_BINDING){
                ComponentService service = assemblyFactory.createComponentService();
                service.setName(endpointReference.getTargetEndpoint().getURI());
View Full Code Here

                extensionProcessor.resolve(interfaceContract, resolver, context);
            }

            // Resolve bindings
            for (int i = 0, n = contract.getBindings().size(); i < n; i++) {
                Binding binding = contract.getBindings().get(i);
                extensionProcessor.resolve(binding, resolver, context);

            }

            // Resolve callback bindings
            if (contract.getCallback() != null) {

                for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
                    Binding binding = contract.getCallback().getBindings().get(i);
                    extensionProcessor.resolve(binding, resolver, context);
                }
            }
        }
    }
View Full Code Here

                    extensionProcessor.resolve(interfaceContract, resolver);
                }
   
                // Resolve bindings
                for (int i = 0, n = contract.getBindings().size(); i < n; i++) {
                    Binding binding = contract.getBindings().get(i);
                    extensionProcessor.resolve(binding, resolver);
                   
                    if (binding instanceof IntentAttachPoint) {
                        IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
                        resolveIntents(policiedBinding.getRequiredIntents(), resolver);
                        PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
                    }
                   
                    if (binding instanceof PolicySetAttachPoint) {
                        PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
                        resolvePolicySets(policiedBinding.getPolicySets(), resolver);
                        //validate if attached policysets apply to the binding
                        resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
                        //inherit the applicable policysets from parent contract as whatever applies to that
                        //applies to the binding as well
                        addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
                        PolicyValidationUtils.validatePolicySets(policiedBinding);
                    }
                   
                    if (binding instanceof OperationsConfigurator) {
                        OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
                        for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
                            resolveIntents(confOp.getRequiredIntents(), resolver);
                            PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
                           
                            resolvePolicySets(confOp.getPolicySets(), resolver);
                            resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
                            //inherit the applicable policysets from parent binding as whatever applies to that
                            //applies to the binding as well
                            addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
                                                   confOp.getApplicablePolicySets());
                            PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
                           
                            addInheritedIntents(((PolicySetAttachPoint)binding).getRequiredIntents(),
                                                confOp.getRequiredIntents());
                            addInheritedPolicySets(((PolicySetAttachPoint)binding).getPolicySets(),
                                                confOp.getPolicySets());
                        }
                    }
                }
   
                // Resolve callback bindings
                if (contract.getCallback() != null) {
                    resolveIntents(contract.getCallback().getRequiredIntents(), resolver);
                    resolvePolicySets(contract.getCallback().getPolicySets(), resolver);
                    resolvePolicySets(contract.getCallback().getApplicablePolicySets(), resolver);
                    //inherit the contract's policy intents and policysets
                    addInheritedIntents(contract.getRequiredIntents(), contract.getCallback().getRequiredIntents());
                    addInheritedPolicySets(contract.getPolicySets(), contract.getCallback().getPolicySets());
                    addInheritedPolicySets(contract.getApplicablePolicySets(), contract.getCallback().getApplicablePolicySets());
                   
                    for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
                        Binding binding = contract.getCallback().getBindings().get(i);
                        extensionProcessor.resolve(binding, resolver);
   
                        if (binding instanceof IntentAttachPoint) {
                            IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
                            resolveIntents(policiedBinding.getRequiredIntents(), resolver);
View Full Code Here

        Contract source = wireSource.getContract();
        if (source instanceof RuntimeComponentReference) {
            // It's the reference wire
            RuntimeComponentReference reference = (RuntimeComponentReference)wireSource.getContract();
            Binding refBinding = wireSource.getBinding();
            for (Operation operation : sourceContract.getInterface().getOperations()) {
                Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
                if (targetOperation == null) {
                    throw new ServiceRuntimeException("No matching operation for " + operation.getName()
                        + " is found in reference "
                        + wireSource.getComponent().getURI()
                        + "#"
                        + reference.getName());
                }
                InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true);
                if (operation.isNonBlocking()) {
                    addNonBlockingInterceptor(reference, refBinding, chain);
                }
                addReferenceBindingInterceptor(reference, refBinding, chain, operation);
                chains.add(chain);
            }
        } else {
            // It's the service wire
            RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
            RuntimeComponent serviceComponent = wireTarget.getComponent();
            Binding serviceBinding = wireTarget.getBinding();
            for (Operation operation : sourceContract.getInterface().getOperations()) {
                Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
                if (targetOperation == null) {
                    throw new ServiceRuntimeException("No matching operation for " + operation.getName()
                        + " is found in service "
View Full Code Here

TOP

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

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.