Package org.apache.directory.server.schema.registries

Examples of org.apache.directory.server.schema.registries.ObjectClassRegistry


        getLog().info( "------------------------------------------------------------------------" );
        getLog().info( " Adding objectClasses:" );
        getLog().info( "------------------------------------------------------------------------" );
        getLog().info( "" );

        ObjectClassRegistry objectClassRegistry = registries.getObjectClassRegistry();

        for ( ObjectClass objectClass:objectClassRegistry )
        {
            String schemaName = objectClassRegistry.getSchemaName( objectClass.getOid() );
            Schema schema = registries.getLoadedSchemas().get( schemaName );
            getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( objectClass ) );
            LdapDN dn = checkCreateSchema( schemaName );
            dn.add( SchemaConstants.OU_AT + "=objectClasses" );
            dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
View Full Code Here


        {
            AttributeType at = atReg.lookup( OP_ATTRS[ii] );
            opAttr2handlerMap.put( at.getOid(), schemaObjectHandlers[ii] );
        }

        ObjectClassRegistry ocReg = registries.getObjectClassRegistry();
        for ( int ii = 0; ii < META_OBJECT_CLASSES.length; ii++ )
        {
            ObjectClass oc = ocReg.lookup( META_OBJECT_CLASSES[ii] );
            objectClass2handlerMap.put( oc.getOid(), schemaObjectHandlers[ii] );
        }
    }
View Full Code Here

     * @throws Exception if the attribute is not recognized
     */
    private boolean isRequired( String attrId, EntryAttribute objectClasses ) throws Exception
    {
        OidRegistry oidRegistry = registries.getOidRegistry();
        ObjectClassRegistry registry = registries.getObjectClassRegistry();

        if ( !oidRegistry.hasOid( attrId ) )
        {
            return false;
        }

        String attrOid = oidRegistry.getOid( attrId );

        for ( Value<?> objectClass : objectClasses )
        {
            ObjectClass ocSpec = registry.lookup( objectClass.getString() );

            for ( AttributeType must : ocSpec.getMustList() )
            {
                if ( must.getOid().equals( attrOid ) )
                {
View Full Code Here


    private boolean getObjectClasses( EntryAttribute objectClasses, List<ObjectClass> result ) throws Exception
    {
        Set<String> ocSeen = new HashSet<String>();
        ObjectClassRegistry registry = registries.getObjectClassRegistry();

        // We must select all the ObjectClasses, except 'top',
        // but including all the inherited ObjectClasses
        boolean hasExtensibleObject = false;

        for ( Value<?> objectClass : objectClasses )
        {
            String objectClassName = objectClass.getString();

            if ( SchemaConstants.TOP_OC.equals( objectClassName ) )
            {
                continue;
            }

            if ( SchemaConstants.EXTENSIBLE_OBJECT_OC.equalsIgnoreCase( objectClassName ) )
            {
                hasExtensibleObject = true;
            }

            ObjectClass oc = registry.lookup( objectClassName );

            // Add all unseen objectClasses to the list, except 'top'
            if ( !ocSeen.contains( oc.getOid() ) )
            {
                ocSeen.add( oc.getOid() );
View Full Code Here

        {
            objectClass = getResultantObjectClasses( objectClassMod.getOperation(), objectClassMod.getAttribute(),
                tmpEntry.get( SchemaConstants.OBJECT_CLASS_AT ).clone() );
        }

        ObjectClassRegistry ocRegistry = this.registries.getObjectClassRegistry();

        // Now, apply the modifications on the cloned entry before applying it on the
        // real object.
        for ( Modification mod : mods )
        {
View Full Code Here

    }


    private void checkOcSuperior( ServerEntry entry ) throws Exception
    {
        ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
       
        // handle the m-supObjectClass meta attribute
        EntryAttribute supOC = entry.get( MetaSchemaConstants.M_SUP_OBJECT_CLASS_AT );
       
        if ( supOC != null )
        {
            ObjectClassTypeEnum ocType = ObjectClassTypeEnum.STRUCTURAL;
           
            if ( entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ) != null )
            {
                String type = entry.get( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT ).getString();
                ocType = ObjectClassTypeEnum.getClassType( type );
            }
           
            // First check that the inheritence scheme is correct.
            // 1) If the ocType is ABSTRACT, it should not have any other SUP not ABSTRACT
            for ( Value<?> sup:supOC )
            {
                try
                {
                    String supName = sup.getString();
                   
                    ObjectClass superior = ocRegistry.lookup( supName );

                    switch ( ocType )
                    {
                        case ABSTRACT :
                            if ( !superior.isAbstract() )
View Full Code Here

        ModificationOperation mod = ModificationOperation.REPLACE_ATTRIBUTE;
        ServerEntry modifyAttributes = new DefaultServerEntry( registries );
        AttributeType atCN = registries.getAttributeTypeRegistry().lookup( "cn" );
        modifyAttributes.put( new DefaultServerAttribute( atCN ) );

        ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();

        // this should pass
        SchemaChecker.preventStructuralClassRemovalOnModifyReplace( ocRegistry, name, mod, modifyAttributes );

        // this should succeed since person is still in replaced set and is structural
View Full Code Here

     * operations replace objectClasses.
     */
    @Test
    public void testPreventStructuralClassRemovalOnModifyReplaceAttribute() throws Exception
    {
        ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();
        AttributeType OBJECT_CLASS = registries.getAttributeTypeRegistry().lookup( "objectClass" );
        AttributeType CN_AT = registries.getAttributeTypeRegistry().lookup( "cn" );

        // this should pass
        LdapDN name = new LdapDN( "uid=akarasulu,ou=users,dc=example,dc=com" );
View Full Code Here

        AttributeType ocAt = atReg.lookup( "objectClass" );
       
        ServerAttribute entryObjectClasses = new DefaultServerAttribute( "objectClass", ocAt );
        entryObjectClasses.add( "top", "person", "organizationalPerson" );

        ObjectClassRegistry ocRegistry = registries.getObjectClassRegistry();

        // this should pass
        SchemaChecker.preventStructuralClassRemovalOnModifyRemove(
            ocRegistry,
            name,
View Full Code Here

TOP

Related Classes of org.apache.directory.server.schema.registries.ObjectClassRegistry

Copyright © 2018 www.massapicom. 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.