Package org.apache.tuscany.sca.assembly

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


        componentReference.setInterfaceContract(interfaceContract);
        componentReference.setMultiplicity(Multiplicity.ONE_ONE);
        // component.getReferences().add(componentReference);

        // create endpoint reference
        EndpointReference endpointReference = assemblyFactory.createEndpointReference();
        endpointReference.setComponent(component);
        endpointReference.setReference(componentReference);
        endpointReference.setBinding(endpoint.getBinding());
        endpointReference.setUnresolved(false);
        endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);

        endpointReference.setTargetEndpoint(endpoint);

        componentReference.getEndpointReferences().add(endpointReference);
        ((RuntimeComponentReference)componentReference).setComponent((RuntimeComponent)component);
        ((RuntimeEndpointReference)endpointReference).bind(compositeContext);
View Full Code Here


     
      messageFactory = getMessageFactory();
     
      if (responseTargetAddress instanceof EndpointReference){
          // fix the target as in this case it will be an EPR
          EndpointReference epr = (EndpointReference)responseTargetAddress;
          responseTargetAddress = (T)retrieveEndpointReference(epr.getURI());
      } // end if   
    } // end method readObject 
View Full Code Here

    }

    public EndpointReference readEndpointReference(String xml) {
        try {
            XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(xml));
            EndpointReference result = refProcessor.read(reader, new ProcessorContext(registry));
            reader.close();
            return result;
        } catch (Exception e) {
            throw new ServiceRuntimeException(e);
        }
View Full Code Here

        this.registry = registry;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        EndpointReference cloned = (EndpointReference)super.clone();

        if (targetEndpoint != null) {
            cloned.setTargetEndpoint((Endpoint)targetEndpoint.clone());
        }

        return cloned;
    }
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 QName getArtifactType() {
        return ENDPOINT_REFERENCE_QNAME;
    }

    public EndpointReference read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        EndpointReference endpointReference = assemblyFactory.createEndpointReference();
        if (reader.getEventType() == XMLStreamConstants.START_DOCUMENT) {
            reader.nextTag();
        }
        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);
           
            // set up the EPR so that resolution will happen
            // at wire creation time if needs be
            Endpoint endpoint = assemblyFactory.createEndpoint();
            endpointReference.setTargetEndpoint(endpoint);
           
            if (reference.getTargets().size() > 0){
                // create a dummy endpoint with the URI set so that
                // the endpoint registry will be consulted
                endpoint.setUnresolved(true);
                endpoint.setURI(reference.getTargets().get(0).getName());
                endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND);
                endpointReference.setUnresolved(true);
            } else {
                endpoint.setUnresolved(false);
                endpoint.setBinding(reference.getBindings().get(0));
                endpointReference.setStatus(EndpointReference.Status.RESOLVED_BINDING);
                endpointReference.setUnresolved(false);
            }           
        }
        return endpointReference;
    }
View Full Code Here

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

    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

        }
        Object payload = msg.getBody();

        Object contextId = null;

        EndpointReference from = msg.getFrom();

        // store the current thread context classloader
        // as we need to replace it with the class loader
        // used to load the java class as per SCA Spec
        ClassLoader tccl = Thread.currentThread().getContextClassLoader();
View Full Code Here

        componentReference.setInterfaceContract(interfaceContract);
        componentReference.setMultiplicity(Multiplicity.ONE_ONE);
        // component.getReferences().add(componentReference);

        // create endpoint reference
        EndpointReference endpointReference = assemblyFactory.createEndpointReference();
        endpointReference.setComponent(component);
        endpointReference.setReference(componentReference);
        endpointReference.setBinding(endpoint.getBinding());
        endpointReference.setUnresolved(false);
        endpointReference.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);

        endpointReference.setTargetEndpoint(endpoint);

        componentReference.getEndpointReferences().add(endpointReference);
        ((RuntimeComponentReference)componentReference).setComponent((RuntimeComponent)component);
        ((RuntimeEndpointReference)endpointReference).bind(compositeContext);
View Full Code Here

        String jsonParams = request.getPayload();
        Object[] args = JSONUtil.decodePayloadForOperation(jsonParams, operation);
        Message msg = new MessageImpl();
        msg.getHeaders().put(Constants.MESSAGE_ID, channel.getId());
        msg.setBody(args);
        EndpointReference re = new RuntimeEndpointReferenceImpl();
        RuntimeEndpointImpl callbackEndpoint = new RuntimeEndpointImpl();
        callbackEndpoint.setURI(request.getOperation());
        re.setCallbackEndpoint(callbackEndpoint);
        msg.setFrom(re);
        endpoint.invoke(operation, msg);
    }
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.