directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r613128 [3/3] - in /directory/apacheds/branches/bigbang: core-entry/src/main/java/org/apache/directory/server/core/entry/ core-integ/src/test/java/org/apache/directory/server/core/trigger/ core/src/main/java/org/apache/directory/server/core...
Date Fri, 18 Jan 2008 10:48:08 GMT
Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/BackupUtilitiesSP.java
Fri Jan 18 02:48:01 2008
@@ -19,11 +19,12 @@
  */
 package org.apache.directory.server.core.trigger;
 
-import javax.naming.Name;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -33,14 +34,14 @@
     private static final Logger LOG = LoggerFactory.getLogger( BackupUtilitiesSP.class );
 
 
-    public static void backupDeleted( LdapContext ctx, Name deletedEntryName,
-                                      Name operationPrincipal, Attributes deletedEntry )
throws NamingException
+    public static void backupDeleted( LdapContext ctx, LdapDN deletedEntryName,
+                                      LdapDN operationPrincipal, ServerEntry deletedEntry
) throws NamingException
     {
         LOG.info( "User \"" + operationPrincipal + "\" has deleted entry \"" + deletedEntryName
+ "\"" );
         LOG.info( "Entry content was: " + deletedEntry );
         LdapContext backupCtx = ( LdapContext ) ctx.lookup( "ou=backupContext,ou=system"
);
         String deletedEntryRdn = deletedEntryName.get( deletedEntryName.size() - 1 );
-        backupCtx.createSubcontext( deletedEntryRdn, deletedEntry );
+        backupCtx.createSubcontext( deletedEntryRdn, ServerEntryUtils.toAttributesImpl( deletedEntry
) );
         LOG.info( "Backed up deleted entry to \"" +
                 ( ( LdapContext ) backupCtx.lookup( deletedEntryRdn ) ).getNameInNamespace()
+ "\"" );
     }

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/ListUtilsSP.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/ListUtilsSP.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/ListUtilsSP.java
(original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/trigger/ListUtilsSP.java
Fri Jan 18 02:48:01 2008
@@ -19,13 +19,13 @@
  */
 package org.apache.directory.server.core.trigger;
 
-import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.naming.directory.BasicAttributes;
 import javax.naming.directory.DirContext;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -35,7 +35,7 @@
     private static final Logger LOG = LoggerFactory.getLogger( ListUtilsSP.class );
 
 
-    public static void subscribeToGroup( Name addedEntryName, LdapContext groupCtx ) throws
NamingException
+    public static void subscribeToGroup( LdapDN addedEntryName, LdapContext groupCtx ) throws
NamingException
     {
         LOG.info( "User \"" + addedEntryName + "\" will be subscribed to \"" + groupCtx +
"\"" );
         groupCtx.modifyAttributes("", DirContext.ADD_ATTRIBUTE,

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcEngine.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcEngine.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcEngine.java
Fri Jan 18 02:48:01 2008
@@ -22,9 +22,10 @@
 package org.apache.directory.server.core.sp;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.server.core.entry.ServerEntry;
+
 
 /**
  * An abstraction over stored procedure execution depending on the type of the language supported.
@@ -48,7 +49,7 @@
      * <p>
      * This method should be called before an attempt to invoke a stored procedure via this
Engine.
      */
-    public void setSPUnitEntry( final Attributes spUnit );
+    public void setSPUnitEntry( final ServerEntry spUnit );
     
     
     /**

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/StoredProcExecutionManager.java
Fri Jan 18 02:48:01 2008
@@ -22,11 +22,14 @@
 package org.apache.directory.server.core.sp;
 
 
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import javax.naming.ldap.LdapContext;
@@ -68,7 +71,7 @@
      * @return The entry associated with the SP Unit.
      * @throws NamingException If the unit cannot be located or any other error occurs.
      */
-    public Attributes findStoredProcUnit( LdapContext rootDSE, String fullSPName ) throws
NamingException
+    public ServerEntry findStoredProcUnit( LdapContext rootDSE, String fullSPName, Registries
registries ) throws NamingException
     {
         SearchControls controls = new SearchControls();
         controls.setReturningAttributes( SchemaConstants.ALL_USER_ATTRIBUTES_ARRAY );
@@ -76,7 +79,7 @@
         String spUnitName = StoredProcUtils.extractStoredProcUnitName( fullSPName );
         String filter = "(storedProcUnitName=" + spUnitName + ")";
         NamingEnumeration<SearchResult> results = rootDSE.search( storedProcContainer,
filter, controls );
-        return results.nextElement().getAttributes();
+        return ServerEntryUtils.toServerEntry( results.nextElement().getAttributes(), LdapDN.EMPTY_LDAPDN,
registries );
     }
 
 
@@ -88,9 +91,9 @@
      * @return A {@link StoredProcEngine} associated with spUnitEntry.
      * @throws NamingException If no {@link StoredProcEngine} that can be associated with
the language identifier in spUnitEntry can be found.
      */
-    public StoredProcEngine getStoredProcEngineInstance( Attributes spUnitEntry ) throws
NamingException
+    public StoredProcEngine getStoredProcEngineInstance( ServerEntry spUnitEntry ) throws
NamingException
     {
-        String spLangId = ( String ) spUnitEntry.get( "storedProcLangId" ).get();
+        String spLangId = ( String ) spUnitEntry.get( "storedProcLangId" ).getString();
 
         for ( StoredProcEngineConfig engineConfig : storedProcEngineConfigs )
         {
@@ -98,6 +101,7 @@
             {
                 Class<? extends StoredProcEngine> engineType = engineConfig.getStoredProcEngineType();
                 StoredProcEngine engine;
+                
                 try
                 {
                     engine = engineType.newInstance();
@@ -114,6 +118,7 @@
                     ne.setRootCause( e );
                     throw ne;
                 }
+                
                 engine.setSPUnitEntry( spUnitEntry );
                 return engine;
             }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/JavaStoredProcEngine.java
Fri Jan 18 02:48:01 2008
@@ -28,10 +28,10 @@
 import java.util.List;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.ldap.LdapContext;
 
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.sp.StoredProcEngine;
 import org.apache.directory.server.core.sp.StoredProcUtils;
 import org.apache.directory.shared.ldap.util.DirectoryClassUtils;
@@ -48,7 +48,7 @@
 
     public static final String STORED_PROC_LANG_ID = "Java";
 
-    private Attributes spUnit;
+    private ServerEntry spUnit;
 
 
     /* (non-Javadoc)
@@ -56,12 +56,13 @@
      */
     public Object invokeProcedure( LdapContext rootCtx, String fullSPName, Object[] spArgs
) throws NamingException
     {
-        Attribute javaByteCode = spUnit.get( "javaByteCode" );
+        ServerAttribute javaByteCode = spUnit.get( "javaByteCode" );
         String spName = StoredProcUtils.extractStoredProcName( fullSPName );
         String className = StoredProcUtils.extractStoredProcUnitName( fullSPName );
 
         ClassLoader loader = new LdapJavaStoredProcClassLoader( javaByteCode );
-        Class clazz;
+        Class<?> clazz;
+        
         try
         {
             clazz = loader.loadClass( className );
@@ -73,7 +74,7 @@
             throw ne;
         }
 
-        Class[] types = getTypesFromValues( spArgs );
+        Class<?>[] types = getTypesFromValues( spArgs );
 
         Method proc;
         try
@@ -123,15 +124,15 @@
     /* (non-Javadoc)
      * @see org.apache.directory.server.core.sp.StoredProcEngine#setSPUnitEntry(javax.naming.directory.Attributes)
      */
-    public void setSPUnitEntry( Attributes spUnit )
+    public void setSPUnitEntry( ServerEntry spUnit )
     {
         this.spUnit = spUnit;
     }
 
 
-    private Class[] getTypesFromValues( Object[] values )
+    private Class<?>[] getTypesFromValues( Object[] values )
     {
-        List<Class> types = new ArrayList<Class>();
+        List<Class<?>> types = new ArrayList<Class<?>>();
 
         for ( Object obj : values )
         {
@@ -141,6 +142,6 @@
         return types.toArray( EMPTY_CLASS_ARRAY );
     }
 
-    private static Class[] EMPTY_CLASS_ARRAY = new Class[ 0 ];
+    private static Class<?>[] EMPTY_CLASS_ARRAY = new Class[ 0 ];
 
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/sp/java/LdapJavaStoredProcClassLoader.java
Fri Jan 18 02:48:01 2008
@@ -22,7 +22,8 @@
 
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
+
+import org.apache.directory.server.core.entry.ServerAttribute;
 
 
 /**
@@ -33,10 +34,10 @@
  */
 public class LdapJavaStoredProcClassLoader extends ClassLoader
 {
-    private Attribute javaByteCodeAttr;
+    private ServerAttribute javaByteCodeAttr;
 
 
-    public LdapJavaStoredProcClassLoader( Attribute javaByteCodeAttr )
+    public LdapJavaStoredProcClassLoader( ServerAttribute javaByteCodeAttr )
     {
         // Critical call to super class constructor. Required for true plumbing of class
loaders.
         super( LdapJavaStoredProcClassLoader.class.getClassLoader() );
@@ -48,9 +49,10 @@
     public Class<?> findClass( String name ) throws ClassNotFoundException
     {
         byte[] classBytes;
+        
         try
         {
-            classBytes = ( byte[] ) javaByteCodeAttr.get();
+            classBytes = javaByteCodeAttr.getBytes();
         }
         catch ( NamingException e )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/AddStoredProcedureParameterInjector.java
Fri Jan 18 02:48:01 2008
@@ -23,8 +23,8 @@
 import java.util.Map;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -33,9 +33,9 @@
 public class AddStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
 {
     private LdapDN addedEntryName;
-    private Attributes addedEntry;
+    private ServerEntry addedEntry;
     
-    public AddStoredProcedureParameterInjector( Invocation invocation, LdapDN addedEntryName,
Attributes addedEntry )
+    public AddStoredProcedureParameterInjector( Invocation invocation, LdapDN addedEntryName,
ServerEntry addedEntry )
     {
         super( invocation );
         this.addedEntryName = addedEntryName;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/DeleteStoredProcedureParameterInjector.java
Fri Jan 18 02:48:01 2008
@@ -24,8 +24,9 @@
 import java.util.Map;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
@@ -37,7 +38,7 @@
 public class DeleteStoredProcedureParameterInjector extends AbstractStoredProcedureParameterInjector
 {
     private LdapDN deletedEntryName;
-    private Attributes deletedEntry;
+    private ServerEntry deletedEntry;
     
     public DeleteStoredProcedureParameterInjector( Registries registries, Invocation invocation,
LdapDN deletedEntryName ) throws NamingException
     {
@@ -66,14 +67,18 @@
         }
     };
     
-    private Attributes getDeletedEntry( Registries registries ) throws NamingException
+    private ServerEntry getDeletedEntry( Registries registries ) throws NamingException
     {
         PartitionNexusProxy proxy = getInvocation().getProxy();
         /**
          * Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes
          * especially subentry related ones like "triggerExecutionSubentries".
          */
-        Attributes deletedEntry = proxy.lookup( new LookupOperationContext( registries, deletedEntryName
), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+        ServerEntry deletedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, deletedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS
),
+            deletedEntryName,
+            registries );
+        
         return deletedEntry;
     }
 }

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=613128&r1=613127&r2=613128&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
Fri Jan 18 02:48:01 2008
@@ -25,9 +25,10 @@
 import java.util.Map;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.ModificationItem;
 
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.invocation.Invocation;
@@ -41,7 +42,7 @@
 {
     private LdapDN modifiedEntryName;
     private List<ModificationItemImpl> modifications;
-    private Attributes oldEntry;
+    private ServerEntry oldEntry;
     
     
     public ModifyStoredProcedureParameterInjector( Invocation invocation, ModifyOperationContext
opContext ) throws NamingException
@@ -104,14 +105,17 @@
         }
     };
     
-    private Attributes getEntry( Registries registries ) throws NamingException
+    private ServerEntry getEntry( Registries registries ) throws NamingException
     {
         PartitionNexusProxy proxy = getInvocation().getProxy();
         /**
          * Using LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS here to exclude operational attributes
          * especially subentry related ones like "triggerExecutionSubentries".
          */
-        return proxy.lookup( new LookupOperationContext( registries, modifiedEntryName ),
PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+        return ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, modifiedEntryName ), PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS
),
+            modifiedEntryName,
+            registries );
     }
 
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
Fri Jan 18 02:48:01 2008
@@ -25,6 +25,7 @@
 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.ServerValue;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.InterceptorChain;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -62,8 +63,6 @@
 import org.slf4j.LoggerFactory;
 
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -123,7 +122,7 @@
      * @param proxy the partition nexus proxy 
      */
     private void addPrescriptiveTriggerSpecs( List<TriggerSpecification> triggerSpecs,
PartitionNexusProxy proxy,
-        LdapDN dn, Attributes entry ) throws NamingException
+        LdapDN dn, ServerEntry entry ) throws NamingException
     {
         
         /*
@@ -135,21 +134,26 @@
          * to be in the same naming context as their access point so the subentries
          * effecting their parent entry applies to them as well.
          */
-        if ( entry.get( SchemaConstants.OBJECT_CLASS_AT ).contains( SchemaConstants.SUBENTRY_OC
) )
+        if ( entry.contains( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC
) )
         {
             LdapDN parentDn = ( LdapDN ) dn.clone();
             parentDn.remove( dn.size() - 1 );
-            entry = proxy.lookup( new LookupOperationContext( registries, parentDn ), PartitionNexusProxy.LOOKUP_BYPASS
);
+            entry = ServerEntryUtils.toServerEntry( 
+                proxy.lookup( new LookupOperationContext( registries, parentDn ), PartitionNexusProxy.LOOKUP_BYPASS
),
+                parentDn,
+                registries );
         }
 
-        Attribute subentries = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT
);
+        ServerAttribute subentries = entry.get( SchemaConstants.TRIGGER_EXECUTION_SUBENTRIES_AT
);
+        
         if ( subentries == null )
         {
             return;
         }
-        for ( int ii = 0; ii < subentries.size(); ii++ )
+        
+        for ( ServerValue<?> value:subentries )
         {
-            String subentryDn = ( String ) subentries.get( ii );
+            String subentryDn = ( String ) value.get();
             triggerSpecs.addAll( triggerSpecCache.getSubentryTriggerSpecs( subentryDn ) );
         }
     }
@@ -163,17 +167,18 @@
      * @param entry the target entry that is considered as the trigger source
      * @throws NamingException if there are problems accessing attribute values
      */
-    private void addEntryTriggerSpecs( List<TriggerSpecification> triggerSpecs, Attributes
entry ) throws NamingException
+    private void addEntryTriggerSpecs( List<TriggerSpecification> triggerSpecs, ServerEntry
entry ) throws NamingException
     {
-        Attribute entryTrigger = entry.get( ENTRY_TRIGGER_ATTR );
+        ServerAttribute entryTrigger = entry.get( ENTRY_TRIGGER_ATTR );
+        
         if ( entryTrigger == null )
         {
             return;
         }
 
-        for ( int ii = 0; ii < entryTrigger.size(); ii++ )
+        for ( ServerValue<?> value:entryTrigger )
         {
-            String triggerString = ( String ) entryTrigger.get( ii );
+            String triggerString = ( String ) value.get();
             TriggerSpecification item;
 
             try
@@ -261,7 +266,7 @@
     public void add( NextInterceptor next, AddOperationContext addContext ) throws NamingException
     {
     	LdapDN name = addContext.getDn();
-    	Attributes entry = ServerEntryUtils.toAttributesImpl( addContext.getEntry() );
+    	ServerEntry entry = addContext.getEntry();
     	
         // Bypass trigger handling if the service is disabled.
         if ( !enabled )
@@ -308,7 +313,11 @@
         // Gather supplementary data.
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes deletedEntry = proxy.lookup( new LookupOperationContext( registries, name
), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry deletedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS
),
+            name,
+            registries );
+        
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller()
).getRootContext();
         StoredProcedureParameterInjector injector = new DeleteStoredProcedureParameterInjector(
registries, invocation, name );
 
@@ -341,7 +350,11 @@
         // Gather supplementary data.
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes modifiedEntry = proxy.lookup( new LookupOperationContext( registries,
normName ), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry modifiedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, normName ), PartitionNexusProxy.LOOKUP_BYPASS
),
+            normName,
+            registries );
+        
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller()
).getRootContext();
         StoredProcedureParameterInjector injector = new ModifyStoredProcedureParameterInjector(
invocation, opContext );
 
@@ -377,7 +390,11 @@
         // Gather supplementary data.        
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes renamedEntry = proxy.lookup( new LookupOperationContext( registries, name
), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry renamedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS
),
+            name,
+            registries );
+        
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller()
).getRootContext();
         
         LdapDN oldRDN = new LdapDN( name.getRdn().getUpName() );
@@ -423,7 +440,11 @@
         // Gather supplementary data.        
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes movedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName
), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry movedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS
),
+            oriChildName,
+            registries );
+        
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller()
).getRootContext();
         
         LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
@@ -468,7 +489,7 @@
         // Gather Trigger Specifications which apply to the entry being imported.
         // Note: Entry Trigger Specifications are not valid for Import.
         List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
-        addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, ServerEntryUtils.toAttributesImpl(
fakeImportedEntry ) );
+        addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, fakeImportedEntry
);
         
         Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation(
exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
         
@@ -500,7 +521,11 @@
         // Gather supplementary data.        
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes movedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName
), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry movedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS
),
+            oriChildName,
+            registries );
+        
         ServerLdapContext callerRootCtx = ( ServerLdapContext ) ( ( ServerLdapContext ) invocation.getCaller()
).getRootContext();
         
         LdapDN oldRDN = new LdapDN( oriChildName.getRdn().getUpName() );
@@ -546,7 +571,7 @@
         // Gather Trigger Specifications which apply to the entry being imported.
         // Note: Entry Trigger Specifications are not valid for Import.
         List<TriggerSpecification> importTriggerSpecs = new ArrayList<TriggerSpecification>();
-        addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, ServerEntryUtils.toAttributesImpl(
fakeImportedEntry ) );
+        addPrescriptiveTriggerSpecs( importTriggerSpecs, proxy, newDN, fakeImportedEntry
);
         
         Map<ActionTime, List<TriggerSpecification>> exportTriggerMap = getActionTimeMappedTriggerSpecsForOperation(
exportTriggerSpecs, LdapOperation.MODIFYDN_EXPORT );
         
@@ -612,12 +637,13 @@
         
         try
         {
-            Attributes spUnit = manager.findStoredProcUnit( ctx, procedure );
+            ServerEntry spUnit = manager.findStoredProcUnit( ctx, procedure, registries );
             StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
             return engine.invokeProcedure( ctx, procedure, values );
         }
         catch ( NamingException e )
         {
+            e.printStackTrace();
             LdapNamingException lne = new LdapNamingException( ResultCodeEnum.OTHER );
             lne.setRootCause( e );
             throw lne;

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=613128&r1=613127&r2=613128&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
Fri Jan 18 02:48:01 2008
@@ -22,6 +22,10 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
+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.ServerValue;
 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.PartitionNexus;
@@ -42,8 +46,6 @@
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import java.text.ParseException;
@@ -120,8 +122,9 @@
             while ( results.hasMore() )
             {
                 SearchResult result = results.next();
-                String subentryDn = result.getName();
-                Attribute triggerSpec = result.getAttributes().get( PRESCRIPTIVE_TRIGGER_ATTR
);
+                LdapDN subentryDn = new LdapDN( result.getName() );
+                ServerEntry resultEntry = ServerEntryUtils.toServerEntry( result.getAttributes(),
subentryDn, registries );
+                ServerAttribute triggerSpec = resultEntry.get( PRESCRIPTIVE_TRIGGER_ATTR
);
                 
                 if ( triggerSpec == null )
                 {
@@ -129,9 +132,8 @@
                     continue;
                 }
 
-                LdapDN normSubentryName = new LdapDN( subentryDn );
-                normSubentryName.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
-                subentryAdded( normSubentryName, result.getAttributes() );
+                LdapDN normSubentryName = subentryDn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping()
);
+                subentryAdded( normSubentryName, resultEntry );
             }
             
             results.close();
@@ -139,19 +141,19 @@
     }
 
 
-    private boolean hasPrescriptiveTrigger( Attributes entry )
+    private boolean hasPrescriptiveTrigger( ServerEntry entry ) throws NamingException
     {
         // only do something if the entry contains prescriptiveTrigger
-        Attribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
+        ServerAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
 
         return triggerSpec != null;
     }
 
 
-    public void subentryAdded( LdapDN normName, Attributes entry ) throws NamingException
+    public void subentryAdded( LdapDN normName, ServerEntry entry ) throws NamingException
     {
         // only do something if the entry contains prescriptiveTrigger
-        Attribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
+        ServerAttribute triggerSpec = entry.get( PRESCRIPTIVE_TRIGGER_ATTR );
         
         if ( triggerSpec == null )
         {
@@ -160,13 +162,13 @@
         
         List<TriggerSpecification> subentryTriggerSpecs = new ArrayList<TriggerSpecification>();
         
-        for ( int ii = 0; ii < triggerSpec.size(); ii++ )
+        for ( ServerValue<?> value:triggerSpec )
         {
             TriggerSpecification item = null;
 
             try
             {
-                item = triggerSpecParser.parse( ( String ) triggerSpec.get( ii ) );
+                item = triggerSpecParser.parse( ( String ) value.get() );
                 subentryTriggerSpecs.add( item );
             }
             catch ( ParseException e )
@@ -181,7 +183,7 @@
     }
 
 
-    public void subentryDeleted( LdapDN normName, Attributes entry )
+    public void subentryDeleted( LdapDN normName, ServerEntry entry ) throws NamingException
     {
         if ( !hasPrescriptiveTrigger( entry ) )
         {
@@ -192,7 +194,7 @@
     }
 
 
-    public void subentryModified( ModifyOperationContext opContext, Attributes entry ) throws
NamingException
+    public void subentryModified( ModifyOperationContext opContext, ServerEntry entry ) throws
NamingException
     {
         if ( !hasPrescriptiveTrigger( entry ) )
         {

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
Fri Jan 18 02:48:01 2008
@@ -24,6 +24,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
 import org.apache.mina.common.IoSession;

Modified: directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java?rev=613128&r1=613127&r2=613128&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java
(original)
+++ directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java
Fri Jan 18 02:48:01 2008
@@ -31,11 +31,11 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.naming.directory.Attributes;
 import javax.naming.ldap.Control;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.commons.lang.SerializationUtils;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.sp.StoredProcEngine;
 import org.apache.directory.server.core.sp.StoredProcEngineConfig;
@@ -100,7 +100,7 @@
         StoredProcedure spBean = decodeBean( req.getPayload() );
         
         String procedure = StringTools.utf8ToString( spBean.getProcedure() );
-        Attributes spUnit = manager.findStoredProcUnit( ctx, procedure );
+        ServerEntry spUnit = manager.findStoredProcUnit( ctx, procedure, ctx.getService().getRegistries()
);
         StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
         
         List<Object> valueList = new ArrayList<Object>( spBean.getParameters().size()
);



Mime
View raw message