org.sapia.ubik.rmi.naming.remote
Class EmbeddableJNDIServer

java.lang.Object
  extended by org.sapia.ubik.rmi.naming.remote.EmbeddableJNDIServer
All Implemented Interfaces:
java.lang.Runnable, java.rmi.Remote, AsyncEventListener, RemoteContextProvider

public class EmbeddableJNDIServer
extends java.lang.Object
implements java.lang.Runnable, RemoteContextProvider, AsyncEventListener

This class implements an embeddable JNDI server.

Usage:

 EmbeddableJNDIServer jndi = new EmbeddableJNDIServer();
 jndi.start(true);
 // use it...
 jndi.stop();
 

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2004 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

Constructor Summary
EmbeddableJNDIServer()
          Creates an instance of this class that will listen on the default (1099) port, on the "default" domain.
EmbeddableJNDIServer(java.lang.String domain, int port)
          Creates an instance of this class that will listen on the given port and domain.
EmbeddableJNDIServer(java.lang.String domain, int port, java.lang.String mcastAddress, int mcastPort)
          Creates an instance of this class that will listen on the given port and domain.
 
Method Summary
 EventChannel getEventChannel()
          Returns the event channel that this instance uses to broacast events and subscribe to notifications.
 RemoteContext getRemoteContext()
           
 javax.naming.Context getRootContext()
           
 void onAsyncEvent(RemoteEvent evt)
          Receives multicast events.
 void run()
           
 void start(boolean daemon)
          Starts this instance.
 void stop()
          Stops this instance (this internally closes the EventChannel that this instance holds).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmbeddableJNDIServer

public EmbeddableJNDIServer()
Creates an instance of this class that will listen on the default (1099) port, on the "default" domain. Also internally binds its multicast event channel to the default multicast address and port.

See Also:
Consts.DEFAULT_MCAST_ADDR, Consts.DEFAULT_MCAST_PORT

EmbeddableJNDIServer

public EmbeddableJNDIServer(java.lang.String domain,
                            int port)
Creates an instance of this class that will listen on the given port and domain. Also internally binds its multicast event channel to the default multicast address and port.

See Also:
Consts.DEFAULT_MCAST_ADDR, Consts.DEFAULT_MCAST_PORT

EmbeddableJNDIServer

public EmbeddableJNDIServer(java.lang.String domain,
                            int port,
                            java.lang.String mcastAddress,
                            int mcastPort)
Creates an instance of this class that will listen on the given port and domain. Also internally binds its multicast event channel to the given multicast address and port.

Method Detail

getEventChannel

public EventChannel getEventChannel()
Returns the event channel that this instance uses to broacast events and subscribe to notifications.

Returns:
this instance's EventChannel.

onAsyncEvent

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

Specified by:
onAsyncEvent in interface AsyncEventListener
Parameters:
evt - a RemoteEvent.

getRootContext

public javax.naming.Context getRootContext()
Returns:
this instance's root JNDI Context.

getRemoteContext

public RemoteContext getRemoteContext()
Specified by:
getRemoteContext in interface RemoteContextProvider
Returns:
a RemoteContext, or null if no such context exists.

stop

public void stop()
Stops this instance (this internally closes the EventChannel that this instance holds).


start

public void start(boolean daemon)
           throws java.lang.Exception
Starts this instance.

Parameters:
daemon - if true, this instance will be started as a daemon thread.
Throws:
java.lang.Exception

run

public final void run()
Specified by:
run in interface java.lang.Runnable


Copyright © 2010 Sapia OSS. All Rights Reserved.