org.jnp.server
Class Main

java.lang.Object
  extended by org.jnp.server.Main
All Implemented Interfaces:
MainMBean, NamingBean

public class Main
extends Object
implements MainMBean

A main() entry point for running the jnp naming service implementation as a standalone process.

Version:
$Revision: 88682 $
Author:
Rickard Oberg, Scott.Stark@jboss.org

Field Summary
protected  int backlog
          The serverSocket listen queue depth
protected  InetAddress bindAddress
          The interface to bind to for the lookup socket.
protected  RMIClientSocketFactory clientSocketFactory
          An optional custom client socket factory
protected  String clientSocketFactoryName
          The class name of the optional custom client socket factory
protected  boolean InstallGlobalService
          A flag indicating if theServer will be set as the NamingContext.setLocal value
protected  boolean isStubExported
           
protected  ServerSocketFactory jnpServerSocketFactory
          An optional custom server socket factory
protected  String jnpServerSocketFactoryName
          The class name of the optional custom JNP server socket factory
protected  org.jboss.logging.Logger log
           
protected  int port
          The jnp protocol listening port.
protected  InetAddress rmiBindAddress
          The interface to bind to for the Naming RMI server
protected  int rmiPort
          The RMI port on which the Naming implementation will be exported.
protected  ServerSocket serverSocket
          The jnp server socket through which the NamingServer stub is vended
protected  RMIServerSocketFactory serverSocketFactory
          An optional custom server socket factory
protected  String serverSocketFactoryName
          The class name of the optional custom server socket factory
protected  MarshalledObject serverStub
           
protected  NamingBean theServer
          The Naming interface server implementation
protected  boolean UseGlobalService
          A flag indicating if theServer will try to use the NamingContext.setLocal value
 
Constructor Summary
Main()
           
Main(String categoryName)
           
 
Method Summary
 int getBacklog()
           
 String getBindAddress()
           
 String getBootstrapURL()
          Returns a URL suitable for use as a java.naming.provider.url value in a set of naming environment properties; i.e.
 boolean getCallByValue()
          Get the call by value flag for jndi lookups.
 String getClientSocketFactory()
           
 RMIClientSocketFactory getClientSocketFactoryBean()
          The RMIClientSocketFactory bean
 boolean getInstallGlobalService()
           
 String getJNPServerSocketFactory()
           
 ServerSocketFactory getJNPServerSocketFactoryBean()
          The JNPServerSocketFactory implementation class
 Executor getLookupExector()
           
 Exception getLookupListenerException()
          Get any exception seen during the lookup listening port creation
 NamingBean getNamingInfo()
           
 Naming getNamingInstance()
          Access the
 Object getNamingProxy()
          Get the externally define Naming proxy instance
 int getPort()
           
 String getRmiBindAddress()
           
 int getRmiPort()
           
 String getServerSocketFactory()
           
 RMIServerSocketFactory getServerSocketFactoryBean()
          The RMIServerSocketFactory bean
 boolean getUseGlobalService()
          Get the UseGlobalService which defines whether the MainMBean's Naming server will initialized from the existing NamingContext.setLocal global value.
protected  void initBootstrapListener()
          Bring up the bootstrap lookup port for obtaining the naming service proxy
protected  void initCustomSocketFactories()
          Init the clientSocketFactory, serverSocketFactory using the bind address.
protected  void initJnpInvoker()
          This code should be moved to a seperate invoker in the org.jboss.naming package.
 boolean isEnableRmiServerHostname()
           
static void main(String[] args)
           
 void setBacklog(int backlog)
           
 void setBindAddress(String host)
           
 void setCallByValue(boolean flag)
          Set the call by value flag for jndi lookups.
 void setClientSocketFactory(String factoryClassName)
          The RMIClientSocketFactory implementation class
 void setClientSocketFactoryBean(RMIClientSocketFactory factory)
           
 void setEnableRmiServerHostname(boolean enableRmiServerHostname)
           
 void setInstallGlobalService(boolean flag)
          Whether the MainMBean's Naming server will be installed as the NamingContext.setLocal global value
 void setJNPServerSocketFactory(String factoryClassName)
           
 void setJNPServerSocketFactoryBean(ServerSocketFactory factory)
           
 void setLookupExector(Executor lookupExector)
          Set the Executor to use for bootstrap socket lookup handling.
 void setLookupPool(org.jboss.util.threadpool.ThreadPool lookupPool)
          Deprecated. 
 void setNamingInfo(NamingBean info)
          Set the NamingBean/Naming implementation
 void setNamingProxy(Object proxy)
           
 void setPort(int p)
           
 void setRmiBindAddress(String host)
           
 void setRmiPort(int p)
           
 void setServerSocketFactory(String factoryClassName)
          The RMIServerSocketFactory implementation class
 void setServerSocketFactoryBean(RMIServerSocketFactory factory)
           
 void setUseGlobalService(boolean flag)
          Set the UseGlobalService which defines whether the MainMBean's Naming server will initialized from the existing NamingContext.setLocal global value.
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theServer

protected NamingBean theServer
The Naming interface server implementation


serverStub

protected MarshalledObject serverStub

isStubExported

protected boolean isStubExported

serverSocket

protected ServerSocket serverSocket
The jnp server socket through which the NamingServer stub is vended


clientSocketFactory

protected RMIClientSocketFactory clientSocketFactory
An optional custom client socket factory


serverSocketFactory

protected RMIServerSocketFactory serverSocketFactory
An optional custom server socket factory


jnpServerSocketFactory

protected ServerSocketFactory jnpServerSocketFactory
An optional custom server socket factory


clientSocketFactoryName

protected String clientSocketFactoryName
The class name of the optional custom client socket factory


serverSocketFactoryName

protected String serverSocketFactoryName
The class name of the optional custom server socket factory


jnpServerSocketFactoryName

protected String jnpServerSocketFactoryName
The class name of the optional custom JNP server socket factory


bindAddress

protected InetAddress bindAddress
The interface to bind to for the lookup socket. This is useful for multi-homed hosts that want control over which interfaces accept connections


rmiBindAddress

protected InetAddress rmiBindAddress
The interface to bind to for the Naming RMI server


backlog

protected int backlog
The serverSocket listen queue depth


port

protected int port
The jnp protocol listening port. The default is 1099, the same as the RMI registry default port.


rmiPort

protected int rmiPort
The RMI port on which the Naming implementation will be exported. The default is 0 which means use any available port.


InstallGlobalService

protected boolean InstallGlobalService
A flag indicating if theServer will be set as the NamingContext.setLocal value


UseGlobalService

protected boolean UseGlobalService
A flag indicating if theServer will try to use the NamingContext.setLocal value


log

protected org.jboss.logging.Logger log
Constructor Detail

Main

public Main()

Main

public Main(String categoryName)
Method Detail

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

getNamingInfo

public NamingBean getNamingInfo()
Specified by:
getNamingInfo in interface MainMBean

setNamingInfo

public void setNamingInfo(NamingBean info)
Set the NamingBean/Naming implementation

Specified by:
setNamingInfo in interface MainMBean
Parameters:
info -

setLookupPool

@Deprecated
public void setLookupPool(org.jboss.util.threadpool.ThreadPool lookupPool)
Deprecated. 


getLookupExector

public Executor getLookupExector()

setLookupExector

public void setLookupExector(Executor lookupExector)
Set the Executor to use for bootstrap socket lookup handling. Note that this must support at least 2 thread to avoid hanging the AcceptHandler accept loop.

Parameters:
lookupExector - - An Executor that supports at least 2 threads

getLookupListenerException

public Exception getLookupListenerException()
Get any exception seen during the lookup listening port creation

Specified by:
getLookupListenerException in interface MainMBean
Returns:

getCallByValue

public boolean getCallByValue()
Get the call by value flag for jndi lookups.

Specified by:
getCallByValue in interface MainMBean
Returns:
true if all lookups are unmarshalled using the caller's TCL, false if in VM lookups return the value by reference.

setCallByValue

public void setCallByValue(boolean flag)
Set the call by value flag for jndi lookups.

Specified by:
setCallByValue in interface MainMBean
Parameters:
flag - - true if all lookups are unmarshalled using the caller's TCL, false if in VM lookups return the value by reference.

getNamingProxy

public Object getNamingProxy()
                      throws Exception
Description copied from interface: MainMBean
Get the externally define Naming proxy instance

Specified by:
getNamingProxy in interface MainMBean
Returns:
Throws:
Exception

setNamingProxy

public void setNamingProxy(Object proxy)
                    throws IOException
Specified by:
setNamingProxy in interface MainMBean
Throws:
IOException

setRmiPort

public void setRmiPort(int p)
Specified by:
setRmiPort in interface MainMBean

getRmiPort

public int getRmiPort()
Specified by:
getRmiPort in interface MainMBean

setPort

public void setPort(int p)
Specified by:
setPort in interface MainMBean

getPort

public int getPort()
Specified by:
getPort in interface MainMBean

getBindAddress

public String getBindAddress()
Specified by:
getBindAddress in interface MainMBean

setBindAddress

public void setBindAddress(String host)
                    throws UnknownHostException
Specified by:
setBindAddress in interface MainMBean
Throws:
UnknownHostException

getRmiBindAddress

public String getRmiBindAddress()
Specified by:
getRmiBindAddress in interface MainMBean

setRmiBindAddress

public void setRmiBindAddress(String host)
                       throws UnknownHostException
Specified by:
setRmiBindAddress in interface MainMBean
Throws:
UnknownHostException

getBootstrapURL

public String getBootstrapURL()
Returns a URL suitable for use as a java.naming.provider.url value in a set of naming environment properties; i.e. one that can be used to connect to the lookup socket.

Specified by:
getBootstrapURL in interface MainMBean
Returns:
the URL, or null if no bound lookup socket exists

isEnableRmiServerHostname

public boolean isEnableRmiServerHostname()

setEnableRmiServerHostname

public void setEnableRmiServerHostname(boolean enableRmiServerHostname)

getBacklog

public int getBacklog()
Specified by:
getBacklog in interface MainMBean

setBacklog

public void setBacklog(int backlog)
Specified by:
setBacklog in interface MainMBean

getInstallGlobalService

public boolean getInstallGlobalService()
Specified by:
getInstallGlobalService in interface MainMBean

setInstallGlobalService

public void setInstallGlobalService(boolean flag)
Description copied from interface: MainMBean
Whether the MainMBean's Naming server will be installed as the NamingContext.setLocal global value

Specified by:
setInstallGlobalService in interface MainMBean

getUseGlobalService

public boolean getUseGlobalService()
Description copied from interface: MainMBean
Get the UseGlobalService which defines whether the MainMBean's Naming server will initialized from the existing NamingContext.setLocal global value.

Specified by:
getUseGlobalService in interface MainMBean
Returns:
true if this should try to use VM global naming service, false otherwise

setUseGlobalService

public void setUseGlobalService(boolean flag)
Description copied from interface: MainMBean
Set the UseGlobalService which defines whether the MainMBean's Naming server will initialized from the existing NamingContext.setLocal global value. This allows one to export multiple servers via different transports and still share the same underlying naming service.

Specified by:
setUseGlobalService in interface MainMBean

getClientSocketFactory

public String getClientSocketFactory()
Specified by:
getClientSocketFactory in interface MainMBean

setClientSocketFactory

public void setClientSocketFactory(String factoryClassName)
                            throws ClassNotFoundException,
                                   InstantiationException,
                                   IllegalAccessException
Description copied from interface: MainMBean
The RMIClientSocketFactory implementation class

Specified by:
setClientSocketFactory in interface MainMBean
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException

getClientSocketFactoryBean

public RMIClientSocketFactory getClientSocketFactoryBean()
Description copied from interface: MainMBean
The RMIClientSocketFactory bean

Specified by:
getClientSocketFactoryBean in interface MainMBean

setClientSocketFactoryBean

public void setClientSocketFactoryBean(RMIClientSocketFactory factory)
Specified by:
setClientSocketFactoryBean in interface MainMBean

getServerSocketFactory

public String getServerSocketFactory()
Specified by:
getServerSocketFactory in interface MainMBean

setServerSocketFactory

public void setServerSocketFactory(String factoryClassName)
                            throws ClassNotFoundException,
                                   InstantiationException,
                                   IllegalAccessException
Description copied from interface: MainMBean
The RMIServerSocketFactory implementation class

Specified by:
setServerSocketFactory in interface MainMBean
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException

getServerSocketFactoryBean

public RMIServerSocketFactory getServerSocketFactoryBean()
Description copied from interface: MainMBean
The RMIServerSocketFactory bean

Specified by:
getServerSocketFactoryBean in interface MainMBean

setServerSocketFactoryBean

public void setServerSocketFactoryBean(RMIServerSocketFactory factory)
Specified by:
setServerSocketFactoryBean in interface MainMBean

getJNPServerSocketFactory

public String getJNPServerSocketFactory()
Specified by:
getJNPServerSocketFactory in interface MainMBean

setJNPServerSocketFactory

public void setJNPServerSocketFactory(String factoryClassName)
                               throws ClassNotFoundException,
                                      InstantiationException,
                                      IllegalAccessException
Specified by:
setJNPServerSocketFactory in interface MainMBean
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException

getJNPServerSocketFactoryBean

public ServerSocketFactory getJNPServerSocketFactoryBean()
Description copied from interface: MainMBean
The JNPServerSocketFactory implementation class

Specified by:
getJNPServerSocketFactoryBean in interface MainMBean

setJNPServerSocketFactoryBean

public void setJNPServerSocketFactoryBean(ServerSocketFactory factory)
Specified by:
setJNPServerSocketFactoryBean in interface MainMBean

getNamingInstance

public Naming getNamingInstance()
Access the

Specified by:
getNamingInstance in interface NamingBean

start

public void start()
           throws Exception
Specified by:
start in interface MainMBean
Throws:
Exception

stop

public void stop()
Specified by:
stop in interface MainMBean

initJnpInvoker

protected void initJnpInvoker()
                       throws IOException
This code should be moved to a seperate invoker in the org.jboss.naming package.

Throws:
IOException

initBootstrapListener

protected void initBootstrapListener()
Bring up the bootstrap lookup port for obtaining the naming service proxy


initCustomSocketFactories

protected void initCustomSocketFactories()
Init the clientSocketFactory, serverSocketFactory using the bind address.



Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.