org.sapia.ubik.ioc.guice
Class NamingServiceImpl

java.lang.Object
  extended by org.sapia.ubik.ioc.guice.NamingServiceImpl
All Implemented Interfaces:
NamingService, JndiDiscoListener

public class NamingServiceImpl
extends java.lang.Object
implements NamingService, JndiDiscoListener


Constructor Summary
NamingServiceImpl(java.lang.String domain)
           
 
Method Summary
 void bind(java.lang.String name, java.lang.Object o)
          Binds the given object to the remote Ubik JNDI provider to which this instance corresponds.
protected  DiscoveryHelper getDiscoHelper(EventChannel channel)
           
protected  DiscoveryHelper getDiscoHelper(java.lang.String domain, java.lang.String mcastHost, int mcastPort)
           
 EventChannel getEventChannel()
           
protected  javax.naming.InitialContext getInitialContext(java.lang.String domain, java.lang.String host, int port)
           
 java.lang.Object lookup(java.lang.String name)
          Looks up the object under the given name.
 void onJndiDiscovered(javax.naming.Context context)
           
 void register(ServiceDiscoListener listener)
          Registers the given listener with this instance.
 void setDomain(java.lang.String domain)
           
 NamingServiceImpl setJndiHost(java.lang.String host)
           
 NamingServiceImpl setJndiPort(int port)
           
 void setMulticastAddress(java.lang.String addr)
           
 void setMulticastPort(int port)
           
 void shutdown()
          Shuts down this instance.
 void unregister(ServiceDiscoListener listener)
          Unregisters the given listener from this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamingServiceImpl

public NamingServiceImpl(java.lang.String domain)
                  throws java.io.IOException
Throws:
java.io.IOException
Method Detail

setJndiHost

public NamingServiceImpl setJndiHost(java.lang.String host)
Parameters:
host - the host of the remote Ubik JNDI server.

setJndiPort

public NamingServiceImpl setJndiPort(int port)
Parameters:
port - the port of the remote Ubik JNDI server.

setDomain

public void setDomain(java.lang.String domain)
Parameters:
domain - the domain of the remote Ubik JNDI server.

setMulticastAddress

public void setMulticastAddress(java.lang.String addr)
Parameters:
addr - the multicast address to use for discovering remote JNDI servers.

setMulticastPort

public void setMulticastPort(int port)
Parameters:
port - the multicast port to use for discovering remote JNDI servers.

getEventChannel

public EventChannel getEventChannel()

bind

public void bind(java.lang.String name,
                 java.lang.Object o)
          throws javax.naming.NamingException
Description copied from interface: NamingService
Binds the given object to the remote Ubik JNDI provider to which this instance corresponds.

Specified by:
bind in interface NamingService
Parameters:
name - the name under which to bind the object.
o - the object to bind.
Throws:
javax.naming.NamingException

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws javax.naming.NamingException,
                               javax.naming.NameNotFoundException
Description copied from interface: NamingService
Looks up the object under the given name.

Specified by:
lookup in interface NamingService
Parameters:
name - the name of the remote object to lookup.
Throws:
javax.naming.NamingException
javax.naming.NameNotFoundException

register

public void register(ServiceDiscoListener listener)
Description copied from interface: NamingService
Registers the given listener with this instance.

Specified by:
register in interface NamingService
Parameters:
listener - a ServiceDiscoListener.

unregister

public void unregister(ServiceDiscoListener listener)
Description copied from interface: NamingService
Unregisters the given listener from this instance.

Specified by:
unregister in interface NamingService
Parameters:
listener - a ServiceDiscoListener.

shutdown

public void shutdown()
Description copied from interface: NamingService
Shuts down this instance.

Specified by:
shutdown in interface NamingService

onJndiDiscovered

public void onJndiDiscovered(javax.naming.Context context)
Specified by:
onJndiDiscovered in interface JndiDiscoListener

getDiscoHelper

protected DiscoveryHelper getDiscoHelper(java.lang.String domain,
                                         java.lang.String mcastHost,
                                         int mcastPort)
                                  throws java.io.IOException
Throws:
java.io.IOException

getDiscoHelper

protected DiscoveryHelper getDiscoHelper(EventChannel channel)
                                  throws java.io.IOException
Throws:
java.io.IOException

getInitialContext

protected javax.naming.InitialContext getInitialContext(java.lang.String domain,
                                                        java.lang.String host,
                                                        int port)
                                                 throws javax.naming.NamingException
Throws:
javax.naming.NamingException


Copyright © 2010 Sapia OSS. All Rights Reserved.