com.sun.jndi.ldap.obj
Class CorbaToAttrs

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

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

A DirStateFactory that returns an Attributes when given a omg.org.CORBA.Object. The form of getStateToBind() that does not accept an Attributes parameter always return null because this factory needs to return Attributes. The caller should always use the form of getStateToBind() 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, corbaObjectReference 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
CorbaToAttrs()
           
 
Method Summary
(package private) static javax.naming.directory.Attributes corbaToAttrs(org.omg.CORBA.portable.ObjectImpl orig, javax.naming.directory.Attributes inAttrs)
          Returns attributes required for storing a CORBA object.
 java.lang.Object getStateToBind(java.lang.Object orig, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable env)
          Always return 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 attributes required for storing a CORBA object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CorbaToAttrs

public CorbaToAttrs()
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 attributes required for storing a CORBA object. Get the IOR from orig and use it for the "corbaIor" attribute. Add "corbaObject" to "objectclass" attribute. If there are no other objectclass attribute values, the entry needs a structural objectclass: add "corbaContainer" as an additional objectclass.

Specified by:
getStateToBind in interface javax.naming.spi.DirStateFactory
Parameters:
orig - The CORBA object to bind. If not an instance of org.omg.CORBA.portable.ObjectImpl, return null.
name - Ignored
ctx - Ignored
env - Ignored
inAttrs - A possibly null set of attributes that will accompany this bind. These attributes are combined with those required for storing orig.
Returns:
{null, attrs} where attrs is the union of inAttrs and attributes that represent the CORBA object orig. null if orig is not an instance of ObjectImpl.
Throws:
javax.naming.NamingException - Not thrown.

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 return null.

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

corbaToAttrs

static javax.naming.directory.Attributes corbaToAttrs(org.omg.CORBA.portable.ObjectImpl orig,
                                                      javax.naming.directory.Attributes inAttrs)
Returns attributes required for storing a CORBA object. Get the IOR from orig and use it for the "corbaIor" attribute. Add "corbaObject" to "objectclass" attribute. If there are no other objectclass attribute values, the entry needs a structural objectclass: add "corbaContainer" as an additional objectclass.

Parameters:
orig - The non-null ObjectImpl from which to get the IOR
inAttrs - The possibly attribute set that is to be merged with the CORBA attributes.
Returns:
A non-null Attributes containing the incoming attribute merged with the CORBA attributes.