jrun.naming
Class NamingService

jrunx.kernel.ServiceAdapter
  |
  +--jrun.naming.NamingService
All Implemented Interfaces:
java.util.EventListener, NamingServiceMBean, javax.naming.Referenceable, java.lang.Runnable, java.io.Serializable, ServerEventListener, Service, ServiceMBean

public class NamingService
extends ServiceAdapter
implements NamingServiceMBean, ServerEventListener, java.lang.Runnable

This is the JNDI bootstrap class. It is a JRun and JMX service fired not via the server deployer, but by the core JRun bootstrap class (jrunx.kernel.JRun). This is necessary because the service infrastructure requires JNDI as an internal element instead of as a plugin.

The NamingService listens on a particular port that is configured via the Context.PROVIDER_URL in the server's SERVER-INF/jndi.properties file. It accepts requests from remote JRunNamingContext objects.

When a request arrives, it handles security authentication via a rendezvous with the JRunSecurityManager, and then sends a security id and a ContextProxy stub to the remote JRunNamingContext.

Author:
PS Neville
See Also:
Serialized Form

Field Summary
static java.lang.String OBJECT_NAME
          JMX Object Name of this service.
static ContextManager rootContext
          The top-level Context Proxy.
static JRunNamingContext serverContext
          This server's server-scoped context.
 
Fields inherited from class jrunx.kernel.ServiceAdapter
DEFAULT_DEACTIVATED, DEFAULT_DOMAIN, DOMAIN_NAME_SEPARATOR, DOMAIN_NAME_SUFFIX, domainName, jndiBindable, LOGGER_CACHE_TIME, SCHEDULER_SERVICE, SECURITY_MANAGER, server, status, TRANSACTION_MANAGER
 
Fields inherited from interface jrun.naming.NamingServiceMBean
AUTH, CLUSTER
 
Fields inherited from interface jrunx.kernel.Service
INITIALIZED, STARTED, STARTING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
NamingService()
          Deploys JNDI upon construction.
 
Method Summary
 int getJRMPPort()
          Get the port on which context proxy objects returned by the server are listening.
 int getOrbPort()
          Get the port on which COSNaming is listening.
 int getPort()
          Get the port on which the service listens for remote JRunNamingContext requests.
static int getServerPort()
          Return port, on which NamingService was started and accepts requests and start listening for requests from remote JRunNamingContext objects.
 void handleEvent(ServerEvent event, java.lang.Object handback)
          Handle a server event
 boolean isUsingCORBA()
           
 void restartJNDI()
          Convenience method for JMX
 void run()
          Handle requests from remote JRunNamingContext objects.
 void setJRMPPort(int port)
          Set the port on which context proxy objects returned by the server are listening.
 void setOrbPort(int port)
          Set the port on which COSNaming is listening.
 void setPort(int port)
          Set the port on which the service listens for remote JRunNamingContext requests.
 void setUsingCORBA(boolean b)
           
 void start()
          Enable remote access to JNDI by converting the root Context into a clustered service and starting the Naming server's network listener.
 void stop()
          Every service other than mere data collections should stop
 
Methods inherited from class jrunx.kernel.ServiceAdapter
bind, destroy, findObjectInstance, findObjectInstance, findObjectInstance, getBindToJNDI, getDeactivated, getDomainName, getDomainSearchPath, getJRunService, getLogger, getName, getParentService, getReference, getResourceManager, getServerName, getServerProperties, getStatus, init, invokeMethod, isInPartition, isPartition, lookup, postDeregister, postRegister, preDeregister, preRegister, requestServer, scheduleRunnable, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, toString, unbind, unscheduleRunnable, updateStatus
 
Methods inherited from interface jrunx.kernel.ServiceMBean
bind, getBindToJNDI, getDeactivated, getDomainName, getJRunService, getLogger, getName, getParentService, getServerName, requestServer, setBindToJNDI, setDeactivated, setDomainName, setName, setParentService, unbind
 
Methods inherited from interface jrunx.kernel.Service
destroy, getStatus, init, updateStatus
 

Field Detail

rootContext

public static ContextManager rootContext
The top-level Context Proxy.

serverContext

public static JRunNamingContext serverContext
This server's server-scoped context.

OBJECT_NAME

public static final java.lang.String OBJECT_NAME
JMX Object Name of this service.
Constructor Detail

NamingService

public NamingService()
Deploys JNDI upon construction.
Method Detail

getServerPort

public static int getServerPort()
Return port, on which NamingService was started and accepts requests and start listening for requests from remote JRunNamingContext objects.

start

public void start()
           throws java.lang.Exception
Enable remote access to JNDI by converting the root Context into a clustered service and starting the Naming server's network listener.
Specified by:
start in interface Service
Overrides:
start in class ServiceAdapter

handleEvent

public void handleEvent(ServerEvent event,
                        java.lang.Object handback)
Description copied from interface: ServerEventListener
Handle a server event
Specified by:
handleEvent in interface ServerEventListener
Following copied from interface: jrunx.kernel.ServerEventListener
Parameters:
event - The server event
handback - The object handback supplied when the listener was registered

run

public void run()
Handle requests from remote JRunNamingContext objects.
Specified by:
run in interface java.lang.Runnable

stop

public void stop()
Description copied from class: ServiceAdapter
Every service other than mere data collections should stop
Specified by:
stop in interface Service
Overrides:
stop in class ServiceAdapter

restartJNDI

public void restartJNDI()
                 throws java.lang.Exception
Convenience method for JMX
Specified by:
restartJNDI in interface NamingServiceMBean

setPort

public void setPort(int port)
Set the port on which the service listens for remote JRunNamingContext requests.
Specified by:
setPort in interface NamingServiceMBean

getPort

public int getPort()
Get the port on which the service listens for remote JRunNamingContext requests.
Specified by:
getPort in interface NamingServiceMBean

setJRMPPort

public void setJRMPPort(int port)
Set the port on which context proxy objects returned by the server are listening.
Specified by:
setJRMPPort in interface NamingServiceMBean

getJRMPPort

public int getJRMPPort()
Get the port on which context proxy objects returned by the server are listening.
Specified by:
getJRMPPort in interface NamingServiceMBean

setOrbPort

public void setOrbPort(int port)
Set the port on which COSNaming is listening.
Specified by:
setOrbPort in interface NamingServiceMBean

getOrbPort

public int getOrbPort()
Get the port on which COSNaming is listening.
Specified by:
getOrbPort in interface NamingServiceMBean

isUsingCORBA

public boolean isUsingCORBA()
Specified by:
isUsingCORBA in interface NamingServiceMBean

setUsingCORBA

public void setUsingCORBA(boolean b)
Specified by:
setUsingCORBA in interface NamingServiceMBean


Copyright � 2002 Macromedia Corporation. All Rights Reserved.