private void checkOidIsUniqueForComparator( String oid ) throws LdapSchemaViolationException { if ( schemaManager.getComparatorRegistry().contains( oid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_355, oid ) ); } }
protected void checkOidIsUnique( String oid ) throws LdapException { if ( schemaManager.getGlobalOidRegistry().contains( oid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_335, oid ) ); } }
private void checkOidIsUniqueForNormalizer( String oid ) throws LdapException { if ( schemaManager.getNormalizerRegistry().contains( oid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_369, oid ) ); } }
private void checkOidIsUniqueForSyntaxChecker( Entry entry ) throws LdapException { String oid = getOid( entry ); if ( schemaManager.getNormalizerRegistry().contains( oid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_390, oid ) ); } }
private void checkOidIsUniqueForComparator( Entry entry ) throws LdapException { String oid = getOid( entry ); if ( schemaManager.getComparatorRegistry().contains( oid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_355, oid ) ); } }
protected void checkOidIsUnique( SchemaObject schemaObject ) throws Exception { String oid = schemaObject.getOid(); if ( schemaManager.getGlobalOidRegistry().contains( oid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_335, oid ) ); } }
private void checkOidIsUniqueForNormalizer( Entry entry ) throws LdapException { String oid = getOid( entry ); if ( schemaManager.getNormalizerRegistry().contains( oid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_369, oid ) ); } }
throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_257_COLLECTIVE_SUBENTRY_WITHOUT_COLLECTIVE_AT ) ); "Cannot add the entry {} : it contains some CollectiveAttributes and is not a collective subentry", entry ); throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_241_CANNOT_STORE_COLLECTIVE_ATT_IN_ENTRY ) );
/** * Return the list of AdministrativeRole for a subentry */ private Set<AdministrativeRole> getSubentryAdminRoles( Entry subentry ) throws LdapException { Set<AdministrativeRole> adminRoles = new HashSet<>(); Attribute oc = subentry.get( directoryService.getAtProvider().getObjectClass() ); if ( oc == null ) { throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_305 ) ); } if ( oc.contains( SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) ) { adminRoles.add( AdministrativeRole.AccessControlInnerArea ); } if ( oc.contains( SchemaConstants.SUBSCHEMA_OC ) ) { adminRoles.add( AdministrativeRole.SubSchemaSpecificArea ); } if ( oc.contains( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) ) { adminRoles.add( AdministrativeRole.CollectiveAttributeSpecificArea ); } if ( oc.contains( ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC ) ) { adminRoles.add( AdministrativeRole.TriggerExecutionInnerArea ); } return adminRoles; }
/** * Check that a SchemaObject exists in the global OidRegsitry, and if so, * return it. * * @param entry The Entry we want to verify the existence of * @return The found SchemaObject * @throws LdapException If the check failed */ protected SchemaObject checkOidExists( Entry entry ) throws LdapException { String oid = getOid( entry ); if ( schemaManager.getGlobalOidRegistry().contains( oid ) ) { return schemaManager.getGlobalOidRegistry().getSchemaObject( oid ); } else { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_336, oid ) ); } }
/** * Check that a SyntaxChecker exists in the SyntaxCheckerRegistry, and if so, * return it. * * @param entry The entry to check * @return The found SyntaxChecker * @throws LdapException If the SyntaxChecker does not exist */ protected SyntaxChecker checkSyntaxCheckerOidExists( Entry entry ) throws LdapException { String oid = getOid( entry ); if ( schemaManager.getSyntaxCheckerRegistry().contains( oid ) ) { return schemaManager.getSyntaxCheckerRegistry().get( oid ); } else { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_336, oid ) ); } }
/** * Check that a Comparator exists in the ComparatorRegistry, and if so, * return it. * * @param entry the Entry we want to know it exists * @return The found comparator * @throws LdapException If teh comparator is not found */ protected LdapComparator<?> checkComparatorOidExists( Entry entry ) throws LdapException { String oid = getOid( entry ); if ( schemaManager.getComparatorRegistry().contains( oid ) ) { return schemaManager.getComparatorRegistry().get( oid ); } else { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_336, oid ) ); } }
/** * Check that we can modify an entry */ private void checkModify( ModifyOperationContext modifyContext ) throws LdapException { List<Modification> mods = modifyContext.getModItems(); Entry originalEntry = modifyContext.getEntry(); Entry targetEntry = SchemaUtils.getTargetEntry( mods, originalEntry ); // If the modified entry contains the CollectiveAttributeSubentry, then the modification // is accepted, no matter what if ( targetEntry.contains( directoryService.getAtProvider().getObjectClass(), SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRY_OC ) ) { return; } // Check that we don't add any collectve attribute, this is not allowed on normal entries if ( hasCollectiveAttributes( mods ) ) { /* * TODO: Replace the Exception and the ResultCodeEnum with the correct ones. */ LOG.info( "Cannot modify the entry {} : it contains some CollectiveAttributes and is not a collective subentry", targetEntry ); throw new LdapSchemaViolationException( ResultCodeEnum.OBJECT_CLASS_VIOLATION, I18n.err( I18n.ERR_242 ) ); } }
LdapSchemaViolationException error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, msg, ne ); errorHandler.handle( LOG, msg, error );
LdapSchemaViolationException error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, msg, ne ); errorHandler.handle( LOG, msg, error );
LdapSchemaViolationException error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, msg, ne ); errorHandler.handle( LOG, msg, error );
LdapSchemaViolationException error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( I18n.ERR_13220_NO_NORMALIZER, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error ); LdapSchemaViolationException error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( I18n.ERR_13413_MR_DOES_NOT_HAVE_A_COMP, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error );
LdapSchemaViolationException error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( I18n.ERR_13220_NO_NORMALIZER, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error ); LdapSchemaViolationException error = new LdapSchemaViolationException( ResultCodeEnum.INVALID_ATTRIBUTE_SYNTAX, I18n.err( I18n.ERR_13413_MR_DOES_NOT_HAVE_A_COMP, matchingRule.getOid() ) ); errorHandler.handle( LOG, error.getMessage(), error );
/** * {@inheritDoc} */ @Override public void rename( Entry entry, Rdn newRdn, boolean cascade ) throws LdapException { String oldOid = getOid( entry ); String schemaName = getSchemaName( entry.getDn() ); if ( schemaManager.getLdapSyntaxRegistry().contains( oldOid ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_389, oldOid ) ); } Entry targetEntry = entry.clone(); String newOid = newRdn.getValue(); if ( schemaManager.getSyntaxCheckerRegistry().contains( newOid ) ) { throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_390, newOid ) ); } targetEntry.put( MetaSchemaConstants.M_OID_AT, newOid ); if ( isSchemaEnabled( schemaName ) ) { SyntaxChecker syntaxChecker = factory.getSyntaxChecker( schemaManager, targetEntry, schemaManager .getRegistries(), schemaName ); schemaManager.unregisterSyntaxChecker( oldOid ); schemaManager.add( syntaxChecker ); } }
throw new LdapSchemaViolationException( ResultCodeEnum.OTHER, I18n.err( I18n.ERR_390, newOid ) );