Package org.apache.tuscany.sca.runtime

Examples of org.apache.tuscany.sca.runtime.RuntimeEndpointReference


        if (Object.class == method.getDeclaringClass()) {
            return invokeObjectMethod(method, args);
        }
  
        // obtain a dedicated wire to be used for this callback invocation
        RuntimeEndpointReference wire = ((CallbackServiceReferenceImpl)callableReference).getCallbackEPR();
        if (wire == null) {
            //FIXME: need better exception
            throw new ServiceRuntimeException("No callback wire found");
        }
View Full Code Here


                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
           
            RuntimeEndpointReference epr;
            try {
                epr = createEndpointReference(javaInterfaceFactory, compositeContext, assemblyFactory, endpoint, serviceInterface);
            } catch (Exception e) {
                throw new ServiceRuntimeException(e);
            }
View Full Code Here

            msg.setBody(mediator.copyInput(msg.getBody(), sourceOperation, targetOperation));
        }
       
        ep.getInvocationChains();
        if ( !ep.getCallbackEndpointReferences().isEmpty() ) {
            RuntimeEndpointReference asyncEPR = (RuntimeEndpointReference) ep.getCallbackEndpointReferences().get(0);
            // Place a link to the callback EPR into the message headers...
            msg.getHeaders().put("ASYNC_CALLBACK", asyncEPR );
        }

        Message resultMsg = getNext().invoke(msg);
View Full Code Here

            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

        RuntimeEndpointReference epr;
        try {
            epr =
                createEndpointReference(javaInterfaceFactory,
                                        compositeContext,
                                        assemblyFactory,
View Full Code Here

     * @param service
     * @return
     */
    public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service) {
        try {
            RuntimeEndpointReference ref =
                (RuntimeEndpointReference)createEndpointReference(component, service, null, businessInterface);
            ref.setComponent(component);
            return getServiceReference(businessInterface, ref);
        } catch (IllegalArgumentException iae) {
            throw iae;
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
View Full Code Here

                    if (contract.getInterface() instanceof JavaInterface) {
                        businessInterface = (Class<B>)((JavaInterface)contract.getInterface()).getJavaClass();
                    }
                }
            }
            RuntimeEndpointReference ref =
                (RuntimeEndpointReference)createEndpointReference(endpoint, businessInterface);
            ref.setComponent(component);
            return new ServiceReferenceImpl<B>(businessInterface, ref, compositeContext);
        } catch (IllegalArgumentException iae) {
            throw iae;
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
View Full Code Here

                        throw new IllegalArgumentException("Reference " + referenceName
                            + " is not a valid argument for getServiceReferences because it has a multiplicity of 0..1");

                    ArrayList<ServiceReference<B>> serviceRefs = new ArrayList<ServiceReference<B>>();
                    for (EndpointReference endpointReference : ref.getEndpointReferences()) {
                        RuntimeEndpointReference epr = (RuntimeEndpointReference)endpointReference;
                        serviceRefs.add(getServiceReference(businessInterface, epr));
                    }
                    return serviceRefs;
                }
            }
View Full Code Here

    }
   
   
    private static CompositeContext getCompositeContext(List<? extends EndpointReference> callbackEPRs) {
        if(!callbackEPRs.isEmpty()) {
            RuntimeEndpointReference epr = (RuntimeEndpointReference) callbackEPRs.get(0);
            return epr.getCompositeContext();
        }
        return null;
    }
View Full Code Here

    }

    private RuntimeEndpointReference setCallbackAddress(RuntimeEndpointReference endpointReference) {
        try {
           
            RuntimeEndpointReference epr = endpointReference;
           
            if (callbackHandler.getCloneCallbackWire()){
                epr = (RuntimeEndpointReference)endpointReference.clone();
            }
           
            // TUSCANY-3932
            // If it's the default binding then we're going to look the callback endpoint
            // up in the registry. Most remote protocols, which may be used as delegates
            // for binding.sca, will expect to deal with absolute URLs so flip the
            // callback endpoint back to force the lookup to happen
            if (epr.getBinding().getType().equals(SCABinding.TYPE)){
                // A/ create a callback endpoint to allow the
                //    callback lookup to take place
                epr.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND);
              
                // if an endpoint it provided in the forward message use it or
                // if not create one
                if (resolvedEndpoint == null ){
                    RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint();
                    callbackEndpoint.setURI(callbackHandler.getCallbackTargetURI());
                    callbackEndpoint.setUnresolved(true);
                    epr.setTargetEndpoint(callbackEndpoint);
                } else {
                    epr.setTargetEndpoint(resolvedEndpoint);
                }
            } else {
                // B/ and C/ assume that the callback EPR is already resolved
                //           and set the binding URI if one is provided with the
                //           forward message. Some bindings may want to do other
                //           things to determine the callback URI to the
                //           CallbackHandler will be sent in the callback message
                //           header. This is particularly true if the clone isn't
                //           called above because resetting the URI will not
                //           be thread safe.
                epr.setStatus(EndpointReference.Status.RESOLVED_BINDING);
               
                if ( callbackHandler.getCallbackTargetURI() != null ){
                    epr.getBinding().setURI(callbackHandler.getCallbackTargetURI());
                } else {
                    // do nothing and rely on whatever the user has configured
                    // in the SCDL
                }
            }
View Full Code Here

      // Deal with async callback
      // Ensure invocation chains are built...
      getInvocationChains();
      // async callback handling
      if( this.isAsyncInvocation() && !this.getCallbackEndpointReferences().isEmpty() ) {
        RuntimeEndpointReference asyncEPR = (RuntimeEndpointReference) this.getCallbackEndpointReferences().get(0);
        // Place a link to the callback EPR into the message headers...
        msg.getHeaders().put(Constants.ASYNC_CALLBACK, asyncEPR );
      }
      // end of async callback handling
        return invoker.invokeBinding(msg);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.runtime.RuntimeEndpointReference

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.