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 ); } } } }
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MAY, msg ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException ); I18n.ERR_13770_CANNOT_REGISTER_DUPLICATE_AT_IN_MAY, objectClass.getOid(), mayAttributeTypeName ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY, msg ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_NONEXISTENT_MAY_AT, msg, ne ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException );
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, msg ); ldapSchemaException.setSourceObject( schemaObject ); throw ldapSchemaException; LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.NAME_ALREADY_REGISTERED, msg ); ldapSchemaException.setSourceObject( schemaObject ); throw ldapSchemaException;
/** * <pre> * ruleid ::= number * number ::= DIGIT | LDIGIT DIGIT+ * DIGIT ::= [0-9] * LDIGIT ::= [1-9] * </pre> * * @param pos The position in the Schema * @return The RuleID * @throws LdapSchemaException If the schema is wrong */ private static int getRuleId( PosSchema pos ) throws LdapSchemaException { int start = pos.start; while ( !isEmpty( pos ) && isDigit( pos ) ) { pos.start++; } if ( start == pos.start ) { // No ruleID throw new LdapSchemaException( I18n.err( I18n.ERR_13811_INVALID_RULE_ID, pos.lineNumber, pos.start ) ); } String lenStr = pos.line.substring( start, pos.start ); return Integer.parseInt( lenStr ); }
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ), ne ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ) ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException );
/** * {@inheritDoc} */ public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException { // Here, we have to inject the decoded filter into the SearchRequest SearchRequestDecorator searchRequestDecorator = container.getMessage(); SearchRequest searchRequest = searchRequestDecorator.getDecorated(); try { searchRequest.setFilter( searchRequestDecorator.getFilterNode() ); } catch ( LdapSchemaException lse ) { throw new DecoderException( lse.getMessage(), lse ); } // We can have an END transition container.setGrammarEndAllowed( true ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05158_INITIALIZE_ATT_DESC_LIST ) ); } } }
/** * <pre> * ruleid ::= number * number ::= DIGIT | LDIGIT DIGIT+ * DIGIT ::= [0-9] * LDIGIT ::= [1-9] * </pre> * * @param pos The position in the Schema * @return The RuleID * @throws LdapSchemaException If the schema is wrong */ private static int getRuleId( PosSchema pos ) throws LdapSchemaException { int start = pos.start; while ( !isEmpty( pos ) && isDigit( pos ) ) { pos.start++; } if ( start == pos.start ) { // No ruleID throw new LdapSchemaException( I18n.err( I18n.ERR_13811_INVALID_RULE_ID, pos.lineNumber, pos.start ) ); } String lenStr = pos.line.substring( start, pos.start ); return Integer.parseInt( lenStr ); }
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, msg ); ldapSchemaException.setSourceObject( schemaObject ); throw ldapSchemaException; LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.NAME_ALREADY_REGISTERED, msg ); ldapSchemaException.setSourceObject( schemaObject ); throw ldapSchemaException;
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ), ne ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ) ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException );
/** * {@inheritDoc} */ public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException { // Here, we have to inject the decoded filter into the SearchRequest SearchRequestDecorator searchRequestDecorator = container.getMessage(); SearchRequest searchRequest = searchRequestDecorator.getDecorated(); try { searchRequest.setFilter( searchRequestDecorator.getFilterNode() ); } catch ( LdapSchemaException lse ) { throw new DecoderException( lse.getMessage(), lse ); } // We can have an END transition container.setGrammarEndAllowed( true ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05158_INITIALIZE_ATT_DESC_LIST ) ); } } }
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MAY, msg ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException ); I18n.ERR_13770_CANNOT_REGISTER_DUPLICATE_AT_IN_MAY, objectClass.getOid(), mayAttributeTypeName ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY, msg ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_NONEXISTENT_MAY_AT, msg, ne ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException );
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 ); } } } }
/** * <pre> * ruleid ::= number * number ::= DIGIT | LDIGIT DIGIT+ * DIGIT ::= [0-9] * LDIGIT ::= [1-9] * </pre> * * @param pos The position in the Schema * @return The RuleID * @throws LdapSchemaException If the schema is wrong */ private static int getRuleId( PosSchema pos ) throws LdapSchemaException { int start = pos.start; while ( !isEmpty( pos ) && isDigit( pos ) ) { pos.start++; } if ( start == pos.start ) { // No ruleID throw new LdapSchemaException( I18n.err( I18n.ERR_13811_INVALID_RULE_ID, pos.lineNumber, pos.start ) ); } String lenStr = pos.line.substring( start, pos.start ); return Integer.parseInt( lenStr ); }
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, msg ); ldapSchemaException.setSourceObject( schemaObject ); throw ldapSchemaException; LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.NAME_ALREADY_REGISTERED, msg ); ldapSchemaException.setSourceObject( schemaObject ); throw ldapSchemaException;
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ), ne ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_13748_MATCHING_RULE_NO_SYNTAX, matchingRule.getOid() ) ); ldapSchemaException.setSourceObject( matchingRule ); errorHandler.handle( LOG, ldapSchemaException.getMessage(), ldapSchemaException );
/** * {@inheritDoc} */ public void action( LdapMessageContainer<SearchRequestDecorator> container ) throws DecoderException { // Here, we have to inject the decoded filter into the SearchRequest SearchRequestDecorator searchRequestDecorator = container.getMessage(); SearchRequest searchRequest = searchRequestDecorator.getDecorated(); try { searchRequest.setFilter( searchRequestDecorator.getFilterNode() ); } catch ( LdapSchemaException lse ) { throw new DecoderException( lse.getMessage(), lse ); } // We can have an END transition container.setGrammarEndAllowed( true ); if ( LOG.isDebugEnabled() ) { LOG.debug( I18n.msg( I18n.MSG_05158_INITIALIZE_ATT_DESC_LIST ) ); } } }
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_COLLECTIVE_NOT_ALLOWED_IN_MAY, msg ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException ); I18n.ERR_13770_CANNOT_REGISTER_DUPLICATE_AT_IN_MAY, objectClass.getOid(), mayAttributeTypeName ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_DUPLICATE_AT_IN_MAY, msg ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.OC_NONEXISTENT_MAY_AT, msg, ne ); ldapSchemaException.setSourceObject( objectClass ); ldapSchemaException.setRelatedId( mayAttributeTypeName ); errorHandler.handle( LOG, msg, ldapSchemaException );
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 ); } } } }
/** * Creates a new LessEqNode object. * * @param attribute the attribute name * @param value the value to test for * @throws LdapSchemaException If the AttributeType does not have an ORDERING MatchingRule */ public LessEqNode( String attribute, byte[] value ) throws LdapSchemaException { super( attribute, value, AssertionType.LESSEQ ); // Check if the AttributeType has an Ordering MR if ( ( attributeType != null ) && ( attributeType.getOrdering() == null ) ) { throw new LdapSchemaException( I18n.err( I18n.ERR_13301_NO_ORDERING_MR_FOR_AT, attributeType.getName() ) ); } }
LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.AT_MUST_HAVE_SAME_USAGE_THAN_SUPERIOR, msg ); ldapSchemaException.setSourceObject( attributeType ); errorHandler.handle( LOG, msg, ldapSchemaException ); LdapSchemaException ldapSchemaException = new LdapSchemaException( LdapSchemaExceptionCodes.AT_USER_APPLICATIONS_USAGE_MUST_BE_USER_MODIFIABLE, msg ); ldapSchemaException.setSourceObject( attributeType ); errorHandler.handle( LOG, msg, ldapSchemaException );