org.sapia.ubik.rmi.naming.remote.discovery
Class DiscoveryHelper

java.lang.Object
  extended by org.sapia.ubik.rmi.naming.remote.discovery.DiscoveryHelper
All Implemented Interfaces:
AsyncEventListener

public class DiscoveryHelper
extends java.lang.Object
implements AsyncEventListener

An instance of this class can be used by applications to listen for the appearance of a) appearing JNDI servers; b) existing JNDI servers; and c) appearing service bindings.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site

Field Summary
protected  EventChannel _channel
           
 
Constructor Summary
DiscoveryHelper(EventChannel ec)
          Constructor for DiscoveryHelper.
DiscoveryHelper(java.lang.String domain)
          Creates an instance of this class that will listen for new JNDI servers and for the binding of new services on the given domain.
DiscoveryHelper(java.lang.String domain, java.lang.String mcastAddr, int mcastPort)
          Creates an instance of this class that will listen for new JNDI servers and for the binding of new services on the given domain.
 
Method Summary
 void addJndiDiscoListener(JndiDiscoListener listener)
          Adds a JNDI discovery listener to this instance.
 void addServiceDiscoListener(ServiceDiscoListener listener)
          Adds a service discovery listener to this instance.
 void close()
          Closes this instance - should thereafter be discarded.
 EventChannel getChannel()
          Returns this instance's event channel.
protected  java.lang.String getJndiURI(TCPAddress addr)
           
 void onAsyncEvent(RemoteEvent evt)
          Receives multicast events.
 void removeJndiDiscoListener(JndiDiscoListener listener)
          Removes the given JNDI discovery listener from this instance.
 void removeServiceDiscoListener(ServiceDiscoListener listener)
          Removes the given service discovery listener from this instance.
 void setContextResolver(ContextResolver res)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_channel

protected EventChannel _channel
Constructor Detail

DiscoveryHelper

public DiscoveryHelper(EventChannel ec)
Constructor for DiscoveryHelper.


DiscoveryHelper

public DiscoveryHelper(java.lang.String domain)
                throws java.io.IOException
Creates an instance of this class that will listen for new JNDI servers and for the binding of new services on the given domain.

Parameters:
domain - the name of a domain.
Throws:
java.io.IOException

DiscoveryHelper

public DiscoveryHelper(java.lang.String domain,
                       java.lang.String mcastAddr,
                       int mcastPort)
                throws java.io.IOException
Creates an instance of this class that will listen for new JNDI servers and for the binding of new services on the given domain.

Parameters:
domain - the name of a domain.
mcastAddr - the multicast address to use internally.
mcastPort - the multicast port on which to listen.
Throws:
java.io.IOException
Method Detail

setContextResolver

public void setContextResolver(ContextResolver res)
Parameters:
res - the ContextResolver that this instance should use when notified about new JNDI servers.

addServiceDiscoListener

public void addServiceDiscoListener(ServiceDiscoListener listener)
Adds a service discovery listener to this instance.

Parameters:
a - ServiceDiscoListener.

removeServiceDiscoListener

public void removeServiceDiscoListener(ServiceDiscoListener listener)
Removes the given service discovery listener from this instance.

Parameters:
a - ServiceDiscoListener.

addJndiDiscoListener

public void addJndiDiscoListener(JndiDiscoListener listener)
Adds a JNDI discovery listener to this instance.

Parameters:
a - JndiDiscoListener.

removeJndiDiscoListener

public void removeJndiDiscoListener(JndiDiscoListener listener)
Removes the given JNDI discovery listener from this instance.

Parameters:
a - JndiDiscoListener.

onAsyncEvent

public void onAsyncEvent(RemoteEvent evt)
Description copied from interface: AsyncEventListener
Receives multicast events.

Specified by:
onAsyncEvent in interface AsyncEventListener
Parameters:
evt - a RemoteEvent.
See Also:
AsyncEventListener.onAsyncEvent(RemoteEvent)

close

public void close()
Closes this instance - should thereafter be discarded.


getChannel

public EventChannel getChannel()
Returns this instance's event channel.


getJndiURI

protected java.lang.String getJndiURI(TCPAddress addr)


Copyright © 2010 Sapia OSS. All Rights Reserved.