com.sun.jndi.ldap.obj
Class AttrsToCorba

java.lang.Object
  extended by com.sun.jndi.ldap.obj.AttrsToCorba
All Implemented Interfaces:
javax.naming.spi.DirObjectFactory, javax.naming.spi.ObjectFactory

public class AttrsToCorba
extends java.lang.Object
implements javax.naming.spi.DirObjectFactory

A DirObjectFactory that returns a omg.org.CORBA.Object when given attributes that contain the objectclass "corbaObject". The form of getObjectInstance() that does not accept an Attributes parameter always return null because using it would impose too much overhead (incurs an extra search each time). The caller should always use the form of getObjectInstance() that accepts an Attributes parameter. This is the case if the service provider uses DirectoryManager.

The LDAP schema for CORBA objects is:

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

Author:
Rosanna Lee

Field Summary
private static org.omg.CORBA.ORB defaultOrb
           
 
Constructor Summary
AttrsToCorba()
           
 
Method Summary
private static org.omg.CORBA.ORB getDefaultOrb(java.util.Hashtable env)
          Return default ORB.
 java.lang.Object getObjectInstance(java.lang.Object orig, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable env)
          Always returns null.
 java.lang.Object getObjectInstance(java.lang.Object orig, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable env, javax.naming.directory.Attributes attrs)
          Returns a CORBA object if attributes represents a "corbaObject".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultOrb

private static org.omg.CORBA.ORB defaultOrb
Constructor Detail

AttrsToCorba

public AttrsToCorba()
Method Detail

getObjectInstance

public java.lang.Object getObjectInstance(java.lang.Object orig,
                                          javax.naming.Name name,
                                          javax.naming.Context ctx,
                                          java.util.Hashtable env,
                                          javax.naming.directory.Attributes attrs)
                                   throws java.lang.Exception
Returns a CORBA object if attributes represents a "corbaObject".

If attrs's objectclass attribute has the value "corbaObject" or "corbaobject", this factory will use the directory entry's "corbaIor" attribute to get the stringified IOR, which is then converted into a CORBA object. The "corbaIor" attribute is obtained from attrs, and if not available from there, from the directory using the DirContext, orig.

Specified by:
getObjectInstance in interface javax.naming.spi.DirObjectFactory
Parameters:
orig - The non-null DirContext object representing the directory entry; If not a DirContext, return null.
name - Ignored
ctx - Ignored
env - The possibly null environment properties. The caller can pass the ORB to use (via the java.naming.corba.orb property) or pass properties like the applet and the org.omg.CORBA.* properties for creating the ORB. If none of these is available, a default (static) ORB is used.
attrs - The possibly null attributes containing at least the directory entry's objectclass attribute.
Returns:
The CORBA object represented by the directory entry; null if the entry does not represent a CORBA object.
Throws:
javax.naming.NamingException - If an error is encountered while getting the corbaIor attribute using orig.
java.lang.Exception - If an error occurred while converting the IOR to a CORBA object or using the ORB.

getObjectInstance

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

Specified by:
getObjectInstance in interface javax.naming.spi.ObjectFactory
Parameters:
orig - Ignored
name - Ignored
ctx - Ignored
env - Ignored
Returns:
null
Throws:
java.lang.Exception - Never thrown

getDefaultOrb

private static org.omg.CORBA.ORB getDefaultOrb(java.util.Hashtable env)
Return default ORB. The ORB is used for turning a stringified IOR into an Object.

Parameters:
env - The possibly null environment properties. The caller can pass the ORB to use (via the java.naming.corba.orb property) or pass properties like the applet and the org.omg.CORBA.* properties for creating the ORB.
Returns:
A non-null ORB.