directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r819902 - in /directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema: ./ registries/synchronizers/
Date Tue, 29 Sep 2009 12:23:27 GMT
Author: elecharny
Date: Tue Sep 29 12:23:26 2009
New Revision: 819902

URL: http://svn.apache.org/viewvc?rev=819902&view=rev
Log:
Removed two useless methods

Modified:
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizer.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
    directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java?rev=819902&r1=819901&r2=819902&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDaoImpl.java
Tue Sep 29 12:23:26 2009
@@ -27,6 +27,9 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.naming.NamingException;
+import javax.naming.directory.SearchControls;
+
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
@@ -36,7 +39,6 @@
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.Partition;
-import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -60,15 +62,13 @@
 import org.apache.directory.shared.ldap.schema.ObjectClass;
 import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
+import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.schema.syntaxCheckers.NumericOidSyntaxChecker;
 import org.apache.directory.shared.ldap.util.DateUtils;
 import org.apache.directory.shared.schema.loader.ldif.SchemaEntityFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.NamingException;
-import javax.naming.directory.SearchControls;
-
 
 /**
  * A specialized data access object for managing schema objects in the
@@ -565,6 +565,7 @@
         }
 
         boolean isDisabled = disabledAttr.contains( "TRUE" );
+        
         if ( !isDisabled )
         {
             LOG.warn( "Does not make sense: you're trying to enable {} schema which is already
enabled", schemaName );

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizer.java?rev=819902&r1=819901&r2=819902&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizer.java
Tue Sep 29 12:23:26 2009
@@ -24,7 +24,6 @@
 
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
 
@@ -74,9 +73,6 @@
      */
     void rename( ServerEntry entry, Rdn newRdn, boolean cascaded ) throws Exception;
     
-    boolean modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry
entry, ServerEntry targetEntry, boolean cascaded ) 
-        throws Exception;
-    
     boolean modify( LdapDN name, List<Modification> mods, ServerEntry entry, ServerEntry
targetEntry, boolean cascaded )
         throws Exception;
     

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java?rev=819902&r1=819901&r2=819902&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/RegistrySynchronizerAdaptor.java
Tue Sep 29 12:23:26 2009
@@ -40,7 +40,6 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
 import org.apache.directory.shared.ldap.entry.Modification;
-import org.apache.directory.shared.ldap.entry.ModificationOperation;
 import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.exception.LdapInvalidNameException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
@@ -256,36 +255,6 @@
     
 
     /* (non-Javadoc)
-     * @see org.apache.directory.server.core.schema.SchemaChangeManager#modify(org.apache.directory.server.core.interceptor.context.ModifyOperationContext,
org.apache.directory.shared.ldap.entry.ModificationOperation, org.apache.directory.server.core.entry.ServerEntry,
org.apache.directory.server.core.entry.ServerEntry, org.apache.directory.server.core.entry.ServerEntry,
boolean)
-     */
-    public void modify( ModifyOperationContext opContext, ModificationOperation modOp, ServerEntry
mods, 
-        ServerEntry entry, ServerEntry targetEntry, boolean cascade ) throws Exception
-    {
-        EntryAttribute oc = entry.get( objectClassAT );
-        
-        for ( Value<?> value:oc )
-        {
-            String oid = registries.getObjectClassRegistry().getOidByName( value.getString()
);
-            
-            if ( objectClass2synchronizerMap.containsKey( oid ) )
-            {
-                RegistrySynchronizer synchronizer = objectClass2synchronizerMap.get( oid
);
-                synchronizer.modify( opContext.getDn(), modOp, mods, entry, targetEntry,
cascade );
-                return;
-            }
-        }
-
-        if ( oc.contains( MetaSchemaConstants.META_SCHEMA_OC ) )
-        {
-            schemaSynchronizer.modify( opContext.getDn(), modOp, mods, entry, targetEntry,
cascade );
-            return;
-        }
-        
-        throw new LdapOperationNotSupportedException( ResultCodeEnum.UNWILLING_TO_PERFORM
);
-    }
-
-
-    /* (non-Javadoc)
      * @see org.apache.directory.server.core.schema.SchemaChangeManager#modify(org.apache.directory.server.core.interceptor.context.ModifyOperationContext,
org.apache.directory.server.core.entry.ServerEntry, org.apache.directory.server.core.entry.ServerEntry,
boolean)
      */
     public void modify( ModifyOperationContext opContext, ServerEntry entry, 

Modified: directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java?rev=819902&r1=819901&r2=819902&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
(original)
+++ directory/apacheds/branches/apacheds-schema/core-api/src/main/java/org/apache/directory/server/core/schema/registries/synchronizers/SchemaSynchronizer.java
Tue Sep 29 12:23:26 2009
@@ -28,9 +28,11 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.server.constants.ServerDNConstants;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerModification;
 import org.apache.directory.server.core.schema.PartitionSchemaLoader;
 import org.apache.directory.shared.ldap.constants.MetaSchemaConstants;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -46,6 +48,7 @@
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.SchemaObject;
 import org.apache.directory.shared.ldap.schema.SchemaWrapper;
+import org.apache.directory.shared.ldap.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.schema.registries.Registries;
 import org.apache.directory.shared.ldap.schema.registries.Schema;
 import org.apache.directory.shared.ldap.schema.registries.SchemaObjectRegistry;
@@ -113,52 +116,6 @@
      * m-dependencies attributes.
      * 
      * @param name the dn of the metaSchema object modified
-     * @param modOp the type of modification operation being performed
-     * @param mods the attribute modifications as an Attributes object
-     * @param entry the entry after the modifications have been applied
-     */
-    public boolean modify( LdapDN name, ModificationOperation modOp, ServerEntry mods, ServerEntry
entry, 
-        ServerEntry targetEntry, boolean cascade ) throws Exception
-    {
-        boolean hasModification = SCHEMA_UNCHANGED;
-
-        EntryAttribute disabledInMods = mods.get( disabledAT );
-        
-        if ( disabledInMods != null )
-        {
-            disable( name, modOp, disabledInMods, entry.get( disabledAT ) );
-        }
-        
-        // check if the new schema is enabled or disabled
-        boolean isEnabled = false;
-        EntryAttribute disabled = targetEntry.get( this.disabledAT );
-        
-        if ( disabled == null )
-        {
-            isEnabled = true;
-        }
-        else if ( ! disabled.getString().equals( "TRUE" ) )
-        {
-            isEnabled = true;
-        }
-
-        EntryAttribute dependencies = mods.get( dependenciesAT );
-        
-        if ( dependencies != null )
-        {
-            checkForDependencies( isEnabled, targetEntry );
-        }
-        
-        return hasModification;
-    }
-
-
-    /**
-     * Reacts to modification of a metaSchema object.  At this point the 
-     * only considerable changes are to the m-disabled and the 
-     * m-dependencies attributes.
-     * 
-     * @param name the dn of the metaSchema object modified
      * @param mods the attribute modifications as an ModificationItem arry
      * @param entry the entry after the modifications have been applied
      */
@@ -530,6 +487,10 @@
         
         schema.disable();
         
+        // Use brute force right now : iterate through all the schemaObjects
+        // searching for those associated with the disabled schema
+        disableAT( schemaName );
+        
         Set<SchemaWrapper> content = registries.getLoadedSchema( schemaName ).getContent();

 
         for ( SchemaWrapper schemaWrapper : content )
@@ -541,6 +502,27 @@
         
         return SCHEMA_MODIFIED;
     }
+    
+    
+    private void disableAT( String schemaName )
+    {
+        AttributeTypeRegistry atRegistry = registries.getAttributeTypeRegistry();
+        
+        for ( AttributeType attributeType : atRegistry )
+        {
+            if ( schemaName.equalsIgnoreCase( attributeType.getSchemaName() ) )
+            {
+                if ( attributeType.isDisabled() )
+                {
+                    continue;
+                }
+                
+                EntryAttribute disable = new DefaultServerAttribute( disabledAT, "TRUE" 
);
+                Modification modification = 
+                    new ServerModification( ModificationOperation.REPLACE_ATTRIBUTE, disable
);
+            }
+        }
+    }
 
 
     /**



Mime
View raw message