mx4j.tools.naming
Class NamingService

java.lang.Object
  extended bymx4j.tools.naming.NamingService
All Implemented Interfaces:
NamingServiceMBean

public class NamingService
extends java.lang.Object
implements NamingServiceMBean

An MBean that wraps rmiregistry.

Calling start() will launch rmiregistry in the same JVM; this way rmiregistry will have in its classpath the same classes the JVM has.

Version:
$Revision: 1.11 $

Constructor Summary
NamingService()
          Creates a new instance of NamingService with the default rmiregistry port (1099).
NamingService(int port)
          Creates a new instance of NamingService with the specified port.
 
Method Summary
 int getPort()
          Returns the port on which rmiregistry listens for incoming connections
 boolean isRunning()
          Returns whether this MBean has been started and not yet stopped.
 java.lang.String[] list()
          Returns an array of the names bound in the rmiregistry
 void setPort(int port)
          Sets the port on which rmiregistry listens for incoming connections.
 void start()
          Starts this MBean: rmiregistry can now accept incoming calls
 void stop()
          Stops this MBean: rmiregistry cannot accept anymore incoming calls
 void unbind(java.lang.String name)
          Removes the binding for the specified name in the rmiregistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamingService

public NamingService()
Creates a new instance of NamingService with the default rmiregistry port (1099).


NamingService

public NamingService(int port)
Creates a new instance of NamingService with the specified port.

Method Detail

setPort

public void setPort(int port)
Description copied from interface: NamingServiceMBean
Sets the port on which rmiregistry listens for incoming connections. Can be called only if this service is not running.

Specified by:
setPort in interface NamingServiceMBean
See Also:
NamingServiceMBean.getPort()

getPort

public int getPort()
Description copied from interface: NamingServiceMBean
Returns the port on which rmiregistry listens for incoming connections

Specified by:
getPort in interface NamingServiceMBean
See Also:
NamingServiceMBean.setPort(int)

isRunning

public boolean isRunning()
Description copied from interface: NamingServiceMBean
Returns whether this MBean has been started and not yet stopped.

Specified by:
isRunning in interface NamingServiceMBean
See Also:
NamingServiceMBean.start()

start

public void start()
           throws java.rmi.RemoteException
Description copied from interface: NamingServiceMBean
Starts this MBean: rmiregistry can now accept incoming calls

Specified by:
start in interface NamingServiceMBean
Throws:
java.rmi.RemoteException
See Also:
NamingServiceMBean.stop(), NamingServiceMBean.isRunning()

stop

public void stop()
          throws java.rmi.NoSuchObjectException
Description copied from interface: NamingServiceMBean
Stops this MBean: rmiregistry cannot accept anymore incoming calls

Specified by:
stop in interface NamingServiceMBean
Throws:
java.rmi.NoSuchObjectException
See Also:
NamingServiceMBean.start()

list

public java.lang.String[] list()
                        throws java.rmi.RemoteException
Description copied from interface: NamingServiceMBean
Returns an array of the names bound in the rmiregistry

Specified by:
list in interface NamingServiceMBean
Throws:
java.rmi.RemoteException
See Also:
Registry.list()

unbind

public void unbind(java.lang.String name)
            throws java.rmi.RemoteException,
                   java.rmi.NotBoundException
Description copied from interface: NamingServiceMBean
Removes the binding for the specified name in the rmiregistry

Specified by:
unbind in interface NamingServiceMBean
Throws:
java.rmi.RemoteException
java.rmi.NotBoundException
See Also:
Registry.unbind(String)


Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.