com.sun.jndi.ldap.obj
Class RemoteToCorbaToAttrs

java.lang.Object
  extended by com.sun.jndi.ldap.obj.RemoteToCorbaToAttrs
All Implemented Interfaces:
javax.naming.spi.DirStateFactory, javax.naming.spi.StateFactory

public class RemoteToCorbaToAttrs
extends java.lang.Object
implements javax.naming.spi.DirStateFactory

An DirStateFactory that returns an Attributes when given an RMI-IIOP object. This factory requires CORBA classes and RMI-IIOP for getting the CORBA object of an Remote object.

Try to get the CORBA object for the Remote object (using RMI-IIOP), and turn that CORBA object into attributes. Return null if the Remote objectis a JRMP implementation or JRMP stub.

The LDAP schema for storing CORBA objects is:

objectClass: top, corbaObject, corbaContainer corbaIor: IOR of CORBA object

Author:
Rosanna Lee

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.naming.spi.DirStateFactory
javax.naming.spi.DirStateFactory.Result
 
Constructor Summary
RemoteToCorbaToAttrs()
           
 
Method Summary
private static org.omg.CORBA.ORB getDefaultOrb(java.util.Hashtable env)
          Return default ORB.
 java.lang.Object getStateToBind(java.lang.Object orig, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable env)
          Always returns null.
 javax.naming.spi.DirStateFactory.Result getStateToBind(java.lang.Object orig, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable env, javax.naming.directory.Attributes inAttrs)
          Returns the attributes required for storing a CORBA object.
(package private) static javax.naming.spi.DirStateFactory.Result remoteToCorbaToAttrs(java.rmi.Remote orig, java.util.Hashtable env, javax.naming.directory.Attributes inAttrs)
          Gets the connected IIOP stub for Remote object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteToCorbaToAttrs

public RemoteToCorbaToAttrs()
Method Detail

getStateToBind

public javax.naming.spi.DirStateFactory.Result getStateToBind(java.lang.Object orig,
                                                              javax.naming.Name name,
                                                              javax.naming.Context ctx,
                                                              java.util.Hashtable env,
                                                              javax.naming.directory.Attributes inAttrs)
                                                       throws javax.naming.NamingException
Returns the attributes required for storing a CORBA object. Uses the utility supplied by CorbaToAttrs.

Specified by:
getStateToBind in interface javax.naming.spi.DirStateFactory
Parameters:
orig - A non-null Remote object.
name - Ignored
ctx - Ignored
env - A possibly null environment. Used to get the ORB to use when getting the CORBA object for the Remote object using RMI-IIOP.
inAttrs - The possibly null attributes included with the bind.
Returns:
{null, attrs} where attrs is the union of inAttrs and attributes that represent the CORBA object (of) orig. null if orig cannot be turned into a ObjectImpl, or if RMI-IIOP is not available.
Throws:
javax.naming.ConfigurationException - If configuration problems encountered in getting orig's CORBA object, such as RMI-IIOP not available.
javax.naming.NamingException - If some other error occurred.

remoteToCorbaToAttrs

static javax.naming.spi.DirStateFactory.Result remoteToCorbaToAttrs(java.rmi.Remote orig,
                                                                    java.util.Hashtable env,
                                                                    javax.naming.directory.Attributes inAttrs)
                                                             throws java.lang.ClassNotFoundException,
                                                                    javax.naming.NamingException
Gets the connected IIOP stub for Remote object.

Throws:
java.lang.ClassNotFoundException
javax.naming.NamingException

getStateToBind

public java.lang.Object getStateToBind(java.lang.Object orig,
                                       javax.naming.Name name,
                                       javax.naming.Context ctx,
                                       java.util.Hashtable env)
                                throws javax.naming.NamingException
Always returns null.

Specified by:
getStateToBind in interface javax.naming.spi.StateFactory
Parameters:
orig - Ignored
name - Ignored
ctx - Ignored
env - Ignored
Returns:
null
Throws:
javax.naming.NamingException - Not thrown.

getDefaultOrb

private static org.omg.CORBA.ORB getDefaultOrb(java.util.Hashtable env)
Return default ORB. The ORB is used for getting the tie of a RMI-IIOP object. %%% The assumption is that any ORB will *NOT* do. That's why we can't maintain this as a static. If this assumption is false, save result in static to avoid calling it each time.

Parameters:
env - The possibly null environment properties to use when creating the default ORB.
Returns:
A non-null ORB.