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

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

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

A DiscoveryAgent using Zeroconf via the jmDNS library


Constructor Summary
ZeroconfDiscoveryAgent()
           
 
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)
           
 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)
           
 void serviceResolved(ServiceEvent event)
           
 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

ZeroconfDiscoveryAgent

public ZeroconfDiscoveryAgent()
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)
Specified by:
serviceAdded in interface ServiceListener

serviceRemoved

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

serviceResolved

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

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-2012 The Apache Software Foundation. All Rights Reserved.