Examples of SchemaObject

  • org.apache.directory.shared.ldap.model.schema.SchemaObject
    Most schema objects have some common attributes. This class contains the minimum set of properties exposed by a SchemaObject.
    We have 11 types of SchemaObjects :
  • AttributeType
  • DitCOntentRule
  • DitStructureRule
  • LdapComparator (specific to ADS)
  • LdapSyntaxe
  • MatchingRule
  • MatchingRuleUse
  • NameForm
  • Normalizer (specific to ADS)
  • ObjectClass
  • SyntaxChecker (specific to ADS)

    This class provides accessors and setters for the following attributes, which are common to all those SchemaObjects :
  • oid : The numeric OID
  • description : The SchemaObject description
  • obsolete : Tells if the schema object is obsolete
  • extensions : The extensions, a key/Values map
  • schemaObjectType : The SchemaObject type (see upper)
  • schema : The schema the SchemaObject is associated with (it's an extension). Can be null
  • isEnabled : The SchemaObject status (it's related to the schema status)
  • isReadOnly : Tells if the SchemaObject can be modified or not

    Some of those attributes are not used by some Schema elements, even if they should have been used. Here is the list : name : LdapSyntax, Comparator, Normalizer, SyntaxChecker numericOid : DitStructureRule, obsolete : LdapSyntax, Comparator, Normalizer, SyntaxChecker @author Apache Directory Project
  • org.apache.directory.shared.ldap.schema.SchemaObject
  • org.h2.schema.SchemaObject
    Any database object that is stored in a schema.
  • org.hsqldb.SchemaObject
    SQL schema object interface @author Fred Toussi (fredt@users dot sourceforge.net) @version 1.9.0 @since 1.9.0
  • org.hsqldb_voltpatches.SchemaObject
    SQL schema object interface @author Fred Toussi (fredt@users dot sourceforge.net) @version 1.9.0 @since 1.9.0
  • org.lealone.dbobject.SchemaObject
    Any database object that is stored in a schema.

  • Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

                String msg = I18n.err( I18n.ERR_04267 );
                LOG.warn( msg );
                throw new LdapException( msg );
            }

            SchemaObject schemaObject = byName.get( oid );

            if ( schemaObject != null )
            {
                return schemaObject.getSchemaName();
            }

            String msg = I18n.err( I18n.ERR_04268, oid );
            LOG.warn( msg );
            throw new LdapException( msg );
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

            for ( T schemaObject : this )
            {
                if ( schemaName.equalsIgnoreCase( schemaObject.getSchemaName() ) )
                {
                    String oid = schemaObject.getOid();
                    SchemaObject removed = unregister( oid );

                    if ( DEBUG )
                    {
                        LOG.debug( "Removed {} with oid {} from the registry", removed, oid );
                    }
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

        }


        private SchemaObject copy( SchemaObject schemaObject )
        {
            SchemaObject copy = null;

            if ( !( schemaObject instanceof LoadableSchemaObject ) )
            {
                copy = schemaObject.copy();
            }
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

        {
            // First, clear the errors
            errors.clear();

            // Clone the schemaObject
            SchemaObject copy = copy( schemaObject );

            if ( copy == null )
            {
                return false;
            }

            if ( registries.isRelaxed() )
            {
                // Apply the addition right away
                registries.add( errors, copy );

                return errors.isEmpty();
            }
            else
            {
                // Clone, apply, check, then apply again if ok
                // The new schemaObject's OID must not already exist
                if ( checkOidExist( copy ) )
                {
                    LdapSchemaException ldapSchemaException = new LdapSchemaException(
                        LdapSchemaExceptionCodes.OID_ALREADY_REGISTERED, I18n.err( I18n.ERR_11008, schemaObject.getOid() ) );
                    ldapSchemaException.setSourceObject( schemaObject );
                    errors.add( ldapSchemaException );

                    return false;
                }

                // Build the new AttributeType from the given entry
                String schemaName = getSchemaName( copy );

                if ( schemaName == null )
                {
                    // The schema associated with the SchemaaObject does not exist. This is not valid.

                    LdapSchemaException ldapSchemaException = new LdapSchemaException(
                        LdapSchemaExceptionCodes.NONEXISTENT_SCHEMA, I18n.err( I18n.ERR_11009, schemaObject.getOid(),
                            copy.getSchemaName() ) );
                    ldapSchemaException.setSourceObject( schemaObject );
                    ldapSchemaException.setRelatedId( copy.getSchemaName() );
                    errors.add( ldapSchemaException );

                    return false;
                }

                // At this point, the constructed AttributeType has not been checked against the
                // existing Registries. It may be broken (missing SUP, or such), it will be checked
                // there, if the schema and the AttributeType are both enabled.
                Schema schema = getLoadedSchema( schemaName );

                if ( schema == null )
                {
                    // The SchemaObject must be associated with an existing schema
                    String msg = I18n.err( I18n.ERR_11010, copy.getOid() );
                    LOG.info( msg );
                    Throwable error = new LdapProtocolErrorException( msg );
                    errors.add( error );
                    return false;
                }

                if ( schema.isEnabled() && copy.isEnabled() )
                {
                    // As we may break the registries, work on a cloned registries
                    Registries clonedRegistries = null;

                    try
                    {
                        clonedRegistries = registries.clone();
                    }
                    catch ( CloneNotSupportedException cnse )
                    {
                        throw new LdapOtherException( cnse.getMessage() );
                    }

                    // Inject the new SchemaObject in the cloned registries
                    clonedRegistries.add( errors, copy );

                    // Remove the cloned registries
                    clonedRegistries.clear();

                    // If we didn't get any error, apply the addition to the real retistries
                    if ( errors.isEmpty() )
                    {
                        // Copy again as the clonedRegistries clear has removed the previous copy
                        copy = copy( schemaObject );

                        // Apply the addition to the real registries
                        registries.add( errors, copy );

                        LOG.debug( "Added {} into the enabled schema {}", copy.getName(), schemaName );

                        return true;
                    }
                    else
                    {
                        // We have some error : reject the addition and get out
                        String msg = "Cannot add the SchemaObject " + copy.getOid() + " into the registries, "
                            + "the resulting registries would be inconsistent :" + Strings.listToString( errors );
                        LOG.info( msg );

                        return false;
                    }
                }
                else
                {
                    // At least, we register the OID in the globalOidRegistry, and associates it with the
                    // schema
                    registries.associateWithSchema( errors, copy );

                    LOG.debug( "Added {} into the disabled schema {}", copy.getName(), schemaName );
                    return errors.isEmpty();
                }
            }
        }
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

                    errors.add( error );
                    return false;
                }

                // Get the SchemaObject to delete if it's not a LoadableSchemaObject
                SchemaObject toDelete = getSchemaObject( schemaObject );

                // First check that this SchemaObject does not have any referencing SchemaObjects
                Set<SchemaObjectWrapper> referencing = registries.getReferencing( toDelete );

                if ( ( referencing != null ) && !referencing.isEmpty() )
                {
                    String msg = I18n.err( I18n.ERR_11012, schemaObject.getOid(), Strings.setToString( referencing ) );

                    Throwable error = new LdapProtocolErrorException( msg );
                    errors.add( error );
                    return false;
                }

                String schemaName = getSchemaName( toDelete );

                // At this point, the deleted AttributeType may be referenced, it will be checked
                // there, if the schema and the AttributeType are both enabled.
                Schema schema = getLoadedSchema( schemaName );

                if ( schema == null )
                {
                    // The SchemaObject must be associated with an existing schema
                    String msg = I18n.err( I18n.ERR_11013, schemaObject.getOid() );
                    LOG.info( msg );
                    Throwable error = new LdapProtocolErrorException( msg );
                    errors.add( error );
                    return false;
                }

                if ( schema.isEnabled() && schemaObject.isEnabled() )
                {
                    // As we may break the registries, work on a cloned registries
                    Registries clonedRegistries = null;

                    try
                    {
                        clonedRegistries = registries.clone();
                    }
                    catch ( CloneNotSupportedException cnse )
                    {
                        throw new LdapOtherException( cnse.getMessage() );
                    }

                    // Delete the SchemaObject from the cloned registries
                    clonedRegistries.delete( errors, toDelete );

                    // Remove the cloned registries
                    clonedRegistries.clear();

                    // If we didn't get any error, apply the deletion to the real retistries
                    if ( errors.isEmpty() )
                    {
                        // Apply the deletion to the real registries
                        registries.delete( errors, toDelete );

                        LOG.debug( "Removed {} from the enabled schema {}", toDelete.getName(), schemaName );

                        return true;
                    }
                    else
                    {
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

         * @return the primary name
         * @throws LdapException if oid does not exist
         */
        public String getPrimaryName( String oid ) throws LdapException
        {
            SchemaObject schemaObject = byOid.get( oid );

            if ( schemaObject != null )
            {
                return schemaObject.getName();
            }
            else
            {
                String msg = I18n.err( I18n.ERR_04286, oid );
                LOG.error( msg );
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

         * @return a sorted set of names
         * @throws org.apache.directory.shared.ldap.model.exception.LdapException if oid does not exist
         */
        public List<String> getNameSet( String oid ) throws LdapException
        {
            SchemaObject schemaObject = byOid.get( oid );

            if ( null == schemaObject )
            {
                String msg = I18n.err( I18n.ERR_04288, oid );
                LOG.error( msg );
                throw new LdapException( msg );
            }

            List<String> names = schemaObject.getNames();

            if ( IS_DEBUG )
            {
                LOG.debug( "looked up names '{}' for OID '{}'", ArrayUtils.toString( names ), oid );
            }
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.model.schema.SchemaObject

         * @throws LdapException if the identifier is not numeric
         */
        public void unregister( String oid ) throws LdapException
        {
            // Removes the <OID, names> from the byOID map
            SchemaObject removed = byOid.remove( oid );

            if ( IS_DEBUG )
            {
                LOG.debug( "Unregisted SchemaObject '{}' with OID: {}", removed, oid );
            }
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.schema.SchemaObject

        private void renameSchema( DefaultSchemaObjectRegistry<? extends SchemaObject> registry, String originalSchemaName, String newSchemaName )
        {
            Iterator<? extends SchemaObject> list = registry.iterator();
            while ( list.hasNext() )
            {
                SchemaObject obj = list.next();
                if ( obj.getSchemaName().equalsIgnoreCase( originalSchemaName ) )
                {
                    obj.setSchemaName( newSchemaName );
                }
            }
        }
    View Full Code Here

    Examples of org.apache.directory.shared.ldap.schema.SchemaObject

        {
            if ( element instanceof DuplicateAliasError )
            {
                DuplicateAliasError duplicateAliasError = ( DuplicateAliasError ) element;

                SchemaObject duplicate = duplicateAliasError.getDuplicate();
                if ( duplicate instanceof AttributeTypeImpl )
                {
                    return NLS
                        .bind(
                            Messages.getString( "ProblemsViewLabelProvider.DuplicateAliasErrorAttributeType" ), new String[] { duplicateAliasError.getAlias(), duplicate.getOid() } ); //$NON-NLS-1$
                }
                else if ( duplicate instanceof ObjectClassImpl )
                {
                    return NLS
                        .bind(
                            Messages.getString( "ProblemsViewLabelProvider.DuplicateAliasErrorObjectClass" ), new String[] { duplicateAliasError.getAlias(), duplicate.getOid() } ); //$NON-NLS-1$
                }
            }
            else if ( element instanceof DuplicateOidError )
            {
                DuplicateOidError duplicateOidError = ( DuplicateOidError ) element;
                SchemaObject duplicate = duplicateOidError.getDuplicate();
                if ( duplicate instanceof AttributeTypeImpl )
                {
                    return NLS
                        .bind(
                            Messages.getString( "ProblemsViewLabelProvider.DuplicateOidErrorAttributeType" ), new String[] { duplicateOidError.getOid(), duplicate.getName() } ); //$NON-NLS-1$
                }
                else if ( duplicate instanceof ObjectClassImpl )
                {
                    return NLS
                        .bind(
                            Messages.getString( "ProblemsViewLabelProvider.DuplicateOidErrorObjectClass" ), new String[] { duplicateOidError.getOid(), duplicate.getName() } ); //$NON-NLS-1$
                }
            }
            else if ( element instanceof NonExistingATSuperiorError )
            {
                NonExistingATSuperiorError nonExistingATSuperiorError = ( NonExistingATSuperiorError ) element;
                return NLS
                    .bind(
                        Messages.getString( "ProblemsViewLabelProvider.NonExistingSuperiorAttribute" ), new String[] { nonExistingATSuperiorError.getSuperiorAlias() } ); //$NON-NLS-1$
            }
            else if ( element instanceof NonExistingOCSuperiorError )
            {
                NonExistingOCSuperiorError nonExistingOCSuperiorError = ( NonExistingOCSuperiorError ) element;
                return NLS
                    .bind(
                        Messages.getString( "ProblemsViewLabelProvider.NonExistingSuperiorObject" ), new String[] { nonExistingOCSuperiorError.getSuperiorAlias() } ); //$NON-NLS-1$
            }
            else if ( element instanceof NonExistingMandatoryATError )
            {
                NonExistingMandatoryATError nonExistingMandatoryATError = ( NonExistingMandatoryATError ) element;
                return NLS
                    .bind(
                        Messages.getString( "ProblemsViewLabelProvider.NonExistingMandatoryAttribute" ), new String[] { nonExistingMandatoryATError.getAlias() } ); //$NON-NLS-1$
            }
            else if ( element instanceof NonExistingOptionalATError )
            {
                NonExistingOptionalATError nonExistingOptionalATError = ( NonExistingOptionalATError ) element;
                return NLS
                    .bind(
                        Messages.getString( "ProblemsViewLabelProvider.NonExistingOptionalAttribute" ), new String[] { nonExistingOptionalATError.getAlias() } ); //$NON-NLS-1$
            }
            else if ( element instanceof NonExistingSyntaxError )
            {
                NonExistingSyntaxError nonExistingSyntaxError = ( NonExistingSyntaxError ) element;
                return NLS
                    .bind(
                        Messages.getString( "ProblemsViewLabelProvider.NonExistingSyntax" ), new String[] { nonExistingSyntaxError.getSyntaxOid() } ); //$NON-NLS-1$
            }
            else if ( element instanceof NonExistingMatchingRuleError )
            {
                NonExistingMatchingRuleError nonExistingMatchingRuleError = ( NonExistingMatchingRuleError ) element;
                return NLS
                    .bind(
                        Messages.getString( "ProblemsViewLabelProvider.NonExistingMatchingRule" ), new String[] { nonExistingMatchingRuleError.getMatchingRuleAlias() } ); //$NON-NLS-1$
            }
            else if ( element instanceof NoAliasWarning )
            {
                NoAliasWarning noAliasWarning = ( NoAliasWarning ) element;
                SchemaObject source = noAliasWarning.getSource();
                if ( source instanceof AttributeTypeImpl )
                {
                    return NLS
                        .bind(
                            Messages.getString( "ProblemsViewLabelProvider.NoAliasWarningAttributeType" ), new String[] { source.getOid() } ); //$NON-NLS-1$
                }
                else if ( source instanceof ObjectClassImpl )
                {
                    return NLS
                        .bind(
                            Messages.getString( "ProblemsViewLabelProvider.NoAliasWarningObjectClass" ), new String[] { source.getOid() } ); //$NON-NLS-1$
                }
            }
            else if ( element instanceof ClassTypeHierarchyError )
            {
                ClassTypeHierarchyError classTypeHierarchyError = ( ClassTypeHierarchyError ) element;
                ObjectClassImpl source = ( ObjectClassImpl ) classTypeHierarchyError.getSource();
                ObjectClassImpl superior = ( ObjectClassImpl ) classTypeHierarchyError.getSuperior();
                if ( source.getType().equals( ObjectClassTypeEnum.ABSTRACT ) )
                {
                    if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
                    {
                        return NLS
                            .bind(
                                Messages
                                    .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAbstractStructuralObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
                    }
                    else if ( superior.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
                    {
                        return NLS
                            .bind(
                                Messages
                                    .getString( "ProblemsViewLabelProvider.ClassTypeHierarchyErrorAbstractAuxiliaryObject" ), new String[] { getDisplayName( source ), getDisplayName( superior ) } ); //$NON-NLS-1$
                    }
                }
                else if ( source.getType().equals( ObjectClassTypeEnum.AUXILIARY ) )
                {
                    if ( superior.getType().equals( ObjectClassTypeEnum.STRUCTURAL ) )
                    {
                        return NLS
                            .bind(
    View Full Code Here
    TOP
    Copyright © 2018 www.massapi.com. All rights reserved.
    All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.