Package org.apache.servicemix.jbi.servicedesc

Examples of org.apache.servicemix.jbi.servicedesc.InternalEndpoint


     * Registers a remote endpoint
     *
     * @param remote
     */
    public void registerRemoteEndpoint(InternalEndpoint remote) {
        InternalEndpoint endpoint = (InternalEndpoint) internalEndpoints.get(getKey(remote));
        // Create endpoint if not already existing
        if (endpoint == null) {
            endpoint = new InternalEndpoint(null, remote.getEndpointName(), remote.getServiceName());
            internalEndpoints.put(getKey(endpoint), endpoint);
        }
        // Add remote endpoint
        endpoint.addRemoteEndpoint(remote);
        fireEvent(remote, EndpointEvent.REMOTE_ENDPOINT_REGISTERED);
    }
View Full Code Here


     *
     * @param remote
     */
    public void unregisterRemoteEndpoint(InternalEndpoint remote) {
        String key = getKey(remote);
        InternalEndpoint endpoint = (InternalEndpoint) internalEndpoints.get(key);
        if (endpoint != null) {
            endpoint.removeRemoteEndpoint(remote);
            if (!endpoint.isClustered() && !endpoint.isLocal()) {
                internalEndpoints.remove(key);
                unregisterEndpoint(endpoint);
            }
            fireEvent(remote, EndpointEvent.REMOTE_ENDPOINT_UNREGISTERED);
        }
View Full Code Here

public class InternalEndpointTest extends TestCase {

    public void testSerializeDeserialize() throws Exception {
        ComponentNameSpace cns = new ComponentNameSpace("myContainer", "myName");
        InternalEndpoint e = new InternalEndpoint(cns, "myEndpoint", new QName("myService"));
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(e);
        oos.close();
       
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bais);
        Object out = ois.readObject();
       
        assertNotNull(out);
        assertTrue(out instanceof InternalEndpoint);
        InternalEndpoint outE = (InternalEndpoint) out;
        assertNotNull(outE.getComponentNameSpace());
        assertNotNull(outE.getServiceName());
        assertNotNull(outE.getEndpointName());
    }
View Full Code Here

        assertNotNull(outE.getEndpointName());
    }
   
    public void testEquals() throws Exception {
        ComponentNameSpace cns = new ComponentNameSpace("myContainer", "myName");
        InternalEndpoint e1 = new InternalEndpoint(cns, "myEndpoint1", new QName("myService"));
        InternalEndpoint e2 = new InternalEndpoint(cns, "myEndpoint2", new QName("myService"));
        assertFalse(e1.equals(e2));
        e2 = new InternalEndpoint(cns, "myEndpoint", new QName("myService2"));
        assertFalse(e1.equals(e2));
        ComponentNameSpace cns2 = new ComponentNameSpace("myContainer2", "myId2");
        e2 = new InternalEndpoint(cns2, "myEndpoint1", new QName("myService"));
        assertTrue(e1.equals(e2));
        cns2 = new ComponentNameSpace("myContainer", "myName");
        e2 = new InternalEndpoint(cns2, "myEndpoint1", new QName("myService"));
        assertTrue(e1.equals(e2));
    }
View Full Code Here

      Boolean source = (Boolean) exchange.getProperty(FROM_SUBSCRIPTION_MANAGER);
      if (source == null || !source.booleanValue()) {
          List list = registry.getMatchingSubscriptionEndpoints(exchange);
          if (list != null) {
              for (int i = 0; i < list.size(); i++) {
                  InternalEndpoint endpoint = (InternalEndpoint)list.get(i);
                  dispatchToSubscriber(exchange, endpoint);
              }
          }
          return list != null && !list.isEmpty();
      } else {
View Full Code Here

            // get the list of services
            if (service != null) {
                ServiceEndpoint[] ses = registry.getEndpointsForService(service);
                if (ses != null) {
                    for (int i = 0; i < ses.length; i++) {
                        InternalEndpoint se = (InternalEndpoint) ses[i];
                        if (se.getComponentNameSpace() != null && se.getComponentNameSpace().equals(sourceId)) {
                            result = true;
                            break;
                        }
                    }
                }
            }
            if (result && interfaceName != null) {
                ServiceEndpoint[] ses = registry.getEndpointsForInterface(interfaceName);
                if (ses != null) {
                    result = false;
                    for (int i = 0; i < ses.length; i++) {
                        InternalEndpoint se = (InternalEndpoint) ses[i];
                        if (se.getComponentNameSpace() != null && se.getComponentNameSpace().equals(sourceId)) {
                            result = true;
                            break;
                        }
                    }
                }
View Full Code Here

            SubscriptionSpec subscription = (SubscriptionSpec) entry.getKey();
            if (subscription.matches(registry,exchange)) {
                if (result == null) {
                    result = new ArrayList();
                }
                InternalEndpoint endpoint = (InternalEndpoint) entry.getValue();
                result.add(endpoint);
            }
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.servicemix.jbi.servicedesc.InternalEndpoint

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.