Package org.apache.tuscany.sca.assembly

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


            if (i < serviceURI.length() - 1) {
                serviceName = serviceURI.substring(i + 1);
            }
        }

        Endpoint ep = endpoints.get(0);
        if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) {
            return ((RuntimeComponent)ep.getComponent()).getServiceReference(interfaze, serviceName).getService();
        } else {
            return getRemoteProxy(interfaze, ep);
        }
    }
View Full Code Here


    }

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

        return null;

    }

    public synchronized void updateEndpoint(String uri, Endpoint endpoint) {
        Endpoint oldEndpoint = getEndpoint(uri);
        if (oldEndpoint == null) {
            throw new IllegalArgumentException("Endpoint is not found: " + uri);
        }
        endpoints.remove(oldEndpoint);
        endpoints.add(endpoint);
View Full Code Here

    public synchronized void start() {
    }

    public synchronized void stop() {
        for (Iterator<Endpoint> i = endpoints.iterator(); i.hasNext();) {
            Endpoint ep = i.next();
            i.remove();
            endpointRemoved(ep);
        }
        endpointreferences.clear();
        listeners.clear();
View Full Code Here

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

    public Endpoint read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        Endpoint endpoint = assemblyFactory.createEndpoint();
        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);
            ComponentService service = component.getServices().get(0);
            Binding binding = service.getBindings().get(0);
            endpoint.setComponent(component);
            endpoint.setService(service);
            endpoint.setBinding(binding);
        }
        return endpoint;
    }
View Full Code Here

        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());
        String targetPath = targetURI.getPath();

        return "tuscany.AtomService(\"" + targetPath + "\")";
View Full Code Here

        if (!remoteClient) {
            List<Endpoint> endpoints = domainRegistry.findEndpoint(serviceURI);
            if (endpoints.size() < 1) {
                throw new NoSuchServiceException(serviceURI);
            }
            Endpoint ep = endpoints.get(0);
            if (((RuntimeComponent)ep.getComponent()).getComponentContext() != null) {
                return ((RuntimeComponent)ep.getComponent()).getServiceReference(serviceInterface, serviceName).getService();
            }
        }

        InvocationHandler handler;
        if (!remoteClient) {
View Full Code Here

            List<Endpoint> eps = domainRegistry.findEndpoint(serviceName);
            if (eps == null || eps.size() < 1) {
                throw new NoSuchServiceException(serviceName);
            }
            Endpoint endpoint = eps.get(0); // TODO: what should be done with multiple endpoints?
            
            if (serviceInterface == null) {
                try {
                    findInterface(endpoint);
                } catch (Exception e) {
View Full Code Here

    }   
   
    public Message invokeRequest(Message msg) {

            EndpointReference from = assemblyFactory.createEndpointReference();
            Endpoint fromEndpoint = assemblyFactory.createEndpoint();
            from.setTargetEndpoint(fromEndpoint);
            from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
            msg.setFrom(from);
            Endpoint callbackEndpoint = assemblyFactory.createEndpoint();
//            callbackEndpoint.setURI(callbackAddress); // TODO: is this needed? Seems to work without it
            callbackEndpoint.setUnresolved(true);
            from.setCallbackEndpoint(callbackEndpoint);

            return msg;

    } // end method invokeRequest
View Full Code Here

TOP

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

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.