org.apache.activemq.transport.discovery.zeroconf
Class ZeroconfDiscoveryAgent

java.lang.Object
  extended by org.apache.activemq.transport.discovery.zeroconf.ZeroconfDiscoveryAgent
All Implemented Interfaces:
EventListener, javax.jmdns.ServiceListener, Service, DiscoveryAgent

public class ZeroconfDiscoveryAgent
extends Object
implements DiscoveryAgent, javax.jmdns.ServiceListener

A DiscoveryAgent using Zeroconf via the jmDNS library


Constructor Summary
ZeroconfDiscoveryAgent()
           
 
Method Summary
 void addService(javax.jmdns.JmDNS jmDNS, String type, String name)
           
protected  javax.jmdns.JmDNS createJmDNS()
           
protected  InetAddress createLocalAddress()
           
protected  javax.jmdns.ServiceInfo createServiceInfo(String name, Map map)
           
 String getGroup()
           
 javax.jmdns.JmDNS getJmdns()
           
 InetAddress getLocalAddress()
           
 String getLocalhost()
           
 int getPriority()
           
 String getType()
           
 int getWeight()
           
 void registerService(String name)
          register a service
 void removeService(javax.jmdns.JmDNS jmDNS, String type, String name)
           
 void resolveService(javax.jmdns.JmDNS jmDNS, String type, String name, javax.jmdns.ServiceInfo serviceInfo)
           
 void serviceAdded(javax.jmdns.ServiceEvent event)
           
 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(javax.jmdns.ServiceEvent event)
           
 void serviceResolved(javax.jmdns.ServiceEvent event)
           
 void setDiscoveryListener(DiscoveryListener listener)
          Sets the discovery listener
 void setGroup(String group)
           
 void setJmdns(javax.jmdns.JmDNS jmdns)
           
 void setLocalAddress(InetAddress localAddress)
           
 void setLocalhost(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

ZeroconfDiscoveryAgent

public ZeroconfDiscoveryAgent()
Method Detail

start

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

stop

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

registerService

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

Specified by:
registerService in interface DiscoveryAgent
Throws:
IOException

addService

public void addService(javax.jmdns.JmDNS jmDNS,
                       String type,
                       String name)

removeService

public void removeService(javax.jmdns.JmDNS jmDNS,
                          String type,
                          String name)

serviceAdded

public void serviceAdded(javax.jmdns.ServiceEvent event)
Specified by:
serviceAdded in interface javax.jmdns.ServiceListener

serviceRemoved

public void serviceRemoved(javax.jmdns.ServiceEvent event)
Specified by:
serviceRemoved in interface javax.jmdns.ServiceListener

serviceResolved

public void serviceResolved(javax.jmdns.ServiceEvent event)
Specified by:
serviceResolved in interface javax.jmdns.ServiceListener

resolveService

public void resolveService(javax.jmdns.JmDNS jmDNS,
                           String type,
                           String name,
                           javax.jmdns.ServiceInfo serviceInfo)

getPriority

public int getPriority()

setPriority

public void setPriority(int priority)

getWeight

public int getWeight()

setWeight

public void setWeight(int weight)

getJmdns

public javax.jmdns.JmDNS getJmdns()
                           throws IOException
Throws:
IOException

setJmdns

public void setJmdns(javax.jmdns.JmDNS jmdns)

getLocalAddress

public InetAddress getLocalAddress()
                            throws UnknownHostException
Throws:
UnknownHostException

setLocalAddress

public void setLocalAddress(InetAddress localAddress)

getLocalhost

public String getLocalhost()

setLocalhost

public void setLocalhost(String localhost)

createServiceInfo

protected javax.jmdns.ServiceInfo createServiceInfo(String name,
                                                    Map map)

createJmDNS

protected javax.jmdns.JmDNS createJmDNS()
                                 throws IOException
Throws:
IOException

createLocalAddress

protected InetAddress createLocalAddress()
                                  throws UnknownHostException
Throws:
UnknownHostException

setDiscoveryListener

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

Specified by:
setDiscoveryListener in interface DiscoveryAgent

getGroup

public String getGroup()

setGroup

public void setGroup(String group)

getType

public String getType()

serviceFailed

public void serviceFailed(DiscoveryEvent event)
                   throws 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:
IOException


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.