Package org.apache.tuscany.sca.binding.notification.encoding

Examples of org.apache.tuscany.sca.binding.notification.encoding.EndpointReference


        } else {
            // returned lists contain broker consumers and producers and are the
            // same length
            int index = consumerList.size() - 1;
            // establish connection with picked broker
            EndpointReference brokerConsumerEPR = consumerList.get(index);
            EndpointReference brokerProducerEPR = producerList.get(index);
            serviceBindingProvider.deployBroker(brokerID, brokerProducerEPR, null);
            referenceBindingProvider.deployBroker(brokerID, brokerConsumerEPR, null);
        }
    }
View Full Code Here


        private Subscribe sub;
       
        public WriteableSubscribe(URL url, String brokerID) {
            EndpointAddress epa = new EndpointAddress();
            epa.setAddress(url);
            EndpointReference epr = new EndpointReference();
            epr.setEndpointAddress(epa);
            if (brokerID != null) {
                BrokerID cbi = new BrokerID();
                cbi.setID(brokerID);
                ReferenceProperties crp = new ReferenceProperties();
                crp.addProperty(cbi);
                epr.setReferenceProperties(crp);
            }
            ConsumerReference cr = new ConsumerReference();
            cr.setReference(epr);
            sub = new Subscribe();
            sub.setConsumerReference(cr);
View Full Code Here

        private ConnectionOverride connectionOverride;
       
        public WriteableConnectionOverride(URL brokerConsumerUrl, String brokerID) {
            EndpointAddress epa = new EndpointAddress();
            epa.setAddress(brokerConsumerUrl);
            EndpointReference brokerConsumerEPR = new EndpointReference();
            brokerConsumerEPR.setEndpointAddress(epa);
            BrokerID cbi = new BrokerID();
            cbi.setID(brokerID);
            ReferenceProperties crp = new ReferenceProperties();
            crp.addProperty(cbi);
            brokerConsumerEPR.setReferenceProperties(crp);
            BrokerConsumerReference brokerConsumerReference = new BrokerConsumerReference();
            brokerConsumerReference.setReference(brokerConsumerEPR);
            connectionOverride = new ConnectionOverride();
            connectionOverride.setBrokerConsumerReference(brokerConsumerReference);
        }
View Full Code Here

        } else {
            // returned lists contain broker consumers and producers and are the
            // same length
            int index = consumerList.size() - 1;
            // establish connection with picked broker
            EndpointReference brokerConsumerEPR = consumerList.get(index);
            EndpointReference brokerProducerEPR = producerList.get(index);
            serviceBindingProvider.deployBroker(brokerID, brokerProducerEPR, null);
            referenceBindingProvider.deployBroker(brokerID, brokerConsumerEPR, null);
        }
    }
View Full Code Here

                        brokerElt.setBrokerProducerReference(bpr);
                        brokers.addBrokerToSequence(brokerElt);
                    }
                    nbr.setBrokers(brokers);
                }
                EndpointReference consumerEPR = nb.getBrokerConsumerReference().getReference();
                URL consumerUrl = consumerEPR.getEndpointAddress().getAddress();
                BrokerID consumerBrokerID = consumerEPR.getReferenceProperties().getProperty(BrokerID.class);
                EndpointReference producerEPR = nb.getBrokerProducerReference().getReference();
                URL producerUrl = producerEPR.getEndpointAddress().getAddress();
                BrokerID producerBrokerID = producerEPR.getReferenceProperties().getProperty(BrokerID.class);
                if (consumerBrokerID == null ||
                        producerBrokerID == null ||
                            !consumerBrokerID.getID().equals(producerBrokerID.getID())) {
                    throw new RuntimeException("Producer and consumer broker ids do not match");
                }
