buf.append( objectClass.getOid() ); buf.append( '\n' ); if ( ( objectClass.getNames() != null ) && ( objectClass.getNames().size() != 0 ) ) getQDescrs( buf, objectClass.getNames() ); if ( objectClass.getDescription() != null ) buf.append( objectClass.getDescription() ); buf.append( '\n' ); if ( objectClass.isObsolete() ) List<ObjectClass> sups = objectClass.getSuperiors(); if ( objectClass.getType() != null ) buf.append( objectClass.getType() ); buf.append( '\n' ); List<AttributeType> must = objectClass.getMustAttributeTypes(); List<AttributeType> may = objectClass.getMayAttributeTypes(); if ( objectClass.getExtensions() != null ) getExtensions( buf, objectClass.getExtensions() );
ObjectClass copy = new ObjectClass( oid ); copy.copy( this );
if ( oc0.getType() != oc1.getType() ) if ( oc0.getSuperiorOids().size() != oc1.getSuperiorOids().size() ) for ( int i = 0; i < oc0.getSuperiorOids().size(); i++ ) if ( ! oc0.getSuperiorOids().get( i ).equals( oc1.getSuperiorOids().get( i ) ) ) for ( int i = 0; i < oc0.getMustAttributeTypeOids().size(); i++ ) if ( ! oc0.getMustAttributeTypeOids().get( i ).equals( oc1.getMustAttributeTypeOids().get( i ) ) ) for ( int i = 0; i < oc0.getMayAttributeTypeOids().size(); i++ ) if ( ! oc0.getMayAttributeTypeOids().get( i ).equals( oc1.getMayAttributeTypeOids().get( i ) ) )
public void register( String schema, ObjectClass objectClass ) throws NamingException { if ( byOid.containsKey( objectClass.getOid() ) ) { NamingException e = new NamingException( "objectClass w/ OID " + objectClass.getOid() + " has already been registered!" ); monitor.registerFailed( objectClass, e ); throw e; } oidRegistry.register( objectClass.getName(), objectClass.getOid() ); byOid.put( objectClass.getOid(), objectClass ); oidToSchema.put( objectClass.getOid(), schema ); monitor.registered( objectClass ); }
private void getSuperiors( ObjectClass oc, Set ocSeen, List result ) throws NamingException { ObjectClass[] superiors = oc.getSuperClasses(); for ( int i = 0; i < superiors.length; i++ ) { ObjectClass parent = superiors[i]; // Skip 'top' if ( "top".equals( parent.getName() ) ) { continue; } if ( !ocSeen.contains( parent.getOid() ) ) { ocSeen.add( parent.getOid() ); result.add( parent ); } // Recurse on the parent getSuperiors( parent, ocSeen, result ); } }
buf.append( "( " ).append( oc.getOid() ); List<String> names = oc.getNames(); if ( oc.getDescription() != null ) renderQDString( buf, oc.getDescription() ); if ( oc.isObsolete() ) List<String> superiorOids = oc.getSuperiorOids(); if ( oc.getType() != null ) buf.append( " " ).append( oc.getType() ); List<String> must = oc.getMustAttributeTypeOids(); List<String> may = oc.getMayAttributeTypeOids(); buf.append( oc.getSchemaName() ); buf.append( "'" );
objectClass = new ObjectClass(numericoid(oid.getText())); et.track("NAME", name); objectClass.setNames(qdescrs(name.getText())); et.track("DESC", desc); objectClass.setDescription(qdstring(desc.getText())); et.track("OBSOLETE", obsolete); objectClass.setObsolete( true ); et.track("SUP", sup); objectClass.setSuperiorOids(oids(sup.getText())); et.track("KIND", kind1); objectClass.setType( ObjectClassTypeEnum.ABSTRACT ); break; et.track("KIND", kind2); objectClass.setType( ObjectClassTypeEnum.STRUCTURAL ); break; et.track("KIND", kind3); objectClass.setType( ObjectClassTypeEnum.AUXILIARY ); break; et.track("MUST", must); objectClass.setMustAttributeTypeOids(oids(must.getText())); et.track("MAY", may); objectClass.setMayAttributeTypeOids(oids(may.getText())); objectClass.addExtension(ex.key, ex.values);
private void resolveRecursive( ObjectClass objectClass, Set<String> processed, List<Throwable> errors ) List<String> superiorOids = objectClass.getSuperiorOids(); ObjectClass superior = null; if ( !processed.contains( superior.getOid() ) ) processed.add( objectClass.getOid() ); Throwable error = new LdapProtocolErrorException( I18n.err( I18n.ERR_04300, objectClass.getOid(), superior) ); errors.add( error ); return; for ( String mayOid : objectClass.getMayAttributeTypeOids() ) for ( String mustOid : objectClass.getMustAttributeTypeOids() ) objectClass.addToRegistries( errors, this );
ObjectClass oc = new ObjectClass( oid ); oc.setSuperiorOids( getStrings( mSuperiors ) ); oc.setMayAttributeTypeOids( getStrings( mMay ) ); oc.setMustAttributeTypeOids( getStrings( mMust ) ); oc.setType( ObjectClassTypeEnum.getClassType( type ) );
/** * @param mustAttributeTypeOids the mustAttributeTypeOids to set */ public void setMustAttributeTypeOids( List<String> mustAttributeTypeOids ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.mustAttributeTypeOids = mustAttributeTypeOids; } }
if ( ocType.getType() == ObjectClassTypeEnum.STRUCTURAL )
if ( objectClass.getMayAttributeTypes() != null ) for ( AttributeType may : objectClass.getMayAttributeTypes() ) if ( objectClass.getMustAttributeTypes() != null ) for ( AttributeType must : objectClass.getMustAttributeTypes() ) if ( objectClass.getSuperiors() != null ) for ( ObjectClass superior : objectClass.getSuperiors() ) if ( !objectClassRegistry.contains( objectClass.getOid() ) )
/** * Update the associated SUPERIORS ObjectClasses, even if the SchemaObject is readOnly * * @param superiors the object classes to set */ public void updateSuperiors( List<ObjectClass> superiors ) { this.superiors.clear(); this.superiors.addAll( superiors ); // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.getOid() ); } }
Set<ObjectClass> descendants = oidToDescendants.get( ancestor.getOid() ); oidToDescendants.put( ancestor.getOid(), descendants ); registerDescendants( objectClass, ancestor.getSuperiors() );
List parents = (List)superiors.get( objectClass.getOid() ); List allowedList = (List)allowed.get( objectClass.getOid() ); allMay.put( objectClass.getOid(), mayList ); AttributeType[] mustParent = parent.getMustList();
private void resolve( ObjectClass objectClass, List<Throwable> errors ) { // This set is used to avoid having more than one error // for an ObjectClass. It's mandatory when processing // the Superiors, as they may be broken and referenced more than once. Set<String> processed = new HashSet<String>(); // Store the ObjectClass itself in the processed, to avoid cycle processed.add( objectClass.getOid() ); // Call the recursive method, as we may have superiors to deal with resolveRecursive( objectClass, processed, errors ); // Check that the MAY and MUST AT are consistent (no AT in MAY and in MUST // in one of its superior List<AttributeType> musts = getMustRecursive( new ArrayList<AttributeType>(), new HashSet<ObjectClass>(), objectClass ); if ( musts != null ) { for ( AttributeType may : objectClass.getMayAttributeTypes() ) { if ( musts.contains( may ) ) { // This is not allowed. Throwable error = new LdapProtocolErrorException( I18n.err( I18n.ERR_04299, objectClass.getOid() ) ); errors.add( error ); return; } } } }
public void register( String schema, ObjectClass dITContentRule ) throws NamingException { if ( byOid.containsKey( dITContentRule.getOid() ) || bootstrap.hasObjectClass( dITContentRule.getOid() ) ) { NamingException e = new NamingException( "dITContentRule w/ OID " + dITContentRule.getOid() + " has already been registered!" ); monitor.registerFailed( dITContentRule, e ); throw e; } oidRegistry.register( dITContentRule.getName(), dITContentRule.getOid() ); byOid.put( dITContentRule.getOid(), dITContentRule ); oidToSchema.put( dITContentRule.getOid(), schema ); monitor.registered( dITContentRule ); }
/** * @param mayAttributeTypeOids the mayAttributeTypeOids to set */ public void setMayAttributeTypeOids( List<String> mayAttributeTypeOids ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.mayAttributeTypeOids = mayAttributeTypeOids; } }
ObjectClass[] parents = objectClass.getSuperClasses(); if ( "top".equals( parent.getName() ) ) String oid = parents[i].getOid();