hi Andrew,
On Tue, Apr 13, 2010 at 11:10 PM, Andrew Wiley <[email protected]> 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