directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kiran Ayyagari <ayyagariki...@gmail.com>
Subject Re: Adding an objectClass to an Entry
Date Tue, 13 Apr 2010 20:22:50 GMT
hi Andrew,

On Tue, Apr 13, 2010 at 11:10 PM, Andrew Wiley <debio264@gmail.com> wrote:
> I'm trying to figure out how to add an objectClass to an entry in the
> directory, but I seem to be misunderstanding how modifications should work.
> I'm trying something like this:
> AttributeType attr = new AttributeType("objectClass");
> Modification mod = new
> ServerModification(ModificationOperation.ADD_ATTRIBUTE, new
> DefaultServerAttribute(attr, "javaObject"));
the attributeType in ApacheDS is not created manually rather obtained
through a lookup operation on
SchemaManager like
dirService.getSchemaManager().lookupAttributeTypeRegistry(
"objectClass" )

having said that, you can create a modification in a rather easy way
by using ClientModification and DefaultClientAttribute classes as
shown below

        EntryAttribute attribute = new DefaultClientAttribute(
"objectClass", "javaObject" );
        ClientModification cm = new ClientModification(
ModificationOperation.ADD_ATTRIBUTE, attribute );

HTH

Kiran Ayyagari

Mime
View raw message