| | |
| | | try |
| | | { |
| | | type = AttributeTypeSyntax.decodeAttributeType(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | oc = ObjectClassSyntax.decodeObjectClass(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | NameForm nf; |
| | | try |
| | | { |
| | | nf = NameFormSyntax.decodeNameForm(v.getValue(), newSchema); |
| | | nf = NameFormSyntax.decodeNameForm(v.getValue(), newSchema, |
| | | false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | dcr = DITContentRuleSyntax.decodeDITContentRule(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | mru = MatchingRuleUseSyntax.decodeMatchingRuleUse(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | type = AttributeTypeSyntax.decodeAttributeType(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | oc = ObjectClassSyntax.decodeObjectClass(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | NameForm nf; |
| | | try |
| | | { |
| | | nf = NameFormSyntax.decodeNameForm(v.getValue(), newSchema); |
| | | nf = NameFormSyntax.decodeNameForm(v.getValue(), newSchema, |
| | | false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | dcr = DITContentRuleSyntax.decodeDITContentRule(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | try |
| | | { |
| | | mru = MatchingRuleUseSyntax.decodeMatchingRuleUse(v.getValue(), |
| | | newSchema); |
| | | newSchema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | |
| | | |
| | | // Make sure that the new attribute type doesn't reference an undefined |
| | | // superior attribute type. |
| | | // or OBSOLETE superior attribute type. |
| | | AttributeType superiorType = attributeType.getSuperiorType(); |
| | | if (superiorType != null) |
| | | { |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (superiorType.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_OBSOLETE_SUPERIOR_ATTRIBUTE_TYPE; |
| | | String message = getMessage(msgID, attributeType.getNameOrOID(), |
| | | superiorType.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | |
| | | // Make sure that none of the associated matching rules are marked OBSOLETE. |
| | | MatchingRule mr = attributeType.getEqualityMatchingRule(); |
| | | if ((mr != null) && mr.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_ATTRTYPE_OBSOLETE_MR; |
| | | String message = getMessage(msgID, attributeType.getNameOrOID(), |
| | | mr.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | |
| | | mr = attributeType.getOrderingMatchingRule(); |
| | | if ((mr != null) && mr.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_ATTRTYPE_OBSOLETE_MR; |
| | | String message = getMessage(msgID, attributeType.getNameOrOID(), |
| | | mr.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | |
| | | mr = attributeType.getSubstringMatchingRule(); |
| | | if ((mr != null) && mr.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_ATTRTYPE_OBSOLETE_MR; |
| | | String message = getMessage(msgID, attributeType.getNameOrOID(), |
| | | mr.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | |
| | | mr = attributeType.getApproximateMatchingRule(); |
| | | if ((mr != null) && mr.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_ATTRTYPE_OBSOLETE_MR; |
| | | String message = getMessage(msgID, attributeType.getNameOrOID(), |
| | | mr.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | |
| | | |
| | |
| | | AttributeType at; |
| | | try |
| | | { |
| | | at = AttributeTypeSyntax.decodeAttributeType(v.getValue(), schema); |
| | | at = AttributeTypeSyntax.decodeAttributeType(v.getValue(), schema, |
| | | false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | |
| | | |
| | | // Make sure that the new objectclass doesn't reference an undefined |
| | | // superior class, or an undefined required or optional attribute type. |
| | | // superior class, or an undefined required or optional attribute type, |
| | | // and that none of them are OBSOLETE. |
| | | ObjectClass superiorClass = objectClass.getSuperiorClass(); |
| | | if (superiorClass != null) |
| | | { |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (superiorClass.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_OBSOLETE_SUPERIOR_OBJECTCLASS; |
| | | String message = getMessage(msgID, objectClass.getNameOrOID(), |
| | | superiorClass.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | for (AttributeType at : objectClass.getRequiredAttributes()) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_OC_OBSOLETE_REQUIRED_ATTR; |
| | | String message = getMessage(msgID, objectClass.getNameOrOID(), |
| | | at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | for (AttributeType at : objectClass.getOptionalAttributes()) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_OC_OBSOLETE_OPTIONAL_ATTR; |
| | | String message = getMessage(msgID, objectClass.getNameOrOID(), |
| | | at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | ObjectClass oc; |
| | | try |
| | | { |
| | | oc = ObjectClassSyntax.decodeObjectClass(v.getValue(), schema); |
| | | oc = ObjectClassSyntax.decodeObjectClass(v.getValue(), schema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | |
| | | |
| | | // Make sure that the new name form doesn't reference an undefined |
| | | // structural class, or an undefined required or optional attribute type. |
| | | // structural class, or an undefined required or optional attribute type, or |
| | | // that any of them are marked OBSOLETE. |
| | | ObjectClass structuralClass = nameForm.getStructuralClass(); |
| | | if (! schema.hasObjectClass(structuralClass.getOID())) |
| | | { |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | if (structuralClass.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_NF_OC_OBSOLETE; |
| | | String message = getMessage(msgID, nameForm.getNameOrOID(), |
| | | structuralClass.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | |
| | | NameForm existingNFForClass = schema.getNameForm(structuralClass); |
| | | if ((existingNFForClass != null) && (existingNFForClass != existingNF)) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_NF_OBSOLETE_REQUIRED_ATTR; |
| | | String message = getMessage(msgID, nameForm.getNameOrOID(), |
| | | at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | for (AttributeType at : nameForm.getOptionalAttributes()) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_NF_OBSOLETE_OPTIONAL_ATTR; |
| | | String message = getMessage(msgID, nameForm.getNameOrOID(), |
| | | at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | NameForm nf; |
| | | try |
| | | { |
| | | nf = NameFormSyntax.decodeNameForm(v.getValue(), schema); |
| | | nf = NameFormSyntax.decodeNameForm(v.getValue(), schema, false); |
| | | } |
| | | catch (DirectoryException de) |
| | | { |
| | |
| | | msgID); |
| | | } |
| | | |
| | | if (structuralClass.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DCR_STRUCTURAL_OC_OBSOLETE; |
| | | String message = getMessage(msgID, ditContentRule.getName(), |
| | | structuralClass.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | |
| | | for (ObjectClass oc : ditContentRule.getAuxiliaryClasses()) |
| | | { |
| | | if (! schema.hasObjectClass(oc.getOID())) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | if (oc.getObjectClassType() != ObjectClassType.AUXILIARY) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DCR_OC_NOT_AUXILIARY; |
| | | String message = getMessage(msgID, ditContentRule.getName(), |
| | | oc.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | if (oc.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DCR_OBSOLETE_AUXILIARY_OC; |
| | | String message = getMessage(msgID, ditContentRule.getName(), |
| | | oc.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | for (AttributeType at : ditContentRule.getRequiredAttributes()) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DCR_OBSOLETE_REQUIRED_ATTR; |
| | | String message = getMessage(msgID, ditContentRule.getName(), |
| | | at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | for (AttributeType at : ditContentRule.getOptionalAttributes()) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DCR_OBSOLETE_OPTIONAL_ATTR; |
| | | String message = getMessage(msgID, ditContentRule.getName(), |
| | | at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | for (AttributeType at : ditContentRule.getProhibitedAttributes()) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DCR_OBSOLETE_PROHIBITED_ATTR; |
| | | String message = getMessage(msgID, ditContentRule.getName(), |
| | | at.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | if (nameForm.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DSR_OBSOLETE_NAME_FORM; |
| | | String message = getMessage(msgID, ditStructureRule.getNameOrRuleID(), |
| | | nameForm.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | |
| | | |
| | | // If there are any superior rules, then make sure none of them are marked |
| | | // OBSOLETE. |
| | | for (DITStructureRule dsr : ditStructureRule.getSuperiorRules()) |
| | | { |
| | | if (dsr.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_DSR_OBSOLETE_SUPERIOR_RULE; |
| | | String message = getMessage(msgID, ditStructureRule.getNameOrRuleID(), |
| | | dsr.getNameOrRuleID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | |
| | | // If there is no existing rule, then we're adding a new DIT structure rule. |
| | |
| | | msgID); |
| | | } |
| | | |
| | | if (matchingRule.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_MRU_OBSOLETE_MR; |
| | | String message = getMessage(msgID, matchingRuleUse.getName(), |
| | | matchingRule.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | |
| | | |
| | | // Make sure that the new matching rule use doesn't reference an undefined |
| | | // attribute type. |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message, |
| | | msgID); |
| | | } |
| | | else if (at.isObsolete()) |
| | | { |
| | | int msgID = MSGID_SCHEMA_MODIFY_MRU_OBSOLETE_ATTR; |
| | | String message = getMessage(msgID, matchingRuleUse.getName(), |
| | | matchingRule.getNameOrOID()); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message, |
| | | msgID); |
| | | } |
| | | } |
| | | |
| | | |