/** * Build the ObjectClasses references */ private void buildObjectClassReferences() { // Remember the OC we have already processed Set<String> done = new HashSet<>(); // The ObjectClass for ( ObjectClass objectClass : objectClassRegistry ) { if ( done.contains( objectClass.getOid() ) ) { continue; } else { done.add( objectClass.getOid() ); } buildReference( objectClass ); } }
/** * Build the ObjectClasses references */ private void buildObjectClassReferences() { // Remember the OC we have already processed Set<String> done = new HashSet<>(); // The ObjectClass for ( ObjectClass objectClass : objectClassRegistry ) { if ( done.contains( objectClass.getOid() ) ) { continue; } else { done.add( objectClass.getOid() ); } buildReference( objectClass ); } }
/** * Build the ObjectClasses references */ private void buildObjectClassReferences() { // Remember the OC we have already processed Set<String> done = new HashSet<>(); // The ObjectClass for ( ObjectClass objectClass : objectClassRegistry ) { if ( done.contains( objectClass.getOid() ) ) { continue; } else { done.add( objectClass.getOid() ); } buildReference( objectClass ); } }
/** * Add an Auxiliary ObjectClass * * @param objectClass The ObjectClass */ public void addAuxObjectClasses( ObjectClass objectClass ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } if ( !auxObjectClassOids.contains( objectClass.getOid() ) ) { auxObjectClasses.add( objectClass ); auxObjectClassOids.add( objectClass.getOid() ); } }
/** * Add an Auxiliary ObjectClass * * @param objectClass The ObjectClass */ public void addAuxObjectClasses( ObjectClass objectClass ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } if ( !auxObjectClassOids.contains( objectClass.getOid() ) ) { auxObjectClasses.add( objectClass ); auxObjectClassOids.add( objectClass.getOid() ); } }
/** * Add an Auxiliary ObjectClass * * @param objectClass The ObjectClass */ public void addAuxObjectClasses( ObjectClass objectClass ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } if ( !auxObjectClassOids.contains( objectClass.getOid() ) ) { auxObjectClasses.add( objectClass ); auxObjectClassOids.add( objectClass.getOid() ); } }
/** * @param auxObjectClasses the auxObjectClasses to set */ public void setAuxObjectClasses( List<ObjectClass> auxObjectClasses ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.auxObjectClasses = auxObjectClasses; // update the OIDS now auxObjectClassOids.clear(); for ( ObjectClass oc : auxObjectClasses ) { auxObjectClassOids.add( oc.getOid() ); } }
/** * @param auxObjectClasses the auxObjectClasses to set */ public void setAuxObjectClasses( List<ObjectClass> auxObjectClasses ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.auxObjectClasses = auxObjectClasses; // update the OIDS now auxObjectClassOids.clear(); for ( ObjectClass oc : auxObjectClasses ) { auxObjectClassOids.add( oc.getOid() ); } }
/** * Sets the structural object class this rule applies to * * @param structuralObjectClass the structural object class to set */ public void setStructuralObjectClass( ObjectClass structuralObjectClass ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.structuralObjectClass = structuralObjectClass; this.structuralObjectClassOid = structuralObjectClass.getOid(); }
/** * @param auxObjectClasses the auxObjectClasses to set */ public void setAuxObjectClasses( List<ObjectClass> auxObjectClasses ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.auxObjectClasses = auxObjectClasses; // update the OIDS now auxObjectClassOids.clear(); for ( ObjectClass oc : auxObjectClasses ) { auxObjectClassOids.add( oc.getOid() ); } }
/** * Sets the structural object class this rule applies to * * @param structuralObjectClass the structural object class to set */ public void setStructuralObjectClass( ObjectClass structuralObjectClass ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.structuralObjectClass = structuralObjectClass; this.structuralObjectClassOid = structuralObjectClass.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 ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.superiors.clear(); this.superiors.addAll( superiors ); // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.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 ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.superiors.clear(); this.superiors.addAll( superiors ); // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.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 ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.superiors.clear(); this.superiors.addAll( superiors ); // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.getOid() ); } }
/** * 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_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.superiors = superiors; // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.getOid() ); } }
/** * Sets the structural object class this rule applies to * * @param structuralObjectClass the structural object class to set */ public void setStructuralObjectClass( ObjectClass structuralObjectClass ) { if ( locked ) { throw new UnsupportedOperationException( I18n.err( I18n.ERR_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.structuralObjectClass = structuralObjectClass; this.structuralObjectClassOid = structuralObjectClass.getOid(); }
/** * 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_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.superiors = superiors; // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.getOid() ); } }
/** * 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_13700_CANNOT_MODIFY_LOCKED_SCHEMA_OBJECT, getName() ) ); } this.superiors = superiors; // update the OIDS now superiorOids.clear(); for ( ObjectClass oc : superiors ) { superiorOids.add( oc.getOid() ); } }
private void resolve( ObjectClass objectClass ) { // 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<>(); // 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 ); // 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. LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY_AND_MUST ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setOtherObject( may ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException ); } } } }
public RegistrySynchronizerAdaptor( SchemaManager schemaManager ) throws Exception { this.schemaManager = schemaManager; this.schemaSynchronizer = new SchemaSynchronizer( schemaManager ); this.objectClassAT = schemaManager.lookupAttributeTypeRegistry( SchemaConstants.OBJECT_CLASS_AT ); this.registrySynchronizers[COMPARATOR_INDEX] = new ComparatorSynchronizer( schemaManager ); this.registrySynchronizers[NORMALIZER_INDEX] = new NormalizerSynchronizer( schemaManager ); this.registrySynchronizers[SYNTAX_CHECKER_INDEX] = new SyntaxCheckerSynchronizer( schemaManager ); this.registrySynchronizers[SYNTAX_INDEX] = new SyntaxSynchronizer( schemaManager ); this.registrySynchronizers[MATCHING_RULE_INDEX] = new MatchingRuleSynchronizer( schemaManager ); this.registrySynchronizers[ATTRIBUTE_TYPE_INDEX] = new AttributeTypeSynchronizer( schemaManager ); this.registrySynchronizers[OBJECT_CLASS_INDEX] = new ObjectClassSynchronizer( schemaManager ); this.registrySynchronizers[MATCHING_RULE_USE_INDEX] = new MatchingRuleUseSynchronizer( schemaManager ); this.registrySynchronizers[DIT_STRUCTURE_RULE_INDEX] = new DitStructureRuleSynchronizer( schemaManager ); this.registrySynchronizers[DIT_CONTENT_RULE_INDEX] = new DitContentRuleSynchronizer( schemaManager ); this.registrySynchronizers[NAME_FORM_INDEX] = new NameFormSynchronizer( schemaManager ); ObjectClassRegistry ocReg = schemaManager.getObjectClassRegistry(); for ( int ii = 0; ii < META_OBJECT_CLASSES.length; ii++ ) { ObjectClass oc = ocReg.lookup( META_OBJECT_CLASSES[ii] ); objectClass2synchronizerMap.put( oc.getOid(), registrySynchronizers[ii] ); } }