directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r581861 [2/2] - in /directory/apacheds/branches/bigbang: bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ core-unit/src/test/java/org/apache/directory/server/core/authz/ core-unit/src/test/java/org/apache/di...
Date Thu, 04 Oct 2007 11:45:56 GMT
Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
Thu Oct  4 04:45:53 2007
@@ -31,6 +31,7 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.Control;
@@ -71,6 +72,7 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
 import org.apache.directory.shared.ldap.subtree.SubtreeSpecificationParser;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
@@ -140,7 +142,7 @@
         
         ssParser = new SubtreeSpecificationParser( new NormalizerMappingResolver()
         {
-            public Map getNormalizerMapping() throws NamingException
+            public Map<String, OidNormalizer> getNormalizerMapping() throws NamingException
             {
                 return attrRegistry.getNormalizerMapping();
             }
@@ -148,7 +150,7 @@
         evaluator = new SubtreeEvaluator( factoryCfg.getRegistries().getOidRegistry(), factoryCfg.getRegistries().getAttributeTypeRegistry()
);
 
         // prepare to find all subentries in all namingContexts
-        Iterator suffixes = this.nexus.listSuffixes( null );
+        Iterator<String> suffixes = this.nexus.listSuffixes( null );
         ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC
);
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
@@ -157,14 +159,15 @@
         // search each namingContext for subentries
         while ( suffixes.hasNext() )
         {
-            LdapDN suffix = new LdapDN( ( String ) suffixes.next() );
+            LdapDN suffix = new LdapDN( suffixes.next() );
             //suffix = LdapDN.normalize( suffix, registry.getNormalizerMapping() );
             suffix.normalize( attrRegistry.getNormalizerMapping() );
-            NamingEnumeration subentries = nexus.search( 
+            NamingEnumeration<SearchResult> subentries = nexus.search( 
                 new SearchOperationContext( suffix, factoryCfg.getEnvironment(), filter,
controls ) );
+            
             while ( subentries.hasMore() )
             {
-                SearchResult result = ( SearchResult ) subentries.next();
+                SearchResult result = subentries.next();
                 Attributes subentry = result.getAttributes();
                 String dn = result.getName();
                 String subtree = ( String ) subentry.get( SchemaConstants.SUBTREE_SPECIFICATION_AT
).get();
@@ -316,10 +319,11 @@
     public Attributes getSubentryAttributes( Name dn, Attributes entryAttrs ) throws NamingException
     {
         Attributes subentryAttrs = new AttributesImpl();
-        Iterator list = subentryCache.nameIterator();
+        Iterator<String> list = subentryCache.nameIterator();
+        
         while ( list.hasNext() )
         {
-            String subentryDnStr = ( String ) list.next();
+            String subentryDnStr = list.next();
             LdapDN subentryDn = new LdapDN( subentryDnStr );
             LdapDN apDn = ( LdapDN ) subentryDn.clone();
             apDn.remove( apDn.size() - 1 );
@@ -454,13 +458,13 @@
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
 
-            NamingEnumeration subentries = 
+            NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
                     new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter,
controls ) );
 
             while ( subentries.hasMore() )
             {
-                SearchResult result = ( SearchResult ) subentries.next();
+                SearchResult result = subentries.next();
                 Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -473,11 +477,11 @@
         }
         else
         {
-            Iterator list = subentryCache.nameIterator();
+            Iterator<String> list = subentryCache.nameIterator();
             
             while ( list.hasNext() )
             {
-                String subentryDnStr = ( String ) list.next();
+                String subentryDnStr = list.next();
                 LdapDN subentryDn = new LdapDN( subentryDnStr );
                 LdapDN apDn = ( LdapDN ) subentryDn.clone();
                 apDn.remove( apDn.size() - 1 );
@@ -581,13 +585,13 @@
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
 
-            NamingEnumeration subentries = 
+            NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
                     new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter,
controls ) );
             
             while ( subentries.hasMore() )
             {
-                SearchResult result = ( SearchResult ) subentries.next();
+                SearchResult result = subentries.next();
                 Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -623,9 +627,10 @@
         ExprNode filter = new PresenceNode( "administrativeRole" );
         SearchControls controls = new SearchControls();
         controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        NamingEnumeration aps = 
+        NamingEnumeration<SearchResult> aps = 
             nexus.search( 
                 new SearchOperationContext( name, factoryCfg.getEnvironment(), filter, controls
) );
+
         if ( aps.hasMore() )
         {
             aps.close();
@@ -636,10 +641,10 @@
     }
 
 
-    private ModificationItemImpl[] getModsOnEntryRdnChange( Name oldName, Name newName, Attributes
entry )
+    private List<ModificationItem> getModsOnEntryRdnChange( Name oldName, Name newName,
Attributes entry )
         throws NamingException
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<ModificationItem> modList = new ArrayList<ModificationItem>();
 
         /*
          * There are two different situations warranting action.  Firt if
@@ -654,10 +659,11 @@
          * would be caused by chop exclusions. In this case we must add subentry
          * operational attribute values with the dn of this subentry.
          */
-        Iterator subentries = subentryCache.nameIterator();
+        Iterator<String> subentries = subentryCache.nameIterator();
+        
         while ( subentries.hasNext() )
         {
-            String subentryDn = ( String ) subentries.next();
+            String subentryDn = subentries.next();
             Name apDn = new LdapDN( subentryDn );
             apDn.remove( apDn.size() - 1 );
             SubtreeSpecification ss = subentryCache.getSubentry( subentryDn ).getSubtreeSpecification();
@@ -676,6 +682,7 @@
                 {
                     int op = DirContext.REPLACE_ATTRIBUTE;
                     Attribute opAttr = entry.get( SUBENTRY_OPATTRS[ii] );
+                    
                     if ( opAttr != null )
                     {
                         opAttr = ( Attribute ) opAttr.clone();
@@ -703,9 +710,7 @@
             }
         }
 
-        ModificationItemImpl[] mods = new ModificationItemImpl[modList.size()];
-        mods = modList.toArray( mods );
-        return mods;
+        return modList;
     }
 
 
@@ -742,13 +747,13 @@
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES,
SchemaConstants.ALL_USER_ATTRIBUTES } );
-            NamingEnumeration subentries = 
+            NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
                     new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter,
controls ) );
             
             while ( subentries.hasMore() )
             {
-                SearchResult result = ( SearchResult ) subentries.next();
+                SearchResult result = subentries.next();
                 Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -776,9 +781,9 @@
             newName.remove( newName.size() - 1 );
             newName.add( newRdn );
             newName.normalize( attrRegistry.getNormalizerMapping() );
-            ModificationItemImpl[] mods = getModsOnEntryRdnChange( name, newName, entry );
+            List<ModificationItem> mods = getModsOnEntryRdnChange( name, newName, entry
);
 
-            if ( mods.length > 0 )
+            if ( mods.size() > 0 )
             {
                 nexus.modify( new ModifyOperationContext( newName, mods ) );
             }
@@ -823,13 +828,13 @@
             SearchControls controls = new SearchControls();
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[] { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES,
SchemaConstants.ALL_USER_ATTRIBUTES } );
-            NamingEnumeration subentries = 
+            NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
                     new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter,
controls ) );
             
             while ( subentries.hasMore() )
             {
-                SearchResult result = ( SearchResult ) subentries.next();
+                SearchResult result = subentries.next();
                 Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -857,9 +862,9 @@
             LdapDN newName = ( LdapDN ) parent.clone();
             newName.add( newRn );
             newName.normalize( attrRegistry.getNormalizerMapping() );
-            ModificationItemImpl[] mods = getModsOnEntryRdnChange( oriChildName, newName,
entry );
+            List<ModificationItem> mods = getModsOnEntryRdnChange( oriChildName, newName,
entry );
 
-            if ( mods.length > 0 )
+            if ( mods.size() > 0 )
             {
                 nexus.modify( new ModifyOperationContext( newName, mods ) );
             }
@@ -898,13 +903,13 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            NamingEnumeration subentries = 
+            NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
                     new SearchOperationContext( baseDn, factoryCfg.getEnvironment(), filter,
controls ) );
             
             while ( subentries.hasMore() )
             {
-                SearchResult result = ( SearchResult ) subentries.next();
+                SearchResult result = subentries.next();
                 Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -931,9 +936,9 @@
             // attributes contained within this regular entry with name changes
             LdapDN newName = ( LdapDN ) newParentName.clone();
             newName.add( oriChildName.get( oriChildName.size() - 1 ) );
-            ModificationItemImpl[] mods = getModsOnEntryRdnChange( oriChildName, newName,
entry );
+            List<ModificationItem> mods = getModsOnEntryRdnChange( oriChildName, newName,
entry );
 
-            if ( mods.length > 0 )
+            if ( mods.size() > 0 )
             {
                 nexus.modify( new ModifyOperationContext( newName, mods ) );
             }
@@ -946,29 +951,34 @@
     // -----------------------------------------------------------------------
 
     
-    private int getSubentryTypes( Attributes entry, ModificationItemImpl[] mods ) throws
NamingException
+    private int getSubentryTypes( Attributes entry, List<ModificationItem> mods ) throws
NamingException
     {
         Attribute ocFinalState = ( Attribute ) entry.get( SchemaConstants.OBJECT_CLASS_AT
).clone();
-        for ( int ii = 0; ii < mods.length; ii++ )
+        
+        for ( ModificationItem mod:mods )
         {
-            if ( mods[ii].getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT
) )
+            if ( mod.getAttribute().getID().equalsIgnoreCase( SchemaConstants.OBJECT_CLASS_AT
) )
             {
-                switch ( mods[ii].getModificationOp() )
+                switch ( mod.getModificationOp() )
                 {
                     case( DirContext.ADD_ATTRIBUTE ):
-                        for ( int jj = 0; jj < mods[ii].getAttribute().size(); jj++ )
+                        for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
                         {
-                            ocFinalState.add( mods[ii].getAttribute().get( jj ) );
+                            ocFinalState.add( mod.getAttribute().get( jj ) );
                         }
+                    
                         break;
+                        
                     case( DirContext.REMOVE_ATTRIBUTE ):
-                        for ( int jj = 0; jj < mods[ii].getAttribute().size(); jj++ )
+                        for ( int jj = 0; jj < mod.getAttribute().size(); jj++ )
                         {
-                            ocFinalState.remove( mods[ii].getAttribute().get( jj ) );
+                            ocFinalState.remove( mod.getAttribute().get( jj ) );
                         }
+                    
                         break;
+                        
                     case( DirContext.REPLACE_ATTRIBUTE ):
-                        ocFinalState = mods[ii].getAttribute();
+                        ocFinalState = mod.getAttribute();
                         break;
                 }
             }
@@ -982,20 +992,20 @@
     public void modify( NextInterceptor next, ModifyOperationContext opContext ) throws NamingException
     {
         LdapDN name = opContext.getDn();
-        ModificationItemImpl[] mods = opContext.getModItems();
+        List<ModificationItem> mods = opContext.getModItems();
         
         Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
         Attributes oldEntry = (Attributes) entry.clone();
         Attribute objectClasses = AttributeUtils.getAttribute( entry, objectClassType );
         boolean isSubtreeSpecificationModification = false;
-        ModificationItemImpl subtreeMod = null;
+        ModificationItem subtreeMod = null;
 
-        for ( int ii = 0; ii < mods.length; ii++ )
+        for ( ModificationItem mod:mods )
         {
-            if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mods[ii].getAttribute().getID()
) )
+            if ( SchemaConstants.SUBTREE_SPECIFICATION_AT.equalsIgnoreCase( mod.getAttribute().getID()
) )
             {
                 isSubtreeSpecificationModification = true;
-                subtreeMod = mods[ii];
+                subtreeMod = mod;
             }
         }
 
@@ -1028,13 +1038,13 @@
             controls.setSearchScope( SearchControls.SUBTREE_SCOPE );
             controls.setReturningAttributes( new String[]
                 { SchemaConstants.ALL_OPERATIONAL_ATTRIBUTES, SchemaConstants.ALL_USER_ATTRIBUTES
} );
-            NamingEnumeration subentries = 
+            NamingEnumeration<SearchResult> subentries = 
                 nexus.search( 
                     new SearchOperationContext( oldBaseDn, factoryCfg.getEnvironment(), filter,
controls ) );
             
             while ( subentries.hasMore() )
             {
-                SearchResult result = ( SearchResult ) subentries.next();
+                SearchResult result = subentries.next();
                 Attributes candidate = result.getAttributes();
                 LdapDN dn = new LdapDN( result.getName() );
                 dn.normalize( attrRegistry.getNormalizerMapping() );
@@ -1073,9 +1083,9 @@
             {
 	            Attributes newEntry = nexus.lookup( new LookupOperationContext( name ) );
 	            
-	            ModificationItemImpl[] subentriesOpAttrMods =  getModsOnEntryModification( name,
oldEntry, newEntry );
+	            List<ModificationItem> subentriesOpAttrMods = getModsOnEntryModification(
name, oldEntry, newEntry );
                 
-	            if ( subentriesOpAttrMods.length > 0)
+	            if ( subentriesOpAttrMods.size() > 0)
 	            {
 	            	nexus.modify( new ModifyOperationContext( name, subentriesOpAttrMods ) );
 	            }
@@ -1088,16 +1098,17 @@
     // Utility Methods
     // -----------------------------------------------------------------------
 
-    private ModificationItemImpl[] getOperationalModsForReplace( Name oldName, Name newName,
Subentry subentry,
+    private List<ModificationItem> getOperationalModsForReplace( Name oldName, Name
newName, Subentry subentry,
         Attributes entry )
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<ModificationItem> modList = new ArrayList<ModificationItem>();
         
         Attribute operational;
 
         if ( subentry.isAccessControlSubentry() )
         {
             operational = ( Attribute ) entry.get( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT
).clone();
+            
             if ( operational == null )
             {
                 operational = new AttributeImpl( SchemaConstants.ACCESS_CONTROL_SUBENTRIES_AT
);
@@ -1108,11 +1119,14 @@
                 operational.remove( oldName.toString() );
                 operational.add( newName.toString() );
             }
+            
             modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational
) );
         }
+        
         if ( subentry.isSchemaSubentry() )
         {
             operational = ( Attribute ) entry.get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT
).clone();
+            
             if ( operational == null )
             {
                 operational = new AttributeImpl( SchemaConstants.SUBSCHEMA_SUBENTRY_AT );
@@ -1123,11 +1137,14 @@
                 operational.remove( oldName.toString() );
                 operational.add( newName.toString() );
             }
+            
             modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational
) );
         }
+        
         if ( subentry.isCollectiveSubentry() )
         {
             operational = ( Attribute ) entry.get( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT
).clone();
+           
             if ( operational == null )
             {
                 operational = new AttributeImpl( SchemaConstants.COLLECTIVE_ATTRIBUTE_SUBENTRIES_AT
);
@@ -1138,11 +1155,14 @@
                 operational.remove( oldName.toString() );
                 operational.add( newName.toString() );
             }
+            
             modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational
) );
         }
+        
         if ( subentry.isTriggerSubentry() )
         {
             operational = ( Attribute ) entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT
).clone();
+            
             if ( operational == null )
             {
                 operational = new AttributeImpl( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT
);
@@ -1153,11 +1173,11 @@
                 operational.remove( oldName.toString() );
                 operational.add( newName.toString() );
             }
+            
             modList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, operational
) );
         } 
 
-        ModificationItemImpl[] mods = new ModificationItemImpl[modList.size()];
-        return modList.toArray( mods );
+        return modList;
     }
 
 
@@ -1236,9 +1256,9 @@
      * @return the set of modifications required to remove an entry's reference to
      * a subentry
      */
-    private ModificationItemImpl[] getOperationalModsForRemove( LdapDN subentryDn, Attributes
candidate )
+    private List<ModificationItem> getOperationalModsForRemove( LdapDN subentryDn,
Attributes candidate )
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<ModificationItem> modList = new ArrayList<ModificationItem>();
         String dn = subentryDn.toNormName();
 
         for ( int ii = 0; ii < SUBENTRY_OPATTRS.length; ii++ )
@@ -1254,8 +1274,7 @@
             }
         }
 
-        ModificationItemImpl[] mods = new ModificationItemImpl[modList.size()];
-        return modList.toArray( mods );
+        return modList;
     }
 
 
@@ -1273,16 +1292,17 @@
      * of the subentry
      * @return the set of modifications needed to update the entry
      */
-    public ModificationItemImpl[] getOperationalModsForAdd( Attributes entry, Attributes
operational )
+    public List<ModificationItem> getOperationalModsForAdd( Attributes entry, Attributes
operational )
         throws NamingException
     {
-        List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+        List<ModificationItem> modList = new ArrayList<ModificationItem>();
 
-        NamingEnumeration opAttrIds = operational.getIDs();
+        NamingEnumeration<String> opAttrIds = operational.getIDs();
+        
         while ( opAttrIds.hasMore() )
         {
             int op = DirContext.REPLACE_ATTRIBUTE;
-            String opAttrId = ( String ) opAttrIds.next();
+            String opAttrId = opAttrIds.next();
             Attribute result = new AttributeImpl( opAttrId );
             Attribute opAttrAdditions = operational.get( opAttrId );
             Attribute opAttrInEntry = entry.get( opAttrId );
@@ -1307,9 +1327,7 @@
             modList.add( new ModificationItemImpl( op, result ) );
         }
 
-        ModificationItemImpl[] mods = new ModificationItemImpl[modList.size()];
-        mods = modList.toArray( mods );
-        return mods;
+        return modList;
     }
 
     /**
@@ -1433,15 +1451,16 @@
     }
     
     
-    private ModificationItemImpl[] getModsOnEntryModification( LdapDN name, Attributes oldEntry,
Attributes newEntry )
+    private List<ModificationItem> getModsOnEntryModification( LdapDN name, Attributes
oldEntry, Attributes newEntry )
     throws NamingException
 	{
-	    List<ModificationItemImpl> modList = new ArrayList<ModificationItemImpl>();
+	    List<ModificationItem> modList = new ArrayList<ModificationItem>();
 	
-	    Iterator subentries = subentryCache.nameIterator();
+	    Iterator<String> subentries = subentryCache.nameIterator();
+	    
 	    while ( subentries.hasNext() )
 	    {
-	        String subentryDn = ( String ) subentries.next();
+	        String subentryDn = subentries.next();
 	        Name apDn = new LdapDN( subentryDn );
 	        apDn.remove( apDn.size() - 1 );
 	        SubtreeSpecification ss = subentryCache.getSubentry( subentryDn ).getSubtreeSpecification();
@@ -1487,9 +1506,7 @@
 	        }
 	    }
 	
-	    ModificationItemImpl[] mods = new ModificationItemImpl[modList.size()];
-	    mods = modList.toArray( mods );
-	    return mods;
+	    return modList;
 	}
 
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/ModifyStoredProcedureParameterInjector.java
Thu Oct  4 04:45:53 2007
@@ -20,10 +20,13 @@
 
 package org.apache.directory.server.core.trigger;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -36,7 +39,7 @@
 public class ModifyStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
 {
     private LdapDN modifiedEntryName;
-    private ModificationItemImpl[] modifications;
+    private List<ModificationItem> modifications;
     private Attributes oldEntry;
     
     
@@ -66,7 +69,21 @@
     {
         public Object inject( StoredProcedureParameter param ) throws NamingException
         {
-            return modifications.clone();
+            List<ModificationItem> newMods = new ArrayList<ModificationItem>();
+            
+            try
+            {
+                for ( ModificationItem mod:modifications )
+                {
+                    newMods.add( (ModificationItemImpl)((ModificationItemImpl)mod).clone()
);
+                }
+            }
+            catch ( CloneNotSupportedException cnse )
+            {
+                // do nothing ...
+            }
+            
+            return newMods;
         }
     };
     

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerSpecCache.java
Thu Oct  4 04:45:53 2007
@@ -34,6 +34,7 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
+import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
@@ -46,9 +47,9 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.EqualityNode;
 import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.NormalizerMappingResolver;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecification;
 import org.apache.directory.shared.ldap.trigger.TriggerSpecificationParser;
 
@@ -91,26 +92,27 @@
         final AttributeTypeRegistry registry = dirServCfg.getRegistries().getAttributeTypeRegistry();
         triggerSpecParser = new TriggerSpecificationParser( new NormalizerMappingResolver()
             {
-                public Map getNormalizerMapping() throws NamingException
+                public Map<String, OidNormalizer> getNormalizerMapping() throws NamingException
                 {
                     return registry.getNormalizerMapping();
                 }
             });
-        Hashtable env = ( Hashtable ) dirServCfg.getEnvironment().clone();
+        
+        Hashtable<String, Object> env = ( Hashtable<String, Object> ) dirServCfg.getEnvironment().clone();
         initialize(registry, env);
     }
 
 
-    private void initialize(AttributeTypeRegistry registry, Hashtable env) throws NamingException
+    private void initialize(AttributeTypeRegistry registry, Hashtable<String, Object>
env) throws NamingException
     {
         // search all naming contexts for trigger subentenries
         // generate TriggerSpecification arrays for each subentry
         // add that subentry to the hash
-        Iterator suffixes = nexus.listSuffixes( null );
+        Iterator<String> suffixes = nexus.listSuffixes( null );
         
         while ( suffixes.hasNext() )
         {
-            String suffix = ( String ) suffixes.next();
+            String suffix = suffixes.next();
             LdapDN baseDn = new LdapDN( suffix );
             ExprNode filter = new EqualityNode( SchemaConstants.OBJECT_CLASS_AT, ApacheSchemaConstants.TRIGGER_EXECUTION_SUBENTRY_OC
);
             SearchControls ctls = new SearchControls();
@@ -206,13 +208,13 @@
         }
 
         LdapDN normName = opContext.getDn();
-        ModificationItemImpl[] mods = opContext.getModItems();
+        List<ModificationItem> mods = opContext.getModItems();
 
         boolean isTriggerSpecModified = false;
         
-        for ( int ii = 0; ii < mods.length; ii++ )
+        for ( ModificationItem mod:mods )
         {
-            isTriggerSpecModified |= mods[ii].getAttribute().contains( PRESCRIPTIVE_TRIGGER_ATTR
);
+            isTriggerSpecModified |= mod.getAttribute().contains( PRESCRIPTIVE_TRIGGER_ATTR
);
         }
         
         if ( isTriggerSpecModified )

Modified: directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
(original)
+++ directory/apacheds/branches/bigbang/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
Thu Oct  4 04:45:53 2007
@@ -35,7 +35,6 @@
 import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
@@ -50,6 +49,8 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
@@ -1514,12 +1515,12 @@
     }
 
 
-    public void modify( LdapDN dn, ModificationItemImpl[] mods ) throws NamingException
+    public void modify( LdapDN dn, List<ModificationItem> mods ) throws NamingException
     {
         Long id = getEntryId( dn.toString() );
         Attributes entry = master.get( id );
 
-        for ( ModificationItemImpl mod : mods )
+        for ( ModificationItem mod : mods )
         {
             Attribute attrMods = mod.getAttribute();
 
@@ -1855,12 +1856,12 @@
             dropAliasIndices( movedBaseId, movedBase );
         }
 
-        NamingEnumeration aliases = new IndexAssertionEnumeration( aliasIdx.listIndices(
movedBase.toString(), true ),
+        NamingEnumeration<IndexRecord> aliases = new IndexAssertionEnumeration( aliasIdx.listIndices(
movedBase.toString(), true ),
             isBaseDescendant );
         
         while ( aliases.hasMore() )
         {
-            IndexRecord entry = ( IndexRecord ) aliases.next();
+            IndexRecord entry = aliases.next();
             dropAliasIndices( (Long)entry.getEntryId(), movedBase );
         }
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
Thu Oct  4 04:45:53 2007
@@ -20,15 +20,17 @@
 package org.apache.directory.mitosis.operation;
 
 
+import java.util.List;
+
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 
@@ -64,7 +66,7 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attrs, DirContext.ADD_ATTRIBUTE
);
+        List<ModificationItem> items = ModifyOperationContext.createModItems( attrs,
DirContext.ADD_ATTRIBUTE );
         nexus.modify( new ModifyOperationContext( getName(), items ) );
     }
 }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
Thu Oct  4 04:45:53 2007
@@ -20,15 +20,17 @@
 package org.apache.directory.mitosis.operation;
 
 
+import java.util.List;
+
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 
@@ -64,7 +66,7 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attrs, DirContext.REMOVE_ATTRIBUTE
);
+        List<ModificationItem> items = ModifyOperationContext.createModItems( attrs,
DirContext.REMOVE_ATTRIBUTE );
 
         nexus.modify( new ModifyOperationContext( getName(), items ) );
     }

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
Thu Oct  4 04:45:53 2007
@@ -20,6 +20,7 @@
 package org.apache.directory.mitosis.operation;
 
 
+import java.util.List;
 import java.util.Map;
 
 import javax.naming.NameAlreadyBoundException;
@@ -28,6 +29,7 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
@@ -48,7 +50,6 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
 
@@ -163,17 +164,15 @@
      */
     public Operation newModify( ModifyOperationContext opContext )
     {
-        ModificationItemImpl[] items = opContext.getModItems();
+        List<ModificationItem> items = opContext.getModItems();
         LdapDN normalizedName = opContext.getDn();
 
         CSN csn = newCSN();
         CompositeOperation result = new CompositeOperation( csn );
-        int length = items.length;
         
         // Transform into multiple {@link AttributeOperation}s.
-        for ( int i = 0; i < length; i++ )
+        for ( ModificationItem item:items )
         {
-            ModificationItemImpl item = items[i];
             result.add( newModify( csn, normalizedName, item.getModificationOp(), item.getAttribute()
) );
         }
 
@@ -250,12 +249,12 @@
         // Retrieve all subtree including the base entry
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        NamingEnumeration e = nexus.search( 
+        NamingEnumeration<SearchResult> e = nexus.search( 
             new SearchOperationContext( oldName, environment, new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID
), ctrl ) );
 
         while ( e.hasMore() )
         {
-            SearchResult sr = ( SearchResult ) e.next();
+            SearchResult sr = e.next();
 
             // Get the name of the old entry
             LdapDN oldEntryName = new LdapDN( sr.getName() );

Modified: directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java?rev=581861&r1=581860&r2=581861&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
(original)
+++ directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
Thu Oct  4 04:45:53 2007
@@ -20,15 +20,17 @@
 package org.apache.directory.mitosis.operation;
 
 
+import java.util.List;
+
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
 
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
-import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 
@@ -64,7 +66,7 @@
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
-        ModificationItemImpl[] items = ModifyOperationContext.createModItems( attrs, DirContext.REPLACE_ATTRIBUTE
);
+        List<ModificationItem> items = ModifyOperationContext.createModItems( attrs,
DirContext.REPLACE_ATTRIBUTE );
 
         nexus.modify( new ModifyOperationContext( getName(), items ) );
     }



Mime
View raw message