org.apache.activemq.transport.discovery.rendezvous
Class RendezvousDiscoveryAgent

java.lang.Object
  extended by org.apache.activemq.transport.discovery.rendezvous.RendezvousDiscoveryAgent
All Implemented Interfaces:
java.util.EventListener, ServiceListener, Service, DiscoveryAgent

public class RendezvousDiscoveryAgent
extends java.lang.Object
implements DiscoveryAgent, ServiceListener

A DiscoveryAgent using Zeroconf via the jmDNS library


Constructor Summary
RendezvousDiscoveryAgent()
           
 
Method Summary
 void addService(JmDNS jmDNS, java.lang.String type, java.lang.String name)
           
protected  JmDNS createJmDNS()
           
protected  java.net.InetAddress createLocalAddress()
           
protected  ServiceInfo createServiceInfo(java.lang.String name, java.util.Map map)
           
 java.lang.String getGroup()
           
 JmDNS getJmdns()
           
 java.net.InetAddress getLocalAddress()
           
 java.lang.String getLocalhost()
           
 int getPriority()
           
 java.lang.String getType()
           
 int getWeight()
           
 void registerService(java.lang.String name)
          register a service
 void removeService(JmDNS jmDNS, java.lang.String type, java.lang.String name)
           
 void resolveService(JmDNS jmDNS, java.lang.String type, java.lang.String name, ServiceInfo serviceInfo)
           
 void serviceAdded(ServiceEvent event)
          A service has been added.
 void serviceFailed(DiscoveryEvent event)
          A process actively using a service may see it go down before the DiscoveryAgent notices the service's failure.
 void serviceRemoved(ServiceEvent event)
          A service has been removed.
 void serviceResolved(ServiceEvent event)
          A service has been resolved.
 void setDiscoveryListener(DiscoveryListener listener)
          Sets the discovery listener
 void setGroup(java.lang.String group)
           
 void setJmdns(JmDNS jmdns)
           
 void setLocalAddress(java.net.InetAddress localAddress)
           
 void setLocalhost(java.lang.String localhost)
           
 void setPriority(int priority)
           
 void setWeight(int weight)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RendezvousDiscoveryAgent

public RendezvousDiscoveryAgent()
Method Detail

start

public void start()
           throws java.lang.Exception
Specified by:
start in interface Service
Throws:
java.lang.Exception

stop

public void stop()
Specified by:
stop in interface Service

registerService

public void registerService(java.lang.String name)
                     throws java.io.IOException
Description copied from interface: DiscoveryAgent
register a service

Specified by:
registerService in interface DiscoveryAgent
Throws:
java.io.IOException

addService

public void addService(JmDNS jmDNS,
                       java.lang.String type,
                       java.lang.String name)

removeService

public void removeService(JmDNS jmDNS,
                          java.lang.String type,
                          java.lang.String name)

serviceAdded

public void serviceAdded(ServiceEvent event)
Description copied from interface: ServiceListener
A service has been added.

Specified by:
serviceAdded in interface ServiceListener
Parameters:
event - The ServiceEvent providing the name and fully qualified type of the service.

serviceRemoved

public void serviceRemoved(ServiceEvent event)
Description copied from interface: ServiceListener
A service has been removed.

Specified by:
serviceRemoved in interface ServiceListener
Parameters:
event - The ServiceEvent providing the name and fully qualified type of the service.

serviceResolved

public void serviceResolved(ServiceEvent event)
Description copied from interface: ServiceListener
A service has been resolved. Its details are now available in the ServiceInfo record.

Specified by:
serviceResolved in interface ServiceListener
Parameters:
event - The ServiceEvent providing the name, the fully qualified type of the service, and the service info record, or null if the service could not be resolved.

resolveService

public void resolveService(JmDNS jmDNS,
                           java.lang.String type,
                           java.lang.String name,
                           ServiceInfo serviceInfo)

getPriority

public int getPriority()

setPriority

public void setPriority(int priority)

getWeight

public int getWeight()

setWeight

public void setWeight(int weight)

getJmdns

public JmDNS getJmdns()
               throws java.io.IOException
Throws:
java.io.IOException

setJmdns

public void setJmdns(JmDNS jmdns)

getLocalAddress

public java.net.InetAddress getLocalAddress()
                                     throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

setLocalAddress

public void setLocalAddress(java.net.InetAddress localAddress)

getLocalhost

public java.lang.String getLocalhost()

setLocalhost

public void setLocalhost(java.lang.String localhost)

createServiceInfo

protected ServiceInfo createServiceInfo(java.lang.String name,
                                        java.util.Map map)

createJmDNS

protected JmDNS createJmDNS()
                     throws java.io.IOException
Throws:
java.io.IOException

createLocalAddress

protected java.net.InetAddress createLocalAddress()
                                           throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

setDiscoveryListener

public void setDiscoveryListener(DiscoveryListener listener)
Description copied from interface: DiscoveryAgent
Sets the discovery listener

Specified by:
setDiscoveryListener in interface DiscoveryAgent

getGroup

public java.lang.String getGroup()

setGroup

public void setGroup(java.lang.String group)

getType

public java.lang.String getType()

serviceFailed

public void serviceFailed(DiscoveryEvent event)
                   throws java.io.IOException
Description copied from interface: DiscoveryAgent
A process actively using a service may see it go down before the DiscoveryAgent notices the service's failure. That process can use this method to notify the DiscoveryAgent of the failure so that other listeners of this DiscoveryAgent can also be made aware of the failure.

Specified by:
serviceFailed in interface DiscoveryAgent
Throws:
java.io.IOException


Copyright © 2005-2011 FuseSource, Corp.. All Rights Reserved.