public void produce( LDAPObjectClassSchema schema )
throws SAXException
{
AttributeListImpl attrList;
String superiors[];
String superior;
int i;
Enumeration enumeration;
leaveDirectory();
enterSchema();
attrList = new AttributeListImpl();
// dsml:class id
attrList.addAttribute( XML.Schema.Attributes.Id, "ID", schema.getName() );
// dsml:class superior
superiors = schema.getSuperiors();
superior = null;
for ( i = 0 ; i < superiors.length ; ++i ) {
if ( i == 0 )
superior = superiors[ i ];
else
superior = superior + "," + superiors[ i ];
}
if ( i > 0 )
attrList.addAttribute( XML.Schema.Attributes.Superior, "CDATA", superior );
// dsml:class obsolete
attrList.addAttribute( XML.Schema.Attributes.Obsolete, null,
schema.isObsolete() ? "true" : "false" );
// dsml:class type
switch ( schema.getType() ) {
case LDAPObjectClassSchema.STRUCTURAL:
attrList.addAttribute( XML.Schema.Attributes.Type, null,
XML.Schema.Attributes.Types.Structural );
break;
case LDAPObjectClassSchema.ABSTRACT:
attrList.addAttribute( XML.Schema.Attributes.Type, null,
XML.Schema.Attributes.Types.Abstract );
break;
case LDAPObjectClassSchema.AUXILIARY:
attrList.addAttribute( XML.Schema.Attributes.Type, null,
XML.Schema.Attributes.Types.Auxiliary );
break;
}
// dsml:class
_docHandler.startElement( prefix( XML.Schema.Elements.Class ), attrList );
// dsml:class name
if ( schema.getName() != null ) {
attrList = new AttributeListImpl();
_docHandler.startElement( prefix( XML.Schema.Elements.Name ), attrList );
_docHandler.characters( schema.getName().toCharArray(), 0,
schema.getName().length() );
_docHandler.endElement( prefix( XML.Schema.Elements.Name ) );
}
// dsml:class description
if ( schema.getDescription() != null ) {
attrList = new AttributeListImpl();
_docHandler.startElement( prefix( XML.Schema.Elements.Description ), attrList );
_docHandler.characters( schema.getDescription().toCharArray(), 0,
schema.getDescription().length() );
_docHandler.endElement( prefix( XML.Schema.Elements.Description ) );
}
// dsml:class object-identifier
if ( schema.getID() != null ) {
attrList = new AttributeListImpl();
_docHandler.startElement( prefix( XML.Schema.Elements.OID ), attrList );
_docHandler.characters( schema.getID().toCharArray(), 0,
schema.getID().length() );
_docHandler.endElement( prefix( XML.Schema.Elements.OID ) );
}
// dsml:class attribute required=false
enumeration = schema.getOptionalAttributes();
while ( enumeration.hasMoreElements() ) {
attrList = new AttributeListImpl();
attrList.addAttribute( XML.Schema.Attributes.Ref, "CDATA",
"#" + (String) enumeration.nextElement() );
attrList.addAttribute( XML.Schema.Attributes.Required, null, "false" );
_docHandler.startElement( prefix( XML.Schema.Elements.Attribute) , attrList );
_docHandler.endElement( prefix( XML.Schema.Elements.Attribute ) );
}
// dsml:class attribute required=true
enumeration = schema.getRequiredAttributes();
while ( enumeration.hasMoreElements() ) {
attrList = new AttributeListImpl();
attrList.addAttribute( XML.Schema.Attributes.Ref, "CDATA",
"#" + (String) enumeration.nextElement() );
attrList.addAttribute( XML.Schema.Attributes.Required, null, "true" );
_docHandler.startElement( prefix( XML.Schema.Elements.Attribute) , attrList );
_docHandler.endElement( prefix( XML.Schema.Elements.Attribute ) );
}
_docHandler.endElement( prefix( XML.Schema.Elements.Class ) );