View Full Code Here

                if (brokerList == null) {
                    throw new RuntimeException("No broker to remove for [" + notificationType + "]");
                }
               
                NeighborBrokerConsumers nbcs = rb.getNeighborBrokerConsumers();
                EndpointReference rbEpr = rb.getBrokerConsumerReference().getReference();
                if (nbcs != null && nbcs.getReferenceSequence() != null) {
                    List<Broker> neighborBrokers = new ArrayList<Broker>();
                    for (EndpointReference neighborBrokerConsumerEpr : nbcs.getReferenceSequence()) {
                        BrokerStruct neighborBrokerStruct = null;
                        URL neighborBrokerConsumerEprUrl = neighborBrokerConsumerEpr.getEndpointAddress().getAddress();
                        for (BrokerStruct brokerStruct : brokerList) {
                            if (brokerStruct.consumerUrl.equals(neighborBrokerConsumerEprUrl)) {
                                neighborBrokerStruct = brokerStruct;
                                break;
                            }
                        }
                        if (neighborBrokerStruct == null) {
                            throw new RuntimeException("Can't find neighbor broker for consumer EPR [" +
                                                       neighborBrokerConsumerEprUrl + "]");
                        }
                        BrokerConsumerReference bcr = new BrokerConsumerReference();
                        bcr.setReference(EncodingUtils.createEndpointReference(neighborBrokerStruct.consumerUrl, neighborBrokerStruct.brokerID));
                        BrokerProducerReference bpr = new BrokerProducerReference();
                        bpr.setReference(EncodingUtils.createEndpointReference(neighborBrokerStruct.producerUrl, neighborBrokerStruct.brokerID));
                        Broker neighborBroker = new Broker();
                        neighborBroker.setBrokerConsumerReference(bcr);
                        neighborBroker.setBrokerProducerReference(bpr);
                        neighborBrokers.add(neighborBroker);
                    }
                    int lastIndex = neighborBrokers.size() - 1;
                    for (int index = lastIndex; index >= 0; index--) {
                        List<Broker> writeableNeighborBrokers = ((index > 0) ? neighborBrokers.subList(0, index) : null);
                        WriteableReplaceBrokerConnection wrbc = new WriteableReplaceBrokerConnection(rbEpr, writeableNeighborBrokers);
                        URL targetUrl =
                            neighborBrokers.get(index).getBrokerProducerReference().getReference().getEndpointAddress().getAddress();
                        try {
                            IOUtils.sendHttpRequest(targetUrl, Constants.REPLACE_BROKER_CONNECTION_OP, wrbc, null);
                        } catch(Exception e) {
                            e.printStackTrace();
                            throw new RuntimeException(e);
                        }
                    }
                }
               
                BrokerStruct removedBrokerStruct = null;
                URL rbEprUrl = rbEpr.getEndpointAddress().getAddress();
                for (BrokerStruct brokerSruct : brokerList) {
                    if (brokerSruct.consumerUrl.equals(rbEprUrl)) {
                        removedBrokerStruct = brokerSruct;
                        break;
                    }
View Full Code Here

        private EndpointReferenceWrapper epw;
       
        public WriteableEPW(EndpointReferenceWrapper epw, URL url) {
            EndpointAddress epa = new EndpointAddress();
            epa.setAddress(url);
            EndpointReference epr = new EndpointReference();
            epr.setEndpointAddress(epa);
            epw.setReference(epr);
            this.epw = epw;
        }
View Full Code Here

        private Subscribe sub;
       
        public WriteableSubscribe(URL url, String brokerID) {
            EndpointAddress epa = new EndpointAddress();
            epa.setAddress(url);
            EndpointReference epr = new EndpointReference();
            epr.setEndpointAddress(epa);
            if (brokerID != null) {
                BrokerID cbi = new BrokerID();
                cbi.setID(brokerID);
                ReferenceProperties crp = new ReferenceProperties();
                crp.addProperty(cbi);
                epr.setReferenceProperties(crp);
            }
            ConsumerReference cr = new ConsumerReference();
            cr.setReference(epr);
            sub = new Subscribe();
            sub.setConsumerReference(cr);
View Full Code Here

        private ConnectionOverride connectionOverride;
       
        public WriteableConnectionOverride(URL brokerConsumerUrl, String brokerID) {
            EndpointAddress epa = new EndpointAddress();
            epa.setAddress(brokerConsumerUrl);
            EndpointReference brokerConsumerEPR = new EndpointReference();
            brokerConsumerEPR.setEndpointAddress(epa);
            BrokerID cbi = new BrokerID();
            cbi.setID(brokerID);
            ReferenceProperties crp = new ReferenceProperties();
            crp.addProperty(cbi);
            brokerConsumerEPR.setReferenceProperties(crp);
            BrokerConsumerReference brokerConsumerReference = new BrokerConsumerReference();
            brokerConsumerReference.setReference(brokerConsumerEPR);
            connectionOverride = new ConnectionOverride();
            connectionOverride.setBrokerConsumerReference(brokerConsumerReference);
        }
View Full Code Here

        setBrokerID(brokerID);
        servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
    }
   
    public void undeployBroker(URL brokerConsumerUrl) {
        EndpointReference brokerConsumerEpr = EncodingUtils.createEndpointReference(brokerConsumerUrl, getBrokerID());
        ntm.removeBroker(brokerConsumerEpr, getNeighborBrokerConsumerEprs(), remoteNtmUrl);
        removeBrokerSubscribers();
    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.notification.encoding.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.