Package org.apache.tuscany.sca.assembly

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


        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


        reg2.stop();
    }

    private Endpoint assertExists(HazelcastEndpointRegistry reg, String uri) throws InterruptedException {
        Endpoint ep = reg.getEndpoint(uri);
        Assert.assertNotNull(ep);
        Assert.assertEquals(uri, ep.getURI());
        return ep;
    }
View Full Code Here

        attrs.put("bind", "127.0.0.1");
        ReplicatedEndpointRegistry ep1 = new ReplicatedEndpointRegistry(extensionPoints, attrs, "foo", "bar");
        System.out.println("ep1 is: " + ep1);
        ep1.start();

        Endpoint e1 = assemblyFactory.createEndpoint();
        e1.setURI("e1uri");
        ((RuntimeEndpoint) e1).bind(extensionPoints, ep1);
        ep1.addEndpoint(e1);

        Endpoint e1p = ep1.getEndpoint("e1uri");
        System.out.println("EP1 in Registry 1: " + e1p);
        Assert.assertNotNull(e1p);

        ReplicatedEndpointRegistry ep2 = new ReplicatedEndpointRegistry(extensionPoints, attrs, "foo", "bar");
        System.out.println("ep2 is: " + ep2);
        ep2.start();
        Thread.sleep(5000);

        Endpoint e1p2 = ep2.getEndpoint("e1uri");
        System.out.println("EP1 in Registry 2: " + e1p2);
        Assert.assertNotNull(e1p2);

        ReplicatedEndpointRegistry ep3 = new ReplicatedEndpointRegistry(extensionPoints, attrs, "foo", "bar");
        System.out.println("ep3 is: " + ep3);
        ep3.start();
        Thread.sleep(5000);

        Endpoint e1p3 = ep3.getEndpoint("e1uri");
        System.out.println("EP1 in Registry 3: " + e1p3);
        Assert.assertNotNull(e1p3);

        ep1.stop();
        ep2.stop();
View Full Code Here

        reg3.stop();
        System.out.println(); // closed
    }

    private Endpoint assertExists(ReplicatedEndpointRegistry reg, String uri) throws InterruptedException {
        Endpoint ep = null;
        int count = 0;
        while (ep == null && count < 15) {
            ep = reg.getEndpoint(uri);
            Thread.sleep(1000);
            count++;
            System.out.println(reg + ": tries=" + count);
        }
        Assert.assertNotNull(ep);
        Assert.assertEquals(uri, ep.getURI());
        return ep;
    }
View Full Code Here

            return false;
        }
    }

    private Invoker getInvoker(RuntimeEndpointReference epr, Operation operation) {
        Endpoint target = epr.getTargetEndpoint();
        if (target != null) {
            RuntimeComponentService service = (RuntimeComponentService)target.getService();
            if (service != null) { // not a callback wire
                InvocationChain chain = ((RuntimeEndpoint)target).getInvocationChain(operation);

                boolean passByValue = false;
                Operation targetOp = chain.getTargetOperation();
View Full Code Here

        // Axis2 operationClients can not be shared so create a new one for each request
        final OperationClient operationClient = serviceClient.createClient(wsdlOperationName);
        operationClient.setOptions(options);

        Endpoint callbackEndpoint = msg.getFrom().getCallbackEndpoint();

        SOAPEnvelope sev = requestMC.getEnvelope();
        SOAPHeader sh = sev.getHeader();
       
        // Add WS-Addressing header for the invocation of a bidirectional service
        if (callbackEndpoint != null) {
            // Load the actual callback endpoint URI into an Axis EPR ready to form the content of the wsa:From header
            EndpointReference fromEPR = new EndpointReference(callbackEndpoint.getBinding().getURI());
          
            addWSAFromHeader( sh, fromEPR );
            addWSAActionHeader( sh );
            addWSAMessageIDHeader( sh, (String)msg.getHeaders().get("MESSAGE_ID"));
           
View Full Code Here

      String address = null;
     
        // if target endpoint was not specified when this invoker was created,
        // use dynamically specified target endpoint passed in with the message
        if (options.getTo() == null) {
            Endpoint ep = msg.getTo();
            if (ep != null && ep.getBinding() != null) {
                address = ep.getBinding().getURI();
            } else {
                throw new ServiceRuntimeException("[BWS20025] Unable to determine destination endpoint for endpoint reference " + endpointReference);
            }
        } else {
          address = options.getTo().getAddress();
View Full Code Here

                        // until the wire is created though in order that the
                        // uri is calculated correctly
                        // Callback endpoints may not be added here in the case that the
                        // forward reference is not yet resolved.
                        for (Binding binding : service.getBindings()) {
                            Endpoint endpoint = assemblyFactory.createEndpoint();
                            endpoint.setComponent(component);
                            endpoint.setService(service);
                            endpoint.setBinding(binding);
                            endpoint.setUnresolved(false);
                            service.getEndpoints().add(endpoint);
                        } // end for
                    } finally {
                        monitor.popContext();
                    }                  
View Full Code Here

        }
        endpointRemoved(oldEp);
    }

    public void entryUpdated(Object key, Object oldValue, Object newValue) {
        Endpoint oldEp = (Endpoint)oldValue;
        Endpoint newEp = (Endpoint)newValue;
        if (!isLocal(newEp)) {
            logger.info(" Remote endpoint updated: " + newEp);
        }
        endpointUpdated(oldEp, newEp);
    }
View Full Code Here

    }

    public Member getOwningMember(String serviceURI) {
        for (String memberAddr : endpointOwners.keySet()) {
            for (String service : endpointOwners.get(memberAddr)) {
                Endpoint ep = assemblyFactory.createEndpoint();
                ep.setURI(service);
                if (ep.matches(serviceURI)) {
                    for (Member m : getHazelcastInstance().getCluster().getMembers()) {
                        if (memberAddr.equals(m.getInetSocketAddress().toString())) {
                            return m;
                        }
                    }
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.