/** * @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; } }
/** * @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; } }
/** * Set the ObjectClass type, one of ABSTRACT, AUXILIARY or STRUCTURAL. * * @param objectClassType The ObjectClassType value */ public void setType( ObjectClassTypeEnum objectClassType ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.objectClassType = objectClassType; } }
/** * Sets the superior object class OIDs * * @param superiorOids the object class OIDs to set */ public void setSuperiorOids( List<String> superiorOids ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.superiorOids = superiorOids; } }
/** * Add some required AttributeType OIDs * * @param oid The attributeType OIDs */ public void addMustAttributeTypeOids( String... oids ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { for ( String oid : oids ) { mustAttributeTypeOids.add( oid ); } } }
/** * Add some allowed AttributeType * * @param oids The attributeType oids */ public void addMayAttributeTypeOids( String... oids ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { for ( String oid : oids ) { mayAttributeTypeOids.add( oid ); } } }
/** * Add some superior ObjectClass OIDs * * @param oids The superior ObjectClass OIDs */ public void addSuperiorOids( String... oids ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { for ( String oid : oids ) { if ( !superiorOids.contains( oid ) ) { superiorOids.add( oid ); } } } }
/** * Sets the superior object classes * * @param superiors the object classes to set */ public void setSuperiors( List<ObjectClass> superiors ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.superiors = superiors; // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.getOid() ); } } }
/** * Sets the list of allowed AttributeTypes * * @param mayAttributeTypes the list of allowed AttributeTypes */ public void setMayAttributeTypes( List<AttributeType> mayAttributeTypes ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.mayAttributeTypes = mayAttributeTypes; // update the OIDS now mayAttributeTypeOids.clear(); for ( AttributeType may : mayAttributeTypes ) { mayAttributeTypeOids.add( may.getOid() ); } } }
/** * Sets the list of required AttributeTypes * * @param mustAttributeTypes the list of required AttributeTypes */ public void setMustAttributeTypes( List<AttributeType> mustAttributeTypes ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { this.mustAttributeTypes = mustAttributeTypes; // update the OIDS now mustAttributeTypeOids.clear(); for ( AttributeType may : mustAttributeTypes ) { mustAttributeTypeOids.add( may.getOid() ); } } }
/** * Add some allowed AttributeTypes * * @param attributeTypes The attributeTypes */ public void addMayAttributeTypes( AttributeType... attributeTypes ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { for ( AttributeType attributeType : attributeTypes ) { if ( !mayAttributeTypeOids.contains( attributeType.getOid() ) ) { mayAttributeTypes.add( attributeType ); mayAttributeTypeOids.add( attributeType.getOid() ); } } } }
/** * Add some required AttributeTypes * * @param attributeTypes The attributeTypse */ public void addMustAttributeTypes( AttributeType... attributeTypes ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { for ( AttributeType attributeType : attributeTypes ) { if ( !mustAttributeTypeOids.contains( attributeType.getOid() ) ) { mustAttributeTypes.add( attributeType ); mustAttributeTypeOids.add( attributeType.getOid() ); } } } }
/** * Add some superior ObjectClasses * * @param objectClasses The superior ObjectClasses */ public void addSuperior( ObjectClass... objectClasses ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) ); } if ( !isReadOnly ) { for ( ObjectClass objectClass : objectClasses ) { if ( !superiorOids.contains( objectClass.getOid() ) ) { superiorOids.add( objectClass.getOid() ); superiors.add( 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 ); } }
/** * Compute all ObjectClasses superiors, MAY and MUST attributes. * @throws NamingException */ private void computeSuperiors() throws NamingException { Iterator objectClasses = globalRegistries.getObjectClassRegistry().list(); superiors = new HashMap(); allMust = new HashMap(); allMay = new HashMap(); allowed = new HashMap(); while ( objectClasses.hasNext() ) { List ocSuperiors = new ArrayList(); ObjectClass objectClass = (ObjectClass)objectClasses.next(); superiors.put( objectClass.getOid(), ocSuperiors ); computeOCSuperiors( objectClass, ocSuperiors, new HashSet() ); Set atSeen = new HashSet(); computeMustAttributes( objectClass, atSeen ); computeMayAttributes( objectClass, atSeen ); superiors.put( objectClass.getName(), ocSuperiors ); } }
if ( "top".equals( parent.getName() ) )
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 filterObjectClass( Attributes entry ) throws NamingException { List objectClasses = new ArrayList(); Attribute oc = entry.get( "objectClass" ); if ( oc != null ) { getObjectClasses( oc, objectClasses ); entry.remove( "objectClass" ); Attribute newOc = new LockableAttributeImpl( "objectClass" ); for ( int i = 0; i < objectClasses.size(); i++ ) { Object currentOC = objectClasses.get(i); if ( currentOC instanceof String ) { newOc.add( currentOC ); } else { newOc.add( ( (ObjectClass)currentOC ).getName() ); } } newOc.add( "top" ); entry.put( newOc ); } }
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 ); }