Package org.apache.tuscany.sca.provider

Examples of org.apache.tuscany.sca.provider.ServiceBindingProvider


        // binding provided async response handler
        if (isAsyncInvocation() &&
            bindingInvocationChain == null){
            // fix up the operation chain response path to point back to the
            // binding provided async response handler
            ServiceBindingProvider serviceBindingProvider = getBindingProvider();
            if (serviceBindingProvider instanceof EndpointAsyncProvider){
                EndpointAsyncProvider asyncEndpointProvider = (EndpointAsyncProvider)serviceBindingProvider;
                InvokerAsyncResponse asyncResponseInvoker = asyncEndpointProvider.createAsyncResponseInvoker();
               
                for (InvocationChain chain : getInvocationChains()){
                    Invoker invoker = chain.getHeadInvoker();
                    if (invoker instanceof InterceptorAsync){
                        ((InterceptorAsync)invoker).setPrevious(asyncResponseInvoker);
                    } else {
                        //TODO - throw error once the old async code is removed
                    } // end if
                } // end for
            } else {
                // TODO - throw error once the old async code is removed
            } // end if
        } // end if
       
        ServiceBindingProvider provider = getBindingProvider();
        if ((provider != null) && (provider instanceof OptimisingBindingProvider)) {
          //TODO - remove this comment once optimisation codepath is tested
            ((OptimisingBindingProvider)provider).optimiseBinding( this );
        } // end if
View Full Code Here


     * Indicates if a given endpoint has a Binding that supports native async invocation
     * @param endpoint - the endpoint
     * @return - true if the endpoint has a binding that supports native async, false otherwise
     */
    private boolean hasNativeAsyncBinding(RuntimeEndpoint endpoint) {
      ServiceBindingProvider provider = endpoint.getBindingProvider();
      if( provider instanceof EndpointAsyncProvider ) {
        EndpointAsyncProvider asyncProvider = (EndpointAsyncProvider) provider;
        if( asyncProvider.supportsNativeAsync()  ) return true;
      } // end if
    return false;
View Full Code Here

    }   

    private void initServiceBindingInvocationChains() {

        // add the binding interceptors to the service binding wire
        ServiceBindingProvider provider = getBindingProvider();
        if ((provider != null) && (provider instanceof EndpointProvider)) {
            ((EndpointProvider)provider).configure();
        }

        // add the policy interceptors to the service binding wire
        List<PolicyProvider> pps = getPolicyProviders();
        if (pps != null) {
            for (PolicyProvider p : pps) {
                Interceptor interceptor = p.createBindingInterceptor();
                if (interceptor != null) {
                    bindingInvocationChain.addInterceptor(interceptor);
                } // end if
            } // end for
        } // end if
       
        // This is strategically placed before the RuntimeInvoker is added to the end of the
        // binding chain as the RuntimeInvoker doesn't need to take part in the response
        // processing and doesn't implement InvokerAsyncResponse
        ServiceBindingProvider serviceBindingProvider = getBindingProvider();
        if (isAsyncInvocation() &&
            serviceBindingProvider instanceof EndpointAsyncProvider &&
            ((EndpointAsyncProvider)serviceBindingProvider).supportsNativeAsync()){
            // fix up the invocation chains to point back to the
            // binding chain so that async response messages
View Full Code Here

     * @param service
     * @param binding
     * @param chain
     */
    private void addNonBlockingInterceptor(InvocationChain chain) {
        ServiceBindingProvider provider = getBindingProvider();
        if (provider != null) {
            if (!provider.supportsOneWayInvocation()) {
                chain.addInterceptor(Phase.SERVICE, new NonBlockingInterceptor(workScheduler));
            }
        }
    }
View Full Code Here

            for (ComponentService service : component.getServices()) {
                for (Binding binding : service.getBindings()) {
                    BindingProviderFactory providerFactory = (BindingProviderFactory)providerFactories
                        .getProviderFactory(binding.getClass());
                    if (providerFactory != null) {
                        ServiceBindingProvider bindingProvider = providerFactory
                            .createServiceBindingProvider((RuntimeComponent)component,
                                                          (RuntimeComponentService)service,
                                                          binding);
                        if (bindingProvider != null) {
                            ((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
View Full Code Here

     */
    public void startComponent(Component component) {

        for (ComponentService service : component.getServices()) {
            for (Binding binding : service.getBindings()) {
                ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service)
                    .getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.start();
                }
            }
        }
        for (ComponentReference reference : component.getReferences()) {
            for (Binding binding : reference.getBindings()) {
                ReferenceBindingProvider bindingProvider = ((RuntimeComponentReference)reference)
                    .getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.start();
                }
            }
        }

        Implementation implementation = component.getImplementation();
View Full Code Here

     * Stop a component
     */
    public void stopComponent(Component component) {
        for (ComponentService service : component.getServices()) {
            for (Binding binding : service.getBindings()) {
                ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service)
                    .getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.stop();
                }
            }
        }
        for (ComponentReference reference : component.getReferences()) {
            for (Binding binding : reference.getBindings()) {
                ReferenceBindingProvider bindingProvider = ((RuntimeComponentReference)reference)
                    .getBindingProvider(binding);
                if (bindingProvider != null) {
                    bindingProvider.stop();
                }
            }
        }
        Implementation implementation = component.getImplementation();
        if (implementation instanceof Composite) {
View Full Code Here

     * @return
     */
    private InterfaceContract getInterfaceContract(ComponentService service, Binding binding) {
        InterfaceContract interfaceContract = service.getInterfaceContract();

        ServiceBindingProvider provider = ((RuntimeComponentService)service).getBindingProvider(binding);
        if (provider != null) {
            InterfaceContract bindingContract = provider.getBindingInterfaceContract();
            if (bindingContract != null) {
                interfaceContract = bindingContract;
            }
        }
        return interfaceContract;
View Full Code Here

                        if (b instanceof PojoBinding) {
                            pojoBinding = ((PojoBinding)b).getUserBinding();
                        } else {
                            pojoBinding = b;
                        }
                        return new ServiceBindingProvider(){
                            ComponentLifecycle listener = bindingActivator.createService(rc, rcs, b, pojoBinding);
                            public InterfaceContract getBindingInterfaceContract() {
                                return null;
                            }
                            public void start() {
View Full Code Here

                                                             RuntimeComponentService service,
                                                             Binding binding) {
        BindingProviderFactory providerFactory =
            (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
        if (providerFactory != null) {
            @SuppressWarnings("unchecked")
            ServiceBindingProvider bindingProvider =
                providerFactory.createServiceBindingProvider((RuntimeComponent)component,
                                                             (RuntimeComponentService)service,
                                                             binding);
            if (bindingProvider != null) {
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.provider.ServiceBindingProvider

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.