aicas logo Jamaica 3.4 release 8

com.sun.jndi.toolkit.corba
Class CorbaUtils

java.lang.Object
  extended by com.sun.jndi.toolkit.corba.CorbaUtils

public class CorbaUtils
extends Object

Contains utilities for performing CORBA-related tasks: 1. Get the org.omg.CORBA.Object for a java.rmi.Remote object. 2. Create an ORB to use for a given host/port, and environment properties.


Constructor Summary
CorbaUtils()
           
 
Method Summary
static ORB getOrb(String server, int port, Hashtable env)
          Get ORB using given server and port number, and properties from environment.
static Object remoteToCorba(Remote remoteObj, ORB orb)
          Returns the CORBA object reference associated with a Remote object by using the javax.rmi.CORBA package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CorbaUtils

public CorbaUtils()
Method Detail

remoteToCorba

public static Object remoteToCorba(Remote remoteObj,
                                   ORB orb)
                            throws ClassNotFoundException,
                                   ConfigurationException
Returns the CORBA object reference associated with a Remote object by using the javax.rmi.CORBA package.

Use reflection to avoid hard dependencies on javax.rmi.CORBA package. This method effective does the following:

 java.lang.Object stub;
 try {
     stub = PortableRemoteObject.toStub(remoteObj);
 } catch (Exception e) {
     throw new ConfigurationException("Object not exported or not found");
 }
 if (!(stub instanceof javax.rmi.CORBA.Stub)) {
     return null; // JRMP impl or JRMP stub
 }
 try {
     ((javax.rmi.CORBA.Stub)stub).connect(orb);  // try to connect IIOP stub
 } catch (RemoteException e) {
     // ignore 'already connected' error
 }
 return (javax.rmi.CORBA.Stub)stub;

Parameters:
remoteObj - The non-null remote object for
orb - The non-null ORB to connect the remote object to
Returns:
The CORBA Object for remoteObj; null if remoteObj is a JRMP implementation or JRMP stub.
Throws:
ClassNotFoundException - The RMI-IIOP package is not available
ConfigurationException - The CORBA Object cannot be obtained because of configuration problems.

getOrb

public static ORB getOrb(String server,
                         int port,
                         Hashtable env)
Get ORB using given server and port number, and properties from environment.

Parameters:
server - Possibly null server; if null means use default; For applet, it is the applet host; for app, it is localhost.
port - Port number, -1 means default port
env - Possibly null environment. Contains environment properties. Could contain ORB itself; or applet used for initializing ORB. Use all String properties from env for initializing ORB
Returns:
A non-null ORB.

aicas logo Jamaica 3.4 release 8

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2009 aicas GmbH. All Rights Reserved.