directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r512027 - in /directory/apacheds/trunk: bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ constants/src/main/java/org/apache/directory/server/constants/ core/src/main/java/org/apache/directory/server/core/ope...
Date Mon, 26 Feb 2007 21:54:52 GMT
Author: akarasulu
Date: Mon Feb 26 13:54:51 2007
New Revision: 512027

URL: http://svn.apache.org/viewvc?view=rev&rev=512027
Log:
Made changes to allow proper timestamps and name for modifications to schema in 
the schema subentry.  More tests to follow.

Modified:
    directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
    directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
    directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
    directory/apacheds/trunk/schema-bootstrap/src/main/schema/apache.schema
    directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java

Modified: directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
(original)
+++ directory/apacheds/trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
Mon Feb 26 13:54:51 2007
@@ -35,6 +35,7 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.constants.CoreSchemaConstants;
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.constants.SystemSchemaConstants;
@@ -71,6 +72,7 @@
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.Syntax;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxChecker;
+import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -88,6 +90,8 @@
  */
 public class BootstrapPlugin extends AbstractMojo
 {
+    private static final String ADMIN_NORM_NAME = "0.9.2342.19200300.100.1.1=admin,2.5.4.11=system";
+
     /**
      * The package to put the db file entry listing info as well as the partition.
      * 
@@ -216,6 +220,8 @@
                 getLog().info( "" );
                 getLog().info( "------------------------------------------------------------------------"
);
             }
+            
+            createSchemaModificationAttributesEntry();
         }
         catch ( NamingException e )
         {
@@ -606,6 +612,39 @@
             e.printStackTrace();
             throw new MojoFailureException( "Failed to initialize parition: " + e.getMessage()
);
         }
+    }
+    
+    
+    /**
+     * Creates the special schemaModificationsAttribute entry used to
+     * store the modification attributes for the schema.  The current
+     * time is used to create the initial values for the attributes in
+     * this entry.
+     * 
+     * @throws NamingException if there is a failure to add the entry 
+     */
+    private void createSchemaModificationAttributesEntry() throws NamingException
+    {
+        Attributes entry = new AttributesImpl( 
+            SystemSchemaConstants.OBJECT_CLASS_AT, 
+            ApacheSchemaConstants.SCHEMA_MODIFICATION_ATTRIBUTES_OC,
+            true );
+        entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "top" );
+        
+        entry.put( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, ADMIN_NORM_NAME );
+        entry.put( SystemSchemaConstants.MODIFIERS_NAME_AT, ADMIN_NORM_NAME );
+        entry.put( SystemSchemaConstants.CREATORS_NAME_AT, ADMIN_NORM_NAME );
+        
+        entry.put( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.MODIFY_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        
+        entry.put( SystemSchemaConstants.CN_AT, "schemaModifications" );
+        entry.put( ApacheSchemaConstants.SUBSCHEMA_SUBENTRY_NAME_AT, "cn=schema" );
+        
+        LdapDN normName = new LdapDN( "cn=schemaModifications,ou=schema" );
+        normName.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
+        store.add( normName, entry );
     }
     
     

Modified: directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
(original)
+++ directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/ApacheSchemaConstants.java
Mon Feb 26 13:54:51 2007
@@ -32,4 +32,9 @@
     String NORMALIZERS_AT = "normalizers";
     String SYNTAX_CHECKERS_AT = "syntaxCheckers";
 
+    String SCHEMA_MODIFIERS_NAME_AT = "schemaModifiersName";
+    String SCHEMA_MODIFY_TIMESTAMP_AT = "schemaModifyTimestamp";
+    String SUBSCHEMA_SUBENTRY_NAME_AT = "subschemaSubentryName";
+
+    String SCHEMA_MODIFICATION_ATTRIBUTES_OC = "schemaModificationAttributes";
 }

Modified: directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
(original)
+++ directory/apacheds/trunk/constants/src/main/java/org/apache/directory/server/constants/SystemSchemaConstants.java
Mon Feb 26 13:54:51 2007
@@ -33,7 +33,7 @@
     String CN_AT = "cn";
     String OBJECT_CLASS_AT = "objectClass";
     String CREATORS_NAME_AT = "creatorsName";
-    String CREAT_TIMESTAMP_AT = "createTimestamp";
+    String CREATE_TIMESTAMP_AT = "createTimestamp";
     String MODIFY_TIMESTAMP_AT = "modifyTimestamp";
     String MODIFIERS_NAME_AT = "modifiersName";
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
Mon Feb 26 13:54:51 2007
@@ -34,6 +34,8 @@
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.constants.SystemSchemaConstants;
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
@@ -393,7 +395,7 @@
     {
         if ( isDenormalizeOpAttrsEnabled )
         {
-            AttributeType type = registry.lookup( "creatorsName" );
+            AttributeType type = registry.lookup( SystemSchemaConstants.CREATORS_NAME_AT
);
             Attribute attr = AttributeUtils.getAttribute( entry, type );
 
             if ( attr != null )
@@ -405,7 +407,20 @@
             }
             
             type = null;
-            type = registry.lookup( "modifiersName" );
+            type = registry.lookup( SystemSchemaConstants.MODIFIERS_NAME_AT );
+            attr = null;
+            attr = AttributeUtils.getAttribute( entry, type );
+            
+            if ( attr != null )
+            {
+                LdapDN modifiersName = new LdapDN( ( String ) attr.get() );
+
+                attr.clear();
+                attr.add( denormalizeTypes( modifiersName ).getUpName() );
+            }
+
+            type = null;
+            type = registry.lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT );
             attr = null;
             attr = AttributeUtils.getAttribute( entry, type );
             

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaManager.java
Mon Feb 26 13:54:51 2007
@@ -20,6 +20,8 @@
 package org.apache.directory.server.core.schema;
 
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -35,6 +37,9 @@
 import org.apache.directory.server.constants.CoreSchemaConstants;
 import org.apache.directory.server.constants.MetaSchemaConstants;
 import org.apache.directory.server.constants.SystemSchemaConstants;
+import org.apache.directory.server.core.invocation.Invocation;
+import org.apache.directory.server.core.invocation.InvocationStack;
+import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.ObjectClassRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
@@ -43,6 +48,7 @@
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.exception.LdapOperationNotSupportedException;
+import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -59,6 +65,7 @@
 import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.util.DateUtils;
 
 
 /**
@@ -116,6 +123,7 @@
         "metaDITContentRule",
         "metaNameForm"
     };
+    private static final Collection SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS;
 
     private final PartitionSchemaLoader loader;
     private final MetaSchemaHandler metaSchemaHandler;
@@ -161,6 +169,17 @@
         VALID_OU_VALUES.add( "nameforms" );
         VALID_OU_VALUES.add( "ditcontentrules" );
         VALID_OU_VALUES.add( "ditstructurerules" );
+        
+        HashSet<String> set = new HashSet<String>();
+        set.add( "normalizationService" );
+        set.add( "authenticationService" );
+        set.add( "referralService" );
+        set.add( "authorizationService" );
+        set.add( "defaultAuthorizationService" );
+        set.add( "exceptionService" );
+        set.add( "schemaService" );
+        set.add( "collectiveAttributeService" );
+        SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS = Collections.unmodifiableCollection(
set );
     }
 
 
@@ -269,6 +288,7 @@
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
                 handler.add( name, entry );
+                updateSchemaModificationAttributes();
                 return;
             }
         }
@@ -276,6 +296,7 @@
         if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT
) )
         {
             metaSchemaHandler.add( name, entry );
+            updateSchemaModificationAttributes();
             return;
         }
         
@@ -314,6 +335,7 @@
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
                 handler.delete( name, entry );
+                updateSchemaModificationAttributes();
                 return;
             }
         }
@@ -321,6 +343,7 @@
         if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT
) )
         {
             metaSchemaHandler.delete( name, entry );
+            updateSchemaModificationAttributes();
             return;
         }
         
@@ -360,6 +383,7 @@
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
                 handler.modify( name, modOp, mods, entry, targetEntry );
+                updateSchemaModificationAttributes();
                 return;
             }
         }
@@ -367,6 +391,7 @@
         if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT
) )
         {
             metaSchemaHandler.modify( name, modOp, mods, entry, targetEntry );
+            updateSchemaModificationAttributes();
             return;
         }
         
@@ -386,6 +411,7 @@
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
                 handler.modify( name, mods, entry, targetEntry );
+                updateSchemaModificationAttributes();
                 return;
             }
         }
@@ -393,6 +419,7 @@
         if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT
) )
         {
             metaSchemaHandler.modify( name, mods, entry, targetEntry );
+            updateSchemaModificationAttributes();
             return;
         }
         
@@ -411,6 +438,7 @@
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
                 handler.rename( name, entry, newRdn );
+                updateSchemaModificationAttributes();
                 return;
             }
         }
@@ -418,6 +446,7 @@
         if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT
) )
         {
             metaSchemaHandler.rename( name, entry, newRdn );
+            updateSchemaModificationAttributes();
             return;
         }
         
@@ -436,6 +465,7 @@
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
                 handler.move( oriChildName, newParentName, entry );
+                updateSchemaModificationAttributes();
                 return;
             }
         }
@@ -443,6 +473,7 @@
         if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT
) )
         {
             metaSchemaHandler.move( oriChildName, newParentName, entry );
+            updateSchemaModificationAttributes();
             return;
         }
         
@@ -462,6 +493,7 @@
             {
                 SchemaChangeHandler handler = objectClass2handlerMap.get( oid );
                 handler.move( oriChildName, newParentName, newRn, deleteOldRn, entry );
+                updateSchemaModificationAttributes();
                 return;
             }
         }
@@ -469,6 +501,7 @@
         if ( AttributeUtils.containsValue( oc, MetaSchemaConstants.META_SCHEMA_OC, objectClassAT
) )
         {
             metaSchemaHandler.move( oriChildName, newParentName, newRn, deleteOldRn, entry
);
+            updateSchemaModificationAttributes();
             return;
         }
         
@@ -511,6 +544,11 @@
                     throw new IllegalStateException( "Undefined modify operation: " + mod.getModificationOp()
);
             }
         }
+        
+        if ( mods != null || mods.length > 0 )
+        {
+            updateSchemaModificationAttributes();
+        }
     }
     
     
@@ -557,6 +595,7 @@
             default:
                 throw new IllegalStateException( "Undefined modify operation: " + modOp );
         }
+        updateSchemaModificationAttributes();
     }
 
     
@@ -828,5 +867,34 @@
             default:
                 throw new IllegalStateException( "Unknown index into handler array: " + index
);
         }
+    }
+    
+    
+    /**
+     * Updates the schemaModifiersName and schemaModifyTimestamp attributes of
+     * the schemaModificationAttributes entry for the global schema at 
+     * ou=schema,cn=schemaModifications.  This entry is hardcoded at that 
+     * position for now.
+     * 
+     * The current time is used to set the timestamp and the DN of current user
+     * is set for the modifiersName.
+     * 
+     * @throws NamingException if the update fails
+     */
+    private void updateSchemaModificationAttributes() throws NamingException
+    {
+        Invocation invocation = InvocationStack.getInstance().peek();
+        ServerLdapContext ctx = ( ServerLdapContext ) invocation.getCaller();
+        String modifiersName = ctx.getPrincipal().getJndiName().getNormName();
+        String modifyTimestamp = DateUtils.getGeneralizedTime();
+        
+        ModificationItemImpl[] mods = new ModificationItemImpl[2];
+        mods[0] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, 
+            new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT, modifyTimestamp
) );
+        mods[1] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE,
+            new AttributeImpl( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT, modifiersName
) );
+        LdapDN name = new LdapDN( "cn=schemaModifications,ou=schema" );
+        name.normalize( globalRegistries.getAttributeTypeRegistry().getNormalizerMapping()
);
+        invocation.getProxy().modify( name, mods, SCHEMA_MODIFICATION_ATTRIBUTES_UPDATE_BYPASS
);
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaService.java
Mon Feb 26 13:54:51 2007
@@ -40,6 +40,8 @@
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
+import org.apache.directory.server.constants.ApacheSchemaConstants;
+import org.apache.directory.server.constants.SystemSchemaConstants;
 import org.apache.directory.server.core.DirectoryServiceConfiguration;
 import org.apache.directory.server.core.configuration.InterceptorConfiguration;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
@@ -82,7 +84,6 @@
 import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
 import org.apache.directory.shared.ldap.schema.syntax.SyntaxCheckerDescription;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
-import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.directory.shared.ldap.util.EmptyEnumeration;
 import org.apache.directory.shared.ldap.util.SingletonEnumeration;
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -135,9 +136,9 @@
     private LdapDN subschemaSubentryDn;
 
     /**
-     * The time when the server started up.
+     * the normalized name for the schema modification attributes
      */
-    private String startUpTimeStamp;
+    private LdapDN schemaModificationAttributesDN;
 
     private SchemaManager schemaManager;
     
@@ -156,15 +157,7 @@
     /** A map used to store all the objectClasses allowed attributes (may + must) */
     private Map<String, List<AttributeType>> allowed;
 
-    /**
-     * Creates a schema service interceptor.
-     */
-    public SchemaService()
-    {
-        startUpTimeStamp = DateUtils.getGeneralizedTime();
-    }
 
-    
     /**
      * Initialize the Schema Service
      * 
@@ -198,6 +191,9 @@
         subschemaSubentryDn = new LdapDN( subschemaSubentry );
         subschemaSubentryDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
 
+        schemaModificationAttributesDN = new LdapDN( "cn=schemaModifications,ou=schema" );
+        schemaModificationAttributesDN.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
+        
         computeSuperiors();
 
         if ( IS_DEBUG )
@@ -206,6 +202,7 @@
         }
     }
 
+    
     /**
      * Compute the MUST attributes for an objectClass. This method gather all the
      * MUST from all the objectClass and its superors.
@@ -705,38 +702,7 @@
             attr = new AttributeImpl( "subtreeSpecification", "{}" );
             attrs.put( attr );
         }
-
-        // timeestamps are hacks for now until the schema is actually updateable these
-        // use the servers startup time stamp for both modify and create timestamps
-
-        if ( returnAllOperationalAttributes || set.contains( "createtimestamp" ) )
-        {
-            attr = new AttributeImpl( "createTimestamp" );
-            attr.add( startUpTimeStamp );
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || set.contains( "modifytimestamp" ) )
-        {
-            attr = new AttributeImpl( "modifyTimestamp" );
-            attr.add( startUpTimeStamp );
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || set.contains( "creatorsname" ) )
-        {
-            attr = new AttributeImpl( "creatorsName" );
-            attr.add( PartitionNexus.ADMIN_PRINCIPAL );
-            attrs.put( attr );
-        }
-
-        if ( returnAllOperationalAttributes || set.contains( "modifiersname" ) )
-        {
-            attr = new AttributeImpl( "modifiersName" );
-            attr.add( PartitionNexus.ADMIN_PRINCIPAL );
-            attrs.put( attr );
-        }
-
+        
         int minSetSize = 0;
         
         if ( set.contains( "+" ) )
@@ -771,10 +737,58 @@
             attrs.put( "cn", "schema" );
         }
 
+        // -------------------------------------------------------------------
+        // set operational attributes for the subentry 
+        // -------------------------------------------------------------------
+
+        // look up cn=schemaModifications,ou=schema and get values for the 
+        // modifiers and creators operational information
+
+        Attributes modificationAttributes = nexus.lookup( schemaModificationAttributesDN
);
+        
+        if ( returnAllOperationalAttributes || set.contains( "createtimestamp" ) )
+        {
+            attr = new AttributeImpl( "createTimestamp" );
+            AttributeType createTimestampAT = registries.
+                getAttributeTypeRegistry().lookup( SystemSchemaConstants.CREATE_TIMESTAMP_AT
);
+            Attribute createTimestamp = AttributeUtils.getAttribute( modificationAttributes,
createTimestampAT );
+            attr.add( createTimestamp.get() );
+            attrs.put( attr );
+        }
+
+        if ( returnAllOperationalAttributes || set.contains( "creatorsname" ) )
+        {
+            attr = new AttributeImpl( "creatorsName" );
+            attr.add( PartitionNexus.ADMIN_PRINCIPAL );
+            attrs.put( attr );
+        }
+        
+        if ( returnAllOperationalAttributes || set.contains( "modifytimestamp" ) )
+        {
+            attr = new AttributeImpl( "modifyTimestamp" );
+            AttributeType schemaModifyTimestampAT = registries.
+                getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFY_TIMESTAMP_AT
);
+            Attribute schemaModifyTimestamp = 
+                AttributeUtils.getAttribute( modificationAttributes, schemaModifyTimestampAT
);
+            attr.add( schemaModifyTimestamp.get() );
+            attrs.put( attr );
+        }
+
+        if ( returnAllOperationalAttributes || set.contains( "modifiersname" ) )
+        {
+            attr = new AttributeImpl( "modifiersName" );
+            AttributeType schemaModifiersNameAT = registries.
+                getAttributeTypeRegistry().lookup( ApacheSchemaConstants.SCHEMA_MODIFIERS_NAME_AT
);
+            Attribute schemaModifiersName = 
+                AttributeUtils.getAttribute( modificationAttributes, schemaModifiersNameAT
);
+            attr.add( schemaModifiersName.get() );
+            attrs.put( attr );
+        }
+        
         return attrs;
     }
 
-
+    
     /**
      * Search for an entry, using its DN. Binary attributes and ObjectClass attribute are
removed.
      */

Modified: directory/apacheds/trunk/schema-bootstrap/src/main/schema/apache.schema
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/schema-bootstrap/src/main/schema/apache.schema?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/schema-bootstrap/src/main/schema/apache.schema (original)
+++ directory/apacheds/trunk/schema-bootstrap/src/main/schema/apache.schema Mon Feb 26 13:54:51
2007
@@ -335,3 +335,34 @@
 # END Schema Subentry Related
 # ===========================
 
+# =============================================
+# Schema Subentry Modification Attribute Schema 
+# =============================================
+
+#         | 1.3.6.1.4.1.18060.0.4.1.2.35 | schemaModifyTimestamp       |
+#         | 1.3.6.1.4.1.18060.0.4.1.2.36 | schemaModifiersName         |
+#         | 1.3.6.1.4.1.18060.0.4.1.2.37 | subschemaSubentryName       |
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.35 NAME 'schemaModifyTimestamp'
+    DESC 'time which schema was modified'
+    SUP modifyTimestamp )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.36 NAME 'schemaModifiersName'
+    DESC 'the DN of the modifier of the schema'
+    SUP modifiersName )
+
+attributetype ( 1.3.6.1.4.1.18060.0.4.1.2.37 NAME 'subschemaSubentryName'
+    DESC 'the DN of the schema subentry the modification info corresponds to'
+    EQUALITY distinguishedNameMatch
+    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{32768} )
+
+objectclass ( 1.3.6.1.4.1.18060.0.4.1.3.10 NAME 'schemaModificationAttributes'
+        DESC 'a special entry tracking schema modification attributes'
+        SUP top STRUCTURAL
+        MUST ( cn $ subschemaSubentryName $ 
+               schemaModifyTimestamp $ schemaModifiersName ) )
+
+# =================================================
+# END Schema Subentry Modification Attribute Schema 
+# =================================================
+

Modified: directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java?view=diff&rev=512027&r1=512026&r2=512027
==============================================================================
--- directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java
(original)
+++ directory/apacheds/trunk/utils/src/main/java/org/apache/directory/server/utils/AttributesFactory.java
Mon Feb 26 13:54:51 2007
@@ -99,7 +99,7 @@
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_SCHEMA_OC
);
         entry.put( SystemSchemaConstants.CN_AT, schema.getSchemaName() );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         
         if ( schema.isDisabled() )
         {
@@ -128,7 +128,7 @@
         entry.put( MetaSchemaConstants.M_OID_AT, syntaxChecker.getSyntaxOid() );
         entry.put( MetaSchemaConstants.M_FQCN_AT, syntaxChecker.getClass().getName() );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         return entry;
     }
 
@@ -139,7 +139,7 @@
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_SYNTAX_OC
);
         entry.put( MetaSchemaConstants.X_HUMAN_READIBLE_AT, getBoolean( syntax.isHumanReadible()
) );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         injectCommon( syntax, entry );
         return entry;
     }
@@ -152,7 +152,7 @@
         entry.put( MetaSchemaConstants.M_OID_AT, oid );
         entry.put( MetaSchemaConstants.M_FQCN_AT, normalizer.getClass().getName() );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         return entry;
     }
 
@@ -164,7 +164,7 @@
         entry.put( MetaSchemaConstants.M_OID_AT, oid );
         entry.put( MetaSchemaConstants.M_FQCN_AT, comparator.getClass().getName() );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         return entry;
     }
 
@@ -181,7 +181,7 @@
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_MATCHING_RULE_OC
);
         entry.put( MetaSchemaConstants.M_SYNTAX_AT, matchingRule.getSyntax().getOid() );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         injectCommon( matchingRule, entry );
         return entry;
     }
@@ -192,7 +192,7 @@
         Attributes entry = new AttributesImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top",
true );
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         return entry;
     }
 
@@ -202,7 +202,7 @@
         Attributes entry = new AttributesImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top",
true );
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         return entry;
     }
 
@@ -212,7 +212,7 @@
         Attributes entry = new AttributesImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top",
true );
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         return entry;
     }
 
@@ -222,7 +222,7 @@
         Attributes entry = new AttributesImpl( SystemSchemaConstants.OBJECT_CLASS_AT, "top",
true );
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( "" );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         return entry;
     }
 
@@ -255,7 +255,7 @@
         entry.put( MetaSchemaConstants.M_SINGLE_VALUE_AT, getBoolean( attributeType.isSingleValue()
) );
         entry.put( MetaSchemaConstants.M_USAGE_AT, attributeType.getUsage().toString() );
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
 
         injectCommon( attributeType, entry );
         
@@ -336,7 +336,7 @@
         entry.get( SystemSchemaConstants.OBJECT_CLASS_AT ).add( MetaSchemaConstants.META_OBJECT_CLASS_OC
);
         entry.put( MetaSchemaConstants.M_TYPE_OBJECT_CLASS_AT, objectClass.getType().toString()
);
         entry.put( SystemSchemaConstants.CREATORS_NAME_AT, schema.getOwner() );
-        entry.put( SystemSchemaConstants.CREAT_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
+        entry.put( SystemSchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime()
);
         
         injectCommon( objectClass, entry );
 



Mime
View raw message