H.C. Lin wrote:
Hello Rich,

Thank you again for your support.

With your direction, I have found the code sample in extracting LDAPSchema
out of an LDAPConnection. From the LDAPSchema, extract LDAPObjectClassSchema
then add a new LDAPAttributeSchema to the LDAPSchema.

However, when I tried out this sample to the Aphelion Directory Server that
I worked on it failed at the fetchSchema method. Returned exception message
is "No such object".

         LDAPConnection ldapConn = new LDAPConnection();
         // Construct a new LDAPSchema object to get the schema.
         LDAPSchema dirSchema = new LDAPSchema();
         try {
             // Connect to the server.
             ldapConn.connect(LDAP_HOST, LDAP_PORT);
             // Get the schema from the directory.
             dirSchema.fetchSchema(ldapConn);
             // Get and print the inetOrgPerson object class description.
             LDAPObjectClassSchema objClass =
dirSchema.getObjectClass("inetOrgPerson");
             if (objClass != null) {
                 System.out.println("inetOrgPerson := " +
objClass.toString());
             }
             // Get and print the definition of the userPassword attribute.
             LDAPAttributeSchema attrType =
dirSchema.getAttribute("userpassword");
             if (attrType != null) {
                 System.out.println("userPassword := " +
attrType.toString());
             }

Does this means the Aphelion Directory Server does not support extracting
schema over LDAP protocol?

I suppose so. I don't know anything about Aphelion Directory Server.


"Rich Megginson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]

H.C. Lin wrote:

Dear group,

Does any one knows how to add a new attribute to an object?

I tried to add a new attribute called status for person attribute using

the

instruction in the SDK but failed. I guess this is due to I have not
extended the schema for person object.

What error code/message did you get?

Yes, you have to extend the schema if you want to add a new attribute
that is not already in the schema of the object.  There are two usual
ways to do this and one non-suggested way.

1) Create a new structural objectclass that extends one of the
objectclasses already used by the object.  Create your new attribute.
Add your new attribute to your new objectclass.  Add your new
objectclass to the object instead of the one that it extends.
2) Create a new auxiliary objectclass.  Create your new attribute.  Add
your attribute to the new objectclass.  Add your new objectclass to the
object _in addition to_ the other objectclasses already present.
3) Add the objectclass "extensibleObject" to your object.  This
essentially turns off schema checking for the object.  I don't recommend
doing this in production, but it can be useful for application testing.



I wonder if I reason the cause of my problem correctly? Perhaps some one
could point me to the right way.


Your reply is much appreciated.

HC Ramins Lin





_______________________________________________
mozilla-directory mailing list
mozilla-directory@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-directory

Reply via email to