Package org.apache.tuscany.sca.provider

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


    private void initServiceBindingInvocationChains() {
        RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
        Binding serviceBinding = wireTarget.getBinding();
       
        // add the binding interceptors to the service binding wire
        ServiceBindingProvider provider = service.getBindingProvider(serviceBinding);
        if ((provider != null) &&
            (provider instanceof ServiceBindingProviderRRB)){
            ((ServiceBindingProviderRRB)provider).configureBindingChain(this);
        }
       
View Full Code Here


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

            if (providers != null) {
                providers.add(policyProvider);
            }
        }

        final ServiceBindingProvider bindingProvider = ep.getBindingProvider();
        if (bindingProvider != null) {
            // bindingProvider.start();
            // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
            AccessController.doPrivileged(new PrivilegedAction<Object>() {
                public Object run() {
                    bindingProvider.start();
                    if (providers != null) {
                        providers.add(bindingProvider);
                    }
                    return null;
                  }
View Full Code Here

        }
    }
   
    public void stop(RuntimeEndpoint ep) {
        ep.getCompositeContext().getEndpointRegistry().removeEndpoint(ep);
        final ServiceBindingProvider bindingProvider = ep.getBindingProvider();
        if (bindingProvider != null) {
            try {
                // Allow bindings to read properties. Requires PropertyPermission read in security policy.
                AccessController.doPrivileged(new PrivilegedAction<Object>() {
                    public Object run() {
                        bindingProvider.stop();
                        return null;
                      }
                });
            } catch (Throwable ex){
                logger.log(Level.SEVERE, ex.getMessage(), ex);
View Full Code Here

        // 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
        if (isAsyncInvocation()){
            // fix up the invocation chains to point back to the
            // binding chain so that async response messages
            // are processed correctly
            for (InvocationChain chain : getInvocationChains()){
                Invoker invoker = chain.getHeadInvoker();
                if (invoker instanceof InterceptorAsync){
                    ((InterceptorAsync)invoker).setPrevious((InvokerAsyncResponse)bindingInvocationChain.getTailInvoker());
                } else {
                    // TODO - raise an error. Not doing that while
                    //        we have the old async mechanism in play
                }
            } // end for
           
            // fix up the binding 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();
                if (bindingInvocationChain.getHeadInvoker() instanceof  InterceptorAsync){
                    ((InterceptorAsync)bindingInvocationChain.getHeadInvoker()).setPrevious(asyncResponseInvoker);
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

    private void startEndpoint(CompositeContext compositeContext, RuntimeEndpoint ep) {
        for (PolicyProvider policyProvider : ep.getPolicyProviders()) {
            policyProvider.start();
        } // end for

        final ServiceBindingProvider bindingProvider = ep.getBindingProvider();
        if (bindingProvider != null) {
            // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
            AccessController.doPrivileged(new PrivilegedAction<Object>() {
                public Object run() {
                    bindingProvider.start();
                    return null;
                }
            });
            compositeContext.getEndpointRegistry().addEndpoint(ep);
        }
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

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.