Java Code Examples for org.apache.directory.api.ldap.model.message.ResultCodeEnum#UNWILLING_TO_PERFORM
The following examples show how to use
org.apache.directory.api.ldap.model.message.ResultCodeEnum#UNWILLING_TO_PERFORM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExceptionInterceptor.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException { Dn oldDn = moveAndRenameContext.getDn(); // Don't allow M&R in the SSSE if ( oldDn.equals( subschemSubentryDn ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258, subschemSubentryDn, subschemSubentryDn ) ); } // Remove the original entry from the NotAlias cache, if needed synchronized ( notAliasCache ) { if ( notAliasCache.containsKey( oldDn.getNormName() ) ) { notAliasCache.remove( oldDn.getNormName() ); } } next( moveAndRenameContext ); }
Example 2
Source File: ExceptionInterceptor.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void move( MoveOperationContext moveContext ) throws LdapException { Dn oriChildName = moveContext.getDn(); if ( oriChildName.equals( subschemSubentryDn ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258, subschemSubentryDn, subschemSubentryDn ) ); } next( moveContext ); // Remove the original entry from the NotAlias cache, if needed synchronized ( notAliasCache ) { if ( notAliasCache.containsKey( oriChildName.getNormName() ) ) { notAliasCache.remove( oriChildName.getNormName() ); } } }
Example 3
Source File: ExceptionInterceptor.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * Checks to make sure the entry being deleted exists, and has no children, otherwise throws the appropriate * LdapException. */ public void delete( DeleteOperationContext deleteContext ) throws LdapException { Dn dn = deleteContext.getDn(); if ( dn.equals( subschemSubentryDn ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_253, subschemSubentryDn ) ); } next( deleteContext ); // Update the alias cache synchronized ( notAliasCache ) { if ( notAliasCache.containsKey( dn.getNormName() ) ) { notAliasCache.remove( dn.getNormName() ); } } }
Example 4
Source File: ExceptionInterceptor.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void moveAndRename( MoveAndRenameOperationContext moveAndRenameContext ) throws LdapException { Dn oldDn = moveAndRenameContext.getDn(); // Don't allow M&R in the SSSE if ( oldDn.equals( subschemSubentryDn ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258, subschemSubentryDn, subschemSubentryDn ) ); } // Remove the original entry from the NotAlias cache, if needed synchronized ( notAliasCache ) { if ( notAliasCache.containsKey( oldDn.getNormName() ) ) { notAliasCache.remove( oldDn.getNormName() ); } } next( moveAndRenameContext ); }
Example 5
Source File: ExceptionInterceptor.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ public void move( MoveOperationContext moveContext ) throws LdapException { Dn oriChildName = moveContext.getDn(); if ( oriChildName.equals( subschemSubentryDn ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_258, subschemSubentryDn, subschemSubentryDn ) ); } next( moveContext ); // Remove the original entry from the NotAlias cache, if needed synchronized ( notAliasCache ) { if ( notAliasCache.containsKey( oriChildName.getNormName() ) ) { notAliasCache.remove( oriChildName.getNormName() ); } } }
Example 6
Source File: ExceptionInterceptor.java From MyVirtualDirectory with Apache License 2.0 | 6 votes |
/** * Checks to make sure the entry being deleted exists, and has no children, otherwise throws the appropriate * LdapException. */ public void delete( DeleteOperationContext deleteContext ) throws LdapException { Dn dn = deleteContext.getDn(); if ( dn.equals( subschemSubentryDn ) ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_253, subschemSubentryDn ) ); } next( deleteContext ); // Update the alias cache synchronized ( notAliasCache ) { if ( notAliasCache.containsKey( dn.getNormName() ) ) { notAliasCache.remove( dn.getNormName() ); } } }
Example 7
Source File: DefaultSchemaManager.java From directory-ldap-api with Apache License 2.0 | 6 votes |
/** * Transform a String[] array of schema to a Schema[] * * @param schemas The Schema names to process * @return an array of Schema instance * @throws LdapException If one of the Schema cannot be found */ private Schema[] toArray( String... schemas ) throws LdapException { Schema[] schemaArray = new Schema[schemas.length]; int n = 0; for ( String schemaName : schemas ) { Schema schema = schemaMap.get( schemaName ); if ( schema != null ) { schemaArray[n++] = schema; } else { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, I18n.err( I18n.ERR_16078_CANNOT_LOAD_UNKNOWN_SCHEMA, schemaName ) ); } } return schemaArray; }
Example 8
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Normalizer getNormalizer( SchemaManager schemaManager, NormalizerDescription normalizerDescription, Registries targetRegistries, String schemaName ) throws LdapException { checkDescription( normalizerDescription, SchemaConstants.NORMALIZER ); // The Comparator OID String oid = getOid( normalizerDescription, SchemaConstants.NORMALIZER ); // Get the schema Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is not loaded. We can't create the requested Normalizer String msg = I18n.err( I18n.ERR_16024_CANNOT_ADD_NORMALIZER, normalizerDescription.getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } // The FQCN String fqcn = getFqcn( normalizerDescription, SchemaConstants.NORMALIZER ); // get the byteCode Attribute byteCode = getByteCode( normalizerDescription, SchemaConstants.NORMALIZER ); // Class load the normalizer Normalizer normalizer = classLoadNormalizer( schemaManager, oid, fqcn, byteCode ); // Update the common fields setSchemaObjectProperties( normalizer, normalizerDescription, schema ); return normalizer; }
Example 9
Source File: DnNode.java From directory-ldap-api with Apache License 2.0 | 5 votes |
/** * Check that the Dn is not null * * @param dn The Dn to check * @throws LdapException If teh Dn is null or empty */ private void checkDn( Dn dn ) throws LdapException { if ( ( dn == null ) || dn.isEmpty() ) { String message = I18n.err( I18n.ERR_12000_CANNOT_PROCESS_EMPTY_DN ); LOG.error( message ); throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, message ); } }
Example 10
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * @throws LdapInvalidAttributeValueException If the MatchingRule does not exist * @throws LdapUnwillingToPerformException If the schema is not loaded */ @Override public MatchingRule getMatchingRule( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapUnwillingToPerformException, LdapInvalidAttributeValueException { checkEntry( entry, SchemaConstants.MATCHING_RULE ); // The MatchingRule OID String oid = getOid( entry, SchemaConstants.MATCHING_RULE, schemaManager.isStrict() ); // Get the schema if ( !schemaManager.isSchemaLoaded( schemaName ) ) { // The schema is not loaded. We can't create the requested MatchingRule String msg = I18n.err( I18n.ERR_16028_CANNOT_ADD_MR, entry.getDn().getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is disabled. We still have to update the backend if ( LOG.isInfoEnabled() ) { LOG.info( I18n.err( I18n.ERR_16029_CANNOT_ADD_MR_IN_REGISTRY, entry.getDn().getName(), schemaName ) ); } schema = schemaManager.getLoadedSchema( schemaName ); } MatchingRule matchingRule = new MatchingRule( oid ); // The syntax field Attribute mSyntax = entry.get( MetaSchemaConstants.M_SYNTAX_AT ); if ( mSyntax != null ) { matchingRule.setSyntaxOid( mSyntax.getString() ); } // The normalizer and comparator fields will be updated when we will // apply the registry // Common properties setSchemaObjectProperties( matchingRule, entry, schema ); return matchingRule; }
Example 11
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ObjectClass getObjectClass( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException { checkEntry( entry, SchemaConstants.OBJECT_CLASS ); // The ObjectClass OID String oid = getOid( entry, SchemaConstants.OBJECT_CLASS, schemaManager.isStrict() ); // Get the schema if ( !schemaManager.isSchemaLoaded( schemaName ) ) { // The schema is not loaded. We can't create the requested ObjectClass String msg = I18n.err( I18n.ERR_16030_CANNOT_ADD_OC, entry.getDn().getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is disabled. We still have to update the backend if ( LOG.isInfoEnabled() ) { LOG.info( I18n.err( I18n.ERR_16031_CANNOT_ADD_OC_IN_REGISTRY, entry.getDn().getName(), schemaName ) ); } schema = schemaManager.getLoadedSchema( schemaName ); } // Create the ObjectClass instance ObjectClass oc = new ObjectClass( oid ); // The Sup field Attribute mSuperiors = entry.get( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT ); if ( mSuperiors != null ) { oc.setSuperiorOids( getStrings( mSuperiors ) ); } // The May field Attribute mMay = entry.get( MetaSchemaConstants.M_MAY_AT ); if ( mMay != null ) { oc.setMayAttributeTypeOids( getStrings( mMay ) ); } // The Must field Attribute mMust = entry.get( MetaSchemaConstants.M_MUST_AT ); if ( mMust != null ) { oc.setMustAttributeTypeOids( getStrings( mMust ) ); } // The objectClassType field Attribute mTypeObjectClass = entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ); if ( mTypeObjectClass != null ) { String type = mTypeObjectClass.getString(); oc.setType( ObjectClassTypeEnum.getClassType( type ) ); } // Common properties setSchemaObjectProperties( oc, entry, schema ); return oc; }
Example 12
Source File: LdapUnwillingToPerformException.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * Creates a new instance of LdapUnwillingToPerformException, with * a default ResultCode to UNWILING_TO_PERFORM. */ public LdapUnwillingToPerformException() { super( ResultCodeEnum.UNWILLING_TO_PERFORM, null ); }
Example 13
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} * @throws LdapInvalidAttributeValueException If the Syntax does not exist * @throws LdapUnwillingToPerformException If the schema is not loaded */ @Override public LdapSyntax getSyntax( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapInvalidAttributeValueException, LdapUnwillingToPerformException { checkEntry( entry, SchemaConstants.SYNTAX ); // The Syntax OID String oid = getOid( entry, SchemaConstants.SYNTAX, schemaManager.isStrict() ); // Get the schema if ( !schemaManager.isSchemaLoaded( schemaName ) ) { // The schema is not loaded. We can't create the requested Syntax String msg = I18n.err( I18n.ERR_16026_CANNOT_ADD_SYNTAX, entry.getDn().getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is disabled. We still have to update the backend if ( LOG.isInfoEnabled() ) { LOG.info( I18n.err( I18n.ERR_16027_CANNOT_ADD_SYNTAX_IN_REGISTRY, entry.getDn().getName(), schemaName ) ); } schema = schemaManager.getLoadedSchema( schemaName ); } // Create the new LdapSyntax instance LdapSyntax syntax = new LdapSyntax( oid ); // Common properties setSchemaObjectProperties( syntax, entry, schema ); return syntax; }
Example 14
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public Normalizer getNormalizer( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException { checkEntry( entry, SchemaConstants.NORMALIZER ); // The Normalizer OID String oid = getOid( entry, SchemaConstants.NORMALIZER, schemaManager.isStrict() ); // Get the schema if ( !schemaManager.isSchemaLoaded( schemaName ) ) { // The schema is not loaded. We can't create the requested Normalizer String msg = I18n.err( I18n.ERR_16024_CANNOT_ADD_NORMALIZER, entry.getDn().getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is disabled. We still have to update the backend if ( LOG.isInfoEnabled() ) { LOG.info( I18n.err( I18n.ERR_16025_CANNOT_ADD_NORMALIZER_IN_REGISTRY, entry.getDn().getName(), schemaName ) ); } schema = schemaManager.getLoadedSchema( schemaName ); } // The FQCN String className = getFqcn( entry, SchemaConstants.NORMALIZER ); // The ByteCode Attribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT ); try { // Class load the Normalizer Normalizer normalizer = classLoadNormalizer( schemaManager, oid, className, byteCode ); // Update the common fields setSchemaObjectProperties( normalizer, entry, schema ); // return the resulting Normalizer return normalizer; } catch ( Exception e ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getMessage(), e ); } }
Example 15
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public LdapComparator<?> getLdapComparator( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException { checkEntry( entry, SchemaConstants.COMPARATOR ); // The Comparator OID String oid = getOid( entry, SchemaConstants.COMPARATOR, schemaManager.isStrict() ); // Get the schema if ( !schemaManager.isSchemaLoaded( schemaName ) ) { // The schema is not loaded. We can't create the requested Comparator String msg = I18n.err( I18n.ERR_16022_CANNOT_ADD_CMP, entry.getDn().getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is disabled. We still have to update the backend if ( LOG.isInfoEnabled() ) { LOG.info( I18n.err( I18n.ERR_16023_CANNOT_ADD_CMP_IN_REGISTRY, entry.getDn().getName(), schemaName ) ); } schema = schemaManager.getLoadedSchema( schemaName ); } // The FQCN String fqcn = getFqcn( entry, SchemaConstants.COMPARATOR ); // The ByteCode Attribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT ); try { // Class load the comparator LdapComparator<?> comparator = classLoadComparator( schemaManager, oid, fqcn, byteCode ); // Update the common fields setSchemaObjectProperties( comparator, entry, schema ); // return the resulting comparator return comparator; } catch ( Exception e ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getMessage(), e ); } }
Example 16
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public LdapComparator<?> getLdapComparator( SchemaManager schemaManager, LdapComparatorDescription comparatorDescription, Registries targetRegistries, String schemaName ) throws LdapException { checkDescription( comparatorDescription, SchemaConstants.COMPARATOR ); // The Comparator OID String oid = getOid( comparatorDescription, SchemaConstants.COMPARATOR ); // Get the schema Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is not loaded. We can't create the requested Comparator String msg = I18n.err( I18n.ERR_16022_CANNOT_ADD_CMP, comparatorDescription.getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } // The FQCN String fqcn = getFqcn( comparatorDescription, SchemaConstants.COMPARATOR ); // get the byteCode Attribute byteCode = getByteCode( comparatorDescription, SchemaConstants.COMPARATOR ); // Class load the comparator LdapComparator<?> comparator = classLoadComparator( schemaManager, oid, fqcn, byteCode ); // Update the common fields setSchemaObjectProperties( comparator, comparatorDescription, schema ); return comparator; }
Example 17
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, SyntaxCheckerDescription syntaxCheckerDescription, Registries targetRegistries, String schemaName ) throws LdapException { checkDescription( syntaxCheckerDescription, SchemaConstants.SYNTAX_CHECKER ); // The Comparator OID String oid = getOid( syntaxCheckerDescription, SchemaConstants.SYNTAX_CHECKER ); // Get the schema Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is not loaded. We can't create the requested SyntaxChecker String msg = I18n.err( I18n.ERR_16019_CANNOT_ADD_SC, syntaxCheckerDescription.getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } // The FQCN String fqcn = getFqcn( syntaxCheckerDescription, SchemaConstants.SYNTAX_CHECKER ); // get the byteCode Attribute byteCode = getByteCode( syntaxCheckerDescription, SchemaConstants.SYNTAX_CHECKER ); // Class load the SyntaxChecker SyntaxChecker syntaxChecker = classLoadSyntaxChecker( schemaManager, oid, fqcn, byteCode ); // Update the common fields setSchemaObjectProperties( syntaxChecker, syntaxCheckerDescription, schema ); return syntaxChecker; }
Example 18
Source File: SchemaEntityFactory.java From directory-ldap-api with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override public SyntaxChecker getSyntaxChecker( SchemaManager schemaManager, Entry entry, Registries targetRegistries, String schemaName ) throws LdapException { checkEntry( entry, SchemaConstants.SYNTAX_CHECKER ); // The SyntaxChecker OID String oid = getOid( entry, SchemaConstants.SYNTAX_CHECKER, schemaManager.isStrict() ); // Get the schema if ( !schemaManager.isSchemaLoaded( schemaName ) ) { // The schema is not loaded. We can't create the requested Normalizer String msg = I18n.err( I18n.ERR_16019_CANNOT_ADD_SC, entry.getDn().getName(), schemaName ); if ( LOG.isWarnEnabled() ) { LOG.warn( msg ); } throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, msg ); } Schema schema = getSchema( schemaName, targetRegistries ); if ( schema == null ) { // The schema is disabled. We still have to update the backend if ( LOG.isInfoEnabled() ) { LOG.info( I18n.err( I18n.ERR_16020_CANNOT_ADD_SC_IN_REGISTRY, entry.getDn().getName(), schemaName ) ); } schema = schemaManager.getLoadedSchema( schemaName ); } // The FQCN String className = getFqcn( entry, SchemaConstants.SYNTAX_CHECKER ); // The ByteCode Attribute byteCode = entry.get( MetaSchemaConstants.M_BYTECODE_AT ); try { // Class load the syntaxChecker SyntaxChecker syntaxChecker = classLoadSyntaxChecker( schemaManager, oid, className, byteCode ); // Update the common fields setSchemaObjectProperties( syntaxChecker, entry, schema ); // return the resulting syntaxChecker return syntaxChecker; } catch ( Exception e ) { throw new LdapUnwillingToPerformException( ResultCodeEnum.UNWILLING_TO_PERFORM, e.getMessage(), e ); } }
Example 19
Source File: LdapUnwillingToPerformException.java From directory-ldap-api with Apache License 2.0 | 2 votes |
/** * Creates a new instance of LdapUnwillingToPerformException. * * @param message The exception message */ public LdapUnwillingToPerformException( String message ) { super( ResultCodeEnum.UNWILLING_TO_PERFORM, message ); }