throws ImportExportException
{
Enumeration enumeration;
String[] attrs;
MozillaProducer producer;
LDAPSchema schema;
int scope;
if ( getSearchDescriptor() == null )
throw new IllegalStateException( Messages.message( "dsml.searchDescriptorRequired" ) );
attrs = getSearchDescriptor().getReturnAttrs();
try {
scope = getSearchDescriptor().getScope();
switch ( scope ) {
case SearchDescriptor.Scope.OneLevel:
scope = LDAPv2.SCOPE_ONE;
break;
case SearchDescriptor.Scope.Base:
scope = LDAPv2.SCOPE_BASE;
break;
case SearchDescriptor.Scope.SubTree:
scope = LDAPv2.SCOPE_SUB;
break;
}
enumeration = _conn.search( getSearchDescriptor().getBaseDN(), scope,
getSearchDescriptor().getFilter(), attrs, false );
} catch ( LDAPException except ) {
// Object does not exist, was not removed, ignore.
// Anything else, we must complain.
if ( except.getLDAPResultCode() != LDAPException.NO_SUCH_OBJECT )
throw new ImportExportException( except );
enumeration = null;
}
try {
producer = new MozillaProducer( docHandler, false );
producer.startDocument();
if ( serverSchema ) {
schema = new LDAPSchema();
schema.fetchSchema( _conn );
producer.produce( schema );
}
if ( enumeration != null )
producer.produce( enumeration );
if ( importPolicy && getImportDescriptor() != null )