Package org.apache.tuscany.sca.assembly

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


     * @param epRef - the endpoint reference
     * @param promotedReference - the promoted reference
     * @return - a copy of the EndpointReference with data merged from the promoted reference
     */
    private  EndpointReference copyHigherReference(EndpointReference epRef, ComponentReference promotedReference) {
        EndpointReference epRefClone = null;
        try {
            epRefClone = (EndpointReference)epRef.clone();
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        } // end try
        // Copy across details of the inner reference
        //ComponentReference ref = epRefClone.getReference();
        //FIXME
        epRefClone.setReference(promotedReference);
        return epRefClone;
    }  
View Full Code Here


    private EndpointReference createEndpointRef(Component component,
                                                ComponentReference reference,
                                                Binding binding,
                                                Endpoint endpoint,
                                                boolean unresolved) {
        EndpointReference endpointRef = createEndpointRef(component, reference, unresolved);
        endpointRef.setBinding(binding);
        endpointRef.setTargetEndpoint(endpoint);
        return endpointRef;
    } // end method
View Full Code Here

     * @param reference
     * @param unresolved
     * @return the endpoint reference
     */
    private EndpointReference createEndpointRef(Component component, ComponentReference reference, boolean unresolved) {
        EndpointReference endpointRef = assemblyFactory.createEndpointReference();
        endpointRef.setComponent(component);
        endpointRef.setReference(reference);
        endpointRef.setUnresolved(unresolved);
        return endpointRef;
    } // end method createEndpointRef  
View Full Code Here

      ref.getTargets().clear();
      ref.getBindings().clear();
      ref.getEndpointReferences().clear();
     
      // clone epr
      EndpointReference callbackEndpointReference = (EndpointReference)reference.getEndpointReferences().get(0).clone();
      callbackEndpointReference.setReference(ref);
      callbackEndpointReference.setTargetEndpoint(callbackEndpoint);
      callbackEndpointReference.setUnresolved(true);
     
      // The callback endpoint will be resolved when the wire chains are created
      ref.getEndpointReferences().add(callbackEndpointReference);
      return (RuntimeEndpointReference) ref.getEndpointReferences().get(0);
    } catch ( CloneNotSupportedException e ) {
View Full Code Here

    public String createJavascriptHeader(ComponentReference componentReference) throws IOException {
        return "dojo.require('dojo.rpc.JsonService');";
    }

    public String createJavascriptReference(ComponentReference componentReference) throws IOException {
        EndpointReference epr = componentReference.getEndpointReferences().get(0);
        Endpoint targetEndpoint = epr.getTargetEndpoint();
        if (targetEndpoint.isUnresolved()) {
            //force resolution and targetEndpoint binding calculations
            //by calling the getInvocationChain
            ((RuntimeEndpointReference) epr).getInvocationChains();
            targetEndpoint = epr.getTargetEndpoint();
        }

        Binding binding = targetEndpoint.getBinding();

        URI targetURI = URI.create(binding.getURI());
View Full Code Here

        InvocationChain chain = runtimeWire.getInvocationChain(operation);
        return invoke(chain, msg, runtimeWire);
    }

    protected Object invoke(InvocationChain chain, Message msg, RuntimeWire wire) throws InvocationTargetException {
        EndpointReference from = msg.getFrom();
        EndpointReference epFrom = wire.getEndpointReference();
        if (from != null) {
            from.setComponent(epFrom.getComponent());
            from.setReference(epFrom.getReference());
            from.setBinding(epFrom.getBinding());
            from.setInterfaceContract(epFrom.getInterfaceContract());
            from.setTargetEndpoint(epFrom.getTargetEndpoint());
            //from.setCallbackEndpoint(epFrom.getCallbackEndpoint());

            // TODO - EPR - what's going on here?
            //from.mergeEndpoint(epFrom);
        } else {
View Full Code Here

        // clone the endpoint references themselves and set the reference pointer back to
        // this new refrence
        clone.endpointReferences = new ArrayList<EndpointReference>();
       
        for (EndpointReference epr : endpointReferences){
            EndpointReference eprClone = (EndpointReference)epr.clone();
            eprClone.setReference((ComponentReference)clone);
            clone.endpointReferences.add(eprClone);
        }
        return clone;
    }
View Full Code Here

    }

    public void read(EndpointReference endpointReference, String xml) throws IOException {
        try {
            XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
            EndpointReference result = refProcessor.read(reader);
            reader.close();
            endpointReference.setComponent(result.getComponent());
            endpointReference.setReference(result.getReference());
            endpointReference.setBinding(result.getBinding());
            endpointReference.setInterfaceContract(result.getReference().getInterfaceContract());
        } catch (Exception e) {
            throw new IOException(e.getMessage());
        }
    }
View Full Code Here

        // Add a wire for each service Endpoint
        for ( Endpoint endpoint : runtimeService.getEndpoints()){

            // fluff up a fake endpoint reference as we are on the service side
            // so we need to represent the reference that will call us
            EndpointReference endpointReference = assemblyFactory.createEndpointReference();
            endpointReference.setBinding(endpoint.getBinding());
            endpointReference.setTargetEndpoint(endpoint);

            // create the interface contract for the binding and service ends of the wire
            // that are created as forward only contracts
            // FIXME: [rfeng] We might need a better way to get the impl interface contract
            Service targetService = service.getService();
            if (targetService == null) {
                targetService = service;
            }
            endpoint.setInterfaceContract(targetService.getInterfaceContract().makeUnidirectional(false));
            endpointReference.setInterfaceContract(getServiceBindingInterfaceContract(service, endpoint.getBinding()));

            // create the wire
            RuntimeWire wire = new RuntimeWireImpl(extensionPoints,
                                                    false,
                                                    endpointReference,
View Full Code Here

            Reference componentTypeRef = reference.getReference();
            InterfaceContract sourceContract =
                componentTypeRef == null ? reference.getInterfaceContract() : componentTypeRef.getInterfaceContract();
            sourceContract = sourceContract.makeUnidirectional(false);
           
            EndpointReference epr = assemblyFactory.createEndpointReference();
            epr.setComponent(component);
            epr.setReference(reference);
            //epr.setBinding(binding);
            epr.setInterfaceContract(sourceContract);
           
            Endpoint endpoint = assemblyFactory.createEndpoint();
            epr.setTargetEndpoint(endpoint);
           
            return epr;
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
View Full Code Here

TOP

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

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.