Hi guys,

while being in Portland, I saw a slide from Neil Willson where he shown something like a helper method to create entries using a LDIF format, but using multi-attributes instead of using a single string.

I have create such a static method in AttributeUtils. Instead of doing that in your code :

       Attributes attrs = new BasicAttributes( true );
       Attribute oc = new BasicAttribute( "objectClass", "top" );
       oc.add( "metaTop" );
       oc.add( "metaAttributeType" );
       attrs.put( oc );
       attrs.put( "m-oid", OID );
       attrs.put( "m-syntax", SchemaConstants.INTEGER_SYNTAX );
       attrs.put( "m-description", DESCRIPTION0 );
       attrs.put( "m-equality", "caseIgnoreMatch" );
       attrs.put( "m-singleValue", "FALSE" );
       attrs.put( "m-usage", "directoryOperation" );

do now :

       Attributes attrs = AttributeUtils.createAttributes(
           "objectClass: top",
           "objectClass: metaTop",
           "objectClass: metaAttributeType",
           "m-oid:" + OID,
           "m-syntax:" + SchemaConstants.INTEGER_SYNTAX,
           "m-description:" + DESCRIPTION0,
           "m-equality: caseIgnoreMatch",
           "m-singleValue: FALSE",
           "m-usage: directoryOperation" );

Way better ! And thanks Neil for the idea !

--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org


Reply via email to