public class ORBHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_CORBA_PROTOCOL
The default CORBA protocol (valie="").
|
static java.lang.String |
DEFAULT_NAME_SERVICE_HOST
The default node name for the name service (value="localhost").
|
static java.lang.String |
DEFAULT_NAME_SERVICE_NAME
The default name service name (value="NameService").
|
static java.lang.String |
DEFAULT_NAME_SERVICE_PORT
The default name service port (value=2809).
|
static java.lang.String |
DEFAULT_ORB_IMPLEMENTATION
The default ORB implementation identifier (value=SUN_ORB_IDENT).
|
static int |
INIT_PORT
The startup port, from that the coutering starts to get a free port number.
|
static java.lang.String |
JAC_ORB_IDENT
The JAC ORB implementation identifier (value="JacORB")
|
static int |
MAX_RETRY
The maximum number of retries to find the name service.
|
static java.lang.String |
OPEN_ORB_IDENT
The SUN ORB implementation identifier (value="OpenORB")
|
static java.lang.String |
SUN_ORB_IDENT
The SUN ORB implementation identifier (value="SunORB")
|
Constructor and Description |
---|
ORBHelper()
The constructor receiving the instance element selection consumer.
|
ORBHelper(org.omg.CORBA.ORB orb,
java.lang.String initialRef)
The constructor receiving the instance element selection consumer.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
createOrb()
Create the orb.
|
static org.omg.CORBA.ORB |
createOrb(java.lang.String nameServiceHost,
java.lang.String nameServicePort,
java.lang.String orbImplementation,
java.lang.String nameServiceName)
Create an ORB.
|
static org.omg.CORBA.ORB |
createOrb(java.lang.String nameServiceHost,
java.lang.String nameServicePort,
java.lang.String corbaProtocol,
java.lang.String orbImplementation,
java.lang.String nameServiceName)
Create an ORB.
|
static org.omg.PortableServer.POA |
createPOA(java.lang.Object object)
Create a POA using a class.
|
static org.omg.PortableServer.POA |
createPOA(org.omg.PortableServer.POA parent,
java.lang.Object object)
Create a POA using a class.
|
static org.omg.PortableServer.POA |
createPOA(org.omg.PortableServer.POA parent,
java.lang.String name)
Create a POA
|
org.omg.PortableServer.POA |
createPOA(java.lang.String name)
Create a POA
|
protected void |
debug(java.lang.String message)
Print out a debug message.
|
protected void |
finalize()
Finalize the object.
|
static ORBHelper |
getInstance()
Get the instance of the helper.
|
java.util.logging.Level |
getLogLevel()
Get the log level.
|
org.omg.CosNaming.NamingContextExt |
getNameService()
Get the name service.
|
static org.omg.CosNaming.NamingContextExt |
getNameService(org.omg.CORBA.ORB orb,
java.lang.String orbInitRef)
Get the name service.
|
java.lang.String |
getNameServiceName()
Get the name service name.
|
static java.lang.String |
getNameServiceName(java.lang.String initialRef)
Get the name service name.
|
org.omg.CORBA.ORB |
getORB()
Get the orb
|
int |
getPort()
Get the portnumber.
|
int |
getPortNumber()
Get the port number.
|
org.omg.PortableServer.POA |
getRoot()
Get the root POA
|
static org.omg.CORBA.Object |
getServiceByName(org.omg.CORBA.ORB orb,
org.omg.CosNaming.NamingContextExt nameService,
java.lang.String serviceName)
Get the service that is registered at name service with the given name.
|
static void |
main(java.lang.String[] args) |
static java.lang.String |
nameServiceName(java.lang.String orbInitRef)
Extract the name service name from initial reference string.
|
static int |
portNumber(java.lang.String initialRef)
Get the port number.
|
void |
release()
Release the CORBA stuff and shutdown orb.
|
void |
setLogLevel(java.util.logging.Level level)
Set the log level.
|
static void |
shutdownOrb(org.omg.CORBA.ORB orb)
Shutdown the ORB.
|
java.lang.String |
toString() |
public static final java.lang.String SUN_ORB_IDENT
public static final java.lang.String OPEN_ORB_IDENT
public static final java.lang.String JAC_ORB_IDENT
public static final java.lang.String DEFAULT_NAME_SERVICE_NAME
public static final java.lang.String DEFAULT_NAME_SERVICE_PORT
public static final java.lang.String DEFAULT_CORBA_PROTOCOL
public static final java.lang.String DEFAULT_NAME_SERVICE_HOST
public static final java.lang.String DEFAULT_ORB_IMPLEMENTATION
public static final int MAX_RETRY
public static final int INIT_PORT
public ORBHelper()
public ORBHelper(org.omg.CORBA.ORB orb, java.lang.String initialRef) throws java.lang.Exception
orb
- the orb implementation.initialRef
- the initial reference string.java.lang.Exception
- if the POA creation process fails.public static ORBHelper getInstance()
public int getPort()
public org.omg.CORBA.ORB getORB()
public org.omg.PortableServer.POA getRoot()
public org.omg.PortableServer.POA createPOA(java.lang.String name) throws org.omg.PortableServer.POAPackage.AdapterAlreadyExists, org.omg.PortableServer.POAManagerPackage.AdapterInactive, org.omg.PortableServer.POAPackage.InvalidPolicy
name
- the name of the new POA.org.omg.PortableServer.POAPackage.AdapterAlreadyExists
- If the POA already exists.org.omg.PortableServer.POAManagerPackage.AdapterInactive
- If the adapter exist but is not active.org.omg.PortableServer.POAPackage.InvalidPolicy
- If the policy is not sufficient.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void release()
protected boolean createOrb()
public static org.omg.CORBA.ORB createOrb(java.lang.String nameServiceHost, java.lang.String nameServicePort, java.lang.String orbImplementation, java.lang.String nameServiceName) throws java.lang.Exception
parameter | default |
nameServiceHost | localhost |
nameServicePort | 2809 |
nameServiceName | NameService |
orbImplementation | sunORB |
nameServiceHost
- the name service host namenameServicePort
- the name service portorbImplementation
- the orb implementation (sunOrb and openORB are currently implemented).nameServiceName
- the name service namejava.lang.Exception
- if the ORB implementation is not handled.public static org.omg.CORBA.ORB createOrb(java.lang.String nameServiceHost, java.lang.String nameServicePort, java.lang.String corbaProtocol, java.lang.String orbImplementation, java.lang.String nameServiceName) throws java.lang.Exception
parameter | default |
nameServiceHost | localhost |
nameServicePort | 2809 |
corbaProtocol | |
nameServiceName | NameService |
orbImplementation | sunORB |
nameServiceHost
- the name service host namenameServicePort
- the name service portcorbaProtocol
- the CORBA protocolorbImplementation
- the orb implementation (sunOrb and openORB are currently implemented).nameServiceName
- the name service namejava.lang.Exception
- if the ORB implementation is not handled.public static void shutdownOrb(org.omg.CORBA.ORB orb)
orb
- the orb to be shutdown.public org.omg.CosNaming.NamingContextExt getNameService() throws java.lang.Exception
java.lang.Exception
- if something is wrong with the connection.java.lang.Exception
- if the communication fails.public static org.omg.CosNaming.NamingContextExt getNameService(org.omg.CORBA.ORB orb, java.lang.String orbInitRef) throws java.lang.Exception
orb
- the orb implementation.orbInitRef
- the initial reference string.java.lang.Exception
- if the communication fails.public static java.lang.String nameServiceName(java.lang.String orbInitRef)
orbInitRef
- the initial reference string.public java.lang.String getNameServiceName()
orbInitRef
- public static java.lang.String getNameServiceName(java.lang.String initialRef)
orbInitRef
- public int getPortNumber()
public static int portNumber(java.lang.String initialRef)
initialRef
- the initial reference string.public void setLogLevel(java.util.logging.Level level)
level
- the log level.Level
public java.util.logging.Level getLogLevel()
Level
public static org.omg.PortableServer.POA createPOA(org.omg.PortableServer.POA parent, java.lang.Object object) throws org.omg.PortableServer.POAPackage.AdapterAlreadyExists, org.omg.PortableServer.POAManagerPackage.AdapterInactive, org.omg.PortableServer.POAPackage.InvalidPolicy
org.omg.PortableServer.POAPackage.AdapterAlreadyExists
org.omg.PortableServer.POAManagerPackage.AdapterInactive
org.omg.PortableServer.POAPackage.InvalidPolicy
public static org.omg.PortableServer.POA createPOA(java.lang.Object object) throws org.omg.PortableServer.POAPackage.AdapterAlreadyExists, org.omg.PortableServer.POAManagerPackage.AdapterInactive, org.omg.PortableServer.POAPackage.InvalidPolicy
org.omg.PortableServer.POAPackage.AdapterAlreadyExists
org.omg.PortableServer.POAManagerPackage.AdapterInactive
org.omg.PortableServer.POAPackage.InvalidPolicy
public static org.omg.PortableServer.POA createPOA(org.omg.PortableServer.POA parent, java.lang.String name) throws org.omg.PortableServer.POAPackage.AdapterAlreadyExists, org.omg.PortableServer.POAManagerPackage.AdapterInactive, org.omg.PortableServer.POAPackage.InvalidPolicy
org.omg.PortableServer.POAPackage.AdapterAlreadyExists
org.omg.PortableServer.POAManagerPackage.AdapterInactive
org.omg.PortableServer.POAPackage.InvalidPolicy
public static org.omg.CORBA.Object getServiceByName(org.omg.CORBA.ORB orb, org.omg.CosNaming.NamingContextExt nameService, java.lang.String serviceName) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.CannotProceed
orb
- the ORBnameService
- the name serviceserviceName
- the name of the service.org.omg.CosNaming.NamingContextPackage.NotFound
org.omg.CosNaming.NamingContextPackage.InvalidName
org.omg.CosNaming.NamingContextPackage.CannotProceed
protected void debug(java.lang.String message)
message
- the message to be printed.public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args) throws java.lang.Throwable
java.lang.Throwable