You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by sg...@apache.org on 2005/11/11 17:51:47 UTC

svn commit: r332597 [1/2] - in /jakarta/turbine/fulcrum/trunk/yaafi/src: java/org/apache/fulcrum/jce/crypto/ java/org/apache/fulcrum/yaafi/cli/ java/org/apache/fulcrum/yaafi/framework/component/ java/org/apache/fulcrum/yaafi/framework/container/ java/o...

Author: sgoeschl
Date: Fri Nov 11 08:51:11 2005
New Revision: 332597

URL: http://svn.apache.org/viewcvs?rev=332597&view=rev
Log:
+) added Fulcrum Advice Service
+) added Fulcrum JAMon Interceptor Service
+) improved test coverage
+) fixed a few more javadoc complaints by Eclipse

Added:
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorService.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorServiceImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/DefaultToStringBuilderImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/InterceptorToStringBuilder.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/MethodToStringBuilderImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/advice/
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/advice/AdviceService.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/advice/AdviceServiceImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/interceptor/
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/interceptor/util/
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/interceptor/util/ArgumentToStringBuilderTest.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/service/AdviceServiceTest.java
Removed:
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/AvalonContextHelper.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/AvalonToYaafiContextMapper.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/util/YaafiToAvalonContextMapper.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/util/MethodToStringBuilder.java
Modified:
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactory.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactoryImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoUtil.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/PasswordFactory.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponentImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorFactory.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorInvocationHandler.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock2.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleConfigurationParserImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorage.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorageImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/logging/LoggingInterceptorServiceImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/reconfiguration/ReconfigurationEntry.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/reconfiguration/ReconfigurationServiceImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/servicemanager/ServiceManagerServiceImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/service/shutdown/ShutdownEntry.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/TestComponentConfig.xml
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/TestRoleConfig.xml
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/TestYaafiContainerConfig.xml
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/jce/crypto/CryptoUtilTest.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/TestComponentImpl.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/framework/container/ServiceLifecycleManagerTest.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/framework/factory/ServiceContainerFactoryTest.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/service/ReconfigurationTest.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/service/ServiceManagerServiceTest.java
    jakarta/turbine/fulcrum/trunk/yaafi/src/test/org/apache/fulcrum/yaafi/testcontainer/BaseUnitTest.java

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactory.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactory.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactory.java Fri Nov 11 08:51:11 2005
@@ -35,6 +35,8 @@
      *
      * @param is the input stream to be wrapped
      * @return an decrypting input stream
+     * @throws GeneralSecurityException creating the input stream failed
+     * @throws IOException creating the input stream failed
      */
     InputStream getInputStream(InputStream is)
         throws GeneralSecurityException, IOException;
@@ -45,6 +47,8 @@
      * @param is the input stream to be wrapped
      * @param password the password to be used
      * @return an decrypting input stream
+     * @throws GeneralSecurityException creating the input stream failed
+     * @throws IOException creating the input stream failed 
      */
     InputStream getInputStream(InputStream is, char[] password)
         throws GeneralSecurityException, IOException;
@@ -54,6 +58,8 @@
      *
      * @param is the input stream to be wrapped
      * @return an decrypting input stream
+     * @throws GeneralSecurityException creating the input stream failed
+     * @throws IOException creating the input stream failed 
      */
     InputStream getSmartInputStream(InputStream is)
         throws GeneralSecurityException, IOException;
@@ -64,6 +70,8 @@
      * @param is the input stream to be wrapped
      * @param password the password to be used
      * @return an decrypting input stream
+     * @throws GeneralSecurityException creating the input stream failed
+     * @throws IOException creating the input stream failed 
      */
     InputStream getSmartInputStream(InputStream is, char[] password)
         throws GeneralSecurityException, IOException;
@@ -75,6 +83,8 @@
      * @param os the output stream to be wrapped
      * @param password the password to be used
      * @return an decrypting input stream
+     * @throws GeneralSecurityException creating the ouptut stream failed
+     * @throws IOException creating the ouptut stream failed 
      */
     OutputStream getOutputStream(OutputStream os, char[] password)
         throws GeneralSecurityException, IOException;

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactoryImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactoryImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactoryImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoStreamFactoryImpl.java Fri Nov 11 08:51:11 2005
@@ -70,6 +70,7 @@
 
     /**
      * Factory method to get a default instance
+     * @return an instance of the CryptoStreamFactory
      */
     public static CryptoStreamFactory getInstance()
     {
@@ -128,8 +129,7 @@
     }
 
     /**
-     * @param is the input stream to be wrapped
-     * @return a decrypting input stream
+     * @see org.apache.fulcrum.jce.crypto.CryptoStreamFactory#getInputStream(java.io.InputStream)
      */
     public InputStream getInputStream( InputStream is )
         throws GeneralSecurityException, IOException
@@ -140,9 +140,7 @@
     }
 
     /**
-     * @param is the input stream to be wrapped
-     * @param password the password for decryption
-     * @return a decrypting input stream
+     * @see org.apache.fulcrum.jce.crypto.CryptoStreamFactory#getInputStream(java.io.InputStream,char[])
      */
     public InputStream getInputStream( InputStream is, char[] password )
         throws GeneralSecurityException, IOException
@@ -165,7 +163,7 @@
     }
 
     /**
-     * @see org.apache.fulcrum.jce.crypto.CryptoStreamFactory#getSmartInputStream(java.io.InputStream)
+     * @see org.apache.fulcrum.jce.crypto.CryptoStreamFactory#getSmartInputStream(java.io.InputStream,char[])
      */
     public InputStream getSmartInputStream(InputStream is, char[] password )
         throws GeneralSecurityException, IOException
@@ -181,12 +179,8 @@
         return result;
     }
 
-
     /**
-     * @param os the output stream to be wrapped
-     * @param password the password for encryption
-     *
-     * @return a encrypting output stream
+     * @see org.apache.fulcrum.jce.crypto.CryptoStreamFactory#getOutputStream(java.io.OutputStream, char[])
      */
     public OutputStream getOutputStream( OutputStream os, char[] password )
         throws GeneralSecurityException, IOException
@@ -233,8 +227,7 @@
      *
      * @param password the password to use.
      * @return the key
-     * @throws NoSuchAlgorithmException
-     * @throws InvalidKeySpecException
+     * @throws GeneralSecurityException creating the key failed
      */
     private final Key createKey( char[] password )
         throws GeneralSecurityException
@@ -262,6 +255,8 @@
      * @param mode the cipher mode
      * @param password the password
      * @return an instance of a cipher
+     * @throws GeneralSecurityException creating a cipher failed
+     * @throws IOException creating a cipher failed
      */
     private final Cipher createCipher( int mode, char[] password )
         throws GeneralSecurityException, IOException

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoUtil.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoUtil.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoUtil.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/CryptoUtil.java Fri Nov 11 08:51:11 2005
@@ -219,6 +219,10 @@
      *  <li>ByteArrayOutputStream</li>
      *  <li>InputStream</li>
      * </ul>
+     * 
+     * @param source the source object
+     * @return the created input stream
+     * @throws IOException creating the input stream failed
      */
     private static InputStream createInputStream( Object source )
         throws IOException
@@ -265,6 +269,10 @@
      *  <li>File</li>
      *  <li>OutputStream</li>
      * </ul>
+     * 
+     * @param target the target object
+     * @return the output stream
+     * @throws IOException creating the output stream failed
      */
     private static OutputStream createOutputStream( Object target )
         throws IOException

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/PasswordFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/PasswordFactory.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/PasswordFactory.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/jce/crypto/PasswordFactory.java Fri Nov 11 08:51:11 2005
@@ -82,9 +82,8 @@
      * @param password the default password
      * @param count number of MessageDigest iterations
      * @return the default password
-     * @throws NoSuchProviderException
-     * @throws NoSuchAlgorithmException
-     * @throws UnsupportedEncodingException
+     * @throws NoSuchAlgorithmException the encryption algorithm is not supported
+     * @throws UnsupportedEncodingException the requested encoding is not supported
      */
     public static final char [] create( char[] password, byte[] salt, int count )
         throws NoSuchAlgorithmException, UnsupportedEncodingException

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Getopt.java Fri Nov 11 08:51:11 2005
@@ -156,16 +156,6 @@
      * @param option the given option
      * @return true if a value is defined
      */
-    private boolean hasValue( String option )
-    {
-        return this.hasValue( this.find(option) );
-    }
-
-    /**
-     * Determines if a value is defined for the given option
-     * @param option the given option
-     * @return true if a value is defined
-     */
     private boolean hasValue( int index )
     {
         String value = null;

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/cli/Main.java Fri Nov 11 08:51:11 2005
@@ -588,8 +588,6 @@
 
     /**
      * Terminates the instance
-     *
-     * @throws Exception the termination failed
      */
     protected void shutdown()
     {
@@ -598,7 +596,7 @@
             return;
         }
 
-        this.getLogger().info( "Terminating " + this.getClass().getName() );
+        this.getLogger().debug( "Terminating " + this.getClass().getName() );
 
         try
         {

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/AvalonServiceComponentImpl.java Fri Nov 11 08:51:11 2005
@@ -37,7 +37,6 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
-import org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants;
 import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorFactory;
 import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService;
 import org.apache.fulcrum.yaafi.framework.role.RoleEntry;
@@ -125,9 +124,7 @@
                 this.getParentLogger().debug( "Creating a dynamic proxy for " + this.getShorthand() );
             }
             
-            ReadWriteLock readWriteLock = (ReadWriteLock) this.getContext().get(
-                AvalonYaafiConstants.URN_YAAFI_KERNELLOCK
-                );
+            ReadWriteLock readWriteLock = this.getReadWriteLock();
             
             Object proxyInstance = AvalonInterceptorFactory.create(
                 this.getName(),
@@ -205,6 +202,8 @@
     }
 
     /**
+     * Stop and dispose the service implementation.
+     * 
      * @see org.apache.fulcrum.yaafi.framework.component.ServiceComponent#decommision()
      */
     public void decommision() throws Exception
@@ -223,7 +222,24 @@
 
         try
         {
-            this.dispose();
+            Object rawInstance = this.getRawInstance(false);
+
+            // dispose the service implementation class
+            
+            if( rawInstance instanceof Disposable )
+            {
+                try
+                {
+                    this.getParentLogger().debug( "Disposable.dispose() for " + this.getShorthand() );
+                    ((Disposable) rawInstance).dispose();
+                }
+                catch (Exception e)
+                {
+                    String msg = "Disposing the following service failed : " + this.getShorthand();
+                    this.getParentLogger().error(msg,e);
+                    throw new RuntimeException(msg);
+                }
+            }
         }
         catch (Throwable e)
         {
@@ -562,36 +578,5 @@
                 throw new RuntimeException(msg);
             }
         }
-    }
-
-    /**
-     * @see org.apache.avalon.framework.activity.Disposable#dispose()
-     */
-    public void dispose()
-    {
-        Object rawInstance = this.getRawInstance(false);
-
-        if( rawInstance instanceof Disposable )
-        {
-            try
-            {
-                this.getParentLogger().debug( "Disposable.dispose() for " + this.getShorthand() );
-                ((Disposable) rawInstance).dispose();
-            }
-            catch (Exception e)
-            {
-                String msg = "Disposing the following service failed : " + this.getShorthand();
-                this.getParentLogger().error(msg,e);
-                throw new RuntimeException(msg);
-            }
-        }
-    }
-
-    /**
-     * @see java.lang.Object#toString()
-     */
-    public String toString()
-    {
-        return super.toString();
     }
 }

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponentImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponentImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponentImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/component/ServiceComponentImpl.java Fri Nov 11 08:51:11 2005
@@ -154,7 +154,7 @@
     {
         try
         {
-            if( this.getRoleEntry().isEarlyInit() )
+            if( this.isEarlyInit() )
             {
                 this.getInstance();
             }

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/container/ServiceContainerImpl.java Fri Nov 11 08:51:11 2005
@@ -49,6 +49,7 @@
 import org.apache.fulcrum.yaafi.framework.util.InputStreamLocator;
 import org.apache.fulcrum.yaafi.framework.util.ReadWriteLock;
 import org.apache.fulcrum.yaafi.framework.util.StringUtils;
+import org.apache.fulcrum.yaafi.framework.util.ToStringBuilder;
 import org.apache.fulcrum.yaafi.framework.util.Validate;
 
 /**
@@ -406,7 +407,7 @@
         // we are up and running
 
         this.isDisposed = false;
-        this.getLogger().info( "YAAFI Avalon Service Container is up and running");
+        this.getLogger().debug( "YAAFI Avalon Service Container is up and running");
     }
 
 
@@ -532,6 +533,10 @@
         }
     }
 
+    /////////////////////////////////////////////////////////////////////////
+    // Server Interface Implementation
+    /////////////////////////////////////////////////////////////////////////
+
     /**
      * @see org.apache.fulcrum.yaafi.framework.container.ServiceLifecycleManager#getRoleEntry(java.lang.String)
      */    
@@ -614,10 +619,6 @@
         }
     }
 
-    /////////////////////////////////////////////////////////////////////////
-    // Service Interface Implementation
-    /////////////////////////////////////////////////////////////////////////
-
     /**
      * @see org.apache.avalon.framework.service.ServiceManager#hasService(java.lang.String)
      */
@@ -753,45 +754,37 @@
             this.releaseLock(lock);
         }
     }
-
-    /////////////////////////////////////////////////////////////////////////
-    // Service Implementation
-    /////////////////////////////////////////////////////////////////////////
-
-    /**
-     * Creates an absolute path for the given filename based on the application
-     * root directory.
-     *
-     * @param fileName the file name
-     * @return abolsute file
-     */
-    private File makeAbsolutePath( String fileName )
-    {
-        return this.makeAbsolutePath( new File(fileName) );
-    }
-
+    
     /**
-     * Creates an absolute path for the given file based on the application
-     * root directory.
-     *
-     * @param file the relative file
-     * @return absolute file
+     * @see java.lang.Object#toString()
      */
-    private File makeAbsolutePath( File file )
+    public String toString()
     {
-        File result = file;
+        ToStringBuilder toStringBuilder = new ToStringBuilder(this);
 
-        if( result.isAbsolute() == false )
-        {
-            String temp = file.getPath() + "/" + file.getName();
-            result = new File( this.getApplicationRootDir(), temp );
-        }
+        toStringBuilder.append("applicationRootDir", this.getApplicationRootDir());
+        toStringBuilder.append("tempRootDir", this.getTempRootDir());               
+        toStringBuilder.append("componentRolesLocation", this.componentRolesLocation);
+        toStringBuilder.append("componentConfigurationLocation", this.componentConfigurationLocation);
+        toStringBuilder.append("parametersLocation", parametersLocation);
+        toStringBuilder.append("logger", this.getLogger().getClass().getName());
+        toStringBuilder.append("hasDynamicProxies", this.hasDynamicProxies);
+        toStringBuilder.append("containerFlavour", this.containerFlavour);        
+        toStringBuilder.append("componentRolesFlavour", this.componentRolesFlavour);
+        toStringBuilder.append("isComponentRolesEncrypted", this.isComponentRolesEncrypted);
+        toStringBuilder.append("isComponentConfigurationEncrypted", this.isComponentConfigurationEncrypted);
+        toStringBuilder.append("isParametersEncrypted", this.isParametersEncrypted);
 
-        return result;
+        return toStringBuilder.toString();
     }
+    
+    /////////////////////////////////////////////////////////////////////////
+    // Service Implementation
+    /////////////////////////////////////////////////////////////////////////
 
     /**
      * Create a role configuration parser based on the container flavour.
+     * @return the role configuration parser
      */
     private RoleConfigurationParser createRoleConfigurationParser()
     {
@@ -804,6 +797,8 @@
      * Reconfigure a single service
      *
      * @param name the name of the service to be reconfigured
+     * @param ServiceException the service was not found
+     * @param ConfigurationException the reconfiguration failed
      */
     private void reconfigure(String name)
         throws ServiceException, ConfigurationException
@@ -911,6 +906,7 @@
      * Incarnation of a list of services.
      * 
      * @param serviceList the list of available services
+     * @throws Exception the incarnation of a service failed
      */
     private void incarnateAll(List serviceList)
         throws Exception
@@ -1114,7 +1110,7 @@
      * 
      * @param roleConfiguration the role configuration file
      * @param logger the logger 
-     * @throws Exception creating the service instance failed
+     * @throws ConfigurationException creating the service instance failed
      */
     private List createServiceComponents(Configuration roleConfiguration, Logger logger )
         throws ConfigurationException
@@ -1260,7 +1256,9 @@
     }
 
     /**
-     * @param applicationRootDir The applicationRootDir to set.
+     * Set the application directory of the container.
+     * 
+     * @param dir The applicationRootDir to set.
      */
     private File setApplicationRootDir(File dir)
     {
@@ -1297,7 +1295,9 @@
         return (this.getParentServiceManager() != null ? true : false );
     }
     /**
-     * @param tempRootDir The tempRootDir to set.
+     * Set the temporary directory of the container.
+     * 
+     * @param dir The tempRootDir to set.
      */
     private File setTempRootDir(File dir)
     {
@@ -1371,8 +1371,8 @@
     /**
      * Create a decrypting input stream using the default password.
      *
-     * @param is
-     * @return
+     * @param is the input stream to be decrypted 
+     * @return an decrypting input stream
      * @throws IOException
      * @throws GeneralSecurityException
      */
@@ -1501,7 +1501,7 @@
     }
     
     /**
-     * @return a write lock
+     * Release the read/write lock.
      */
     private final void releaseLock(Object lock)
     {

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorFactory.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorFactory.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorFactory.java Fri Nov 11 08:51:11 2005
@@ -23,6 +23,7 @@
 
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.fulcrum.yaafi.framework.constant.AvalonYaafiConstants;
 import org.apache.fulcrum.yaafi.framework.reflection.Clazz;
 import org.apache.fulcrum.yaafi.framework.util.ReadWriteLock;
 import org.apache.fulcrum.yaafi.framework.util.Validate;
@@ -111,7 +112,17 @@
         for( int i=0; i<interceptorList.length; i++ )
         {
             interceptorServiceName = interceptorList[i];
-            result[i] = (AvalonInterceptorService) serviceManager.lookup(interceptorServiceName);
+            Object currService = serviceManager.lookup(interceptorServiceName);
+
+            if (currService instanceof AvalonInterceptorService)
+            {
+                result[i] = (AvalonInterceptorService) currService;
+            }
+            else
+            {
+                String msg = "The following service is not an AvalonInterceptorService : " + interceptorServiceName;
+                throw new ServiceException(AvalonYaafiConstants.AVALON_CONTAINER_YAAFI,msg);
+            }
         }
 
         return result;

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorInvocationHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorInvocationHandler.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorInvocationHandler.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/interceptor/AvalonInterceptorInvocationHandler.java Fri Nov 11 08:51:11 2005
@@ -116,6 +116,14 @@
     }
 
     /**
+     * @return Returns the transaction id
+     */
+    public Long getTransactionId()
+    {
+        return transactionId;
+    }
+
+    /**
      * @see java.lang.Object#toString()
      */
     public String toString()
@@ -186,8 +194,7 @@
     /**
      * Invoke the onEntry method on all service interceptors.
      *
-     * @param method the method
-     * @param args the arguments
+     * @param context the current interceptor context
      */
     private void onEntry( AvalonInterceptorContext context )
     {
@@ -200,8 +207,7 @@
     /**
      * Invoke the onExit method on all service interceptors.
      *
-     * @param method the method
-     * @param args the arguments
+     * @param context the current interceptor context
      * @param result the result
      */
     private void onExit( AvalonInterceptorContext context, Object result )
@@ -215,9 +221,8 @@
     /**
      * Invoke the onError method on all service interceptors.
      *
-     * @param method the method
-     * @param args the arguments
-     * @param result the result
+     * @param context the current interceptor context
+     * @param t the resulting exception
      */
     private void onError( AvalonInterceptorContext context, Throwable t )
     {

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock.java Fri Nov 11 08:51:11 2005
@@ -1,7 +1,7 @@
 /*
- * $Header: /usr/local/cvsroot/it20one/service/it20one-service-framework/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock.java,v 1.1 2005/09/22 11:04:12 sigi Exp $
- * $Revision: 1.1 $
- * $Date: 2005/09/22 11:04:12 $
+ * $Header: /usr/local/cvsroot/it20one/service/it20one-service-framework/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock.java,v 1.2 2005/11/11 10:48:17 sigi Exp $
+ * $Revision: 1.2 $
+ * $Date: 2005/11/11 10:48:17 $
  *
  * ====================================================================
  *
@@ -27,8 +27,7 @@
  * 
  * A multi level lock. Depending on the implementation more than one owner may own a certain lock level on the same lock.
  * 
- * @version $Revision: 1.1 $
- * @see LockManager
+ * @version $Revision: 1.2 $
  */
 public interface MultiLevelLock {
 

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock2.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock2.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock2.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock2.java Fri Nov 11 08:51:11 2005
@@ -1,7 +1,7 @@
 /*
- * $Header: /usr/local/cvsroot/it20one/service/it20one-service-framework/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock2.java,v 1.1 2005/09/22 11:04:12 sigi Exp $
- * $Revision: 1.1 $
- * $Date: 2005/09/22 11:04:12 $
+ * $Header: /usr/local/cvsroot/it20one/service/it20one-service-framework/src/java/org/apache/fulcrum/yaafi/framework/locking/MultiLevelLock2.java,v 1.2 2005/11/11 10:48:17 sigi Exp $
+ * $Revision: 1.2 $
+ * $Date: 2005/11/11 10:48:17 $
  *
  * ====================================================================
  *
@@ -28,8 +28,7 @@
  * Extended multi level lock. Compared to basic {@link MultiLevelLock} allows for more flexible
  * locking including preference and more compatibility modes.
  * 
- * @version $Revision: 1.1 $
- * @see LockManager2
+ * @version $Revision: 1.2 $
  * @see MultiLevelLock
  * @see GenericLock
  * @since 1.1

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleConfigurationParserImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleConfigurationParserImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleConfigurationParserImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/role/RoleConfigurationParserImpl.java Fri Nov 11 08:51:11 2005
@@ -53,6 +53,7 @@
      *
      * @param roleConfiguration the role configuration file to parse
      * @return the parsed RoleEntries
+     * @throws ConfigurationException the configuration couldn't be processsed
      */
     public RoleEntry[] parse( Configuration roleConfiguration )
         throws ConfigurationException
@@ -83,6 +84,10 @@
 
     /**
      * Parses a YAAFI role configuration file.
+     * 
+     * @param roleConfiguration the role configuration
+     * @return the role entries from the configuration file
+     * @throws ConfigurationException the configuration couldn't be processsed
      */
     private RoleEntry[] mapFromYaafi( Configuration roleConfiguration )
         throws ConfigurationException

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorage.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorage.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorage.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorage.java Fri Nov 11 08:51:11 2005
@@ -36,6 +36,7 @@
 	 * if no such object exists. 
 	 * 
 	 * @param key the key for the lookup
+	 * @return the object
 	 */
 	public Object get(String key);
 	
@@ -55,6 +56,7 @@
 	 * Checks if the thread-local object for the given key exists
 	 * 
 	 * @param key the key for the lookup
+	 * @return true the object exists
 	 */
 	public boolean containsKey(String key);
 

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorageImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorageImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorageImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/framework/tls/ThreadLocalStorageImpl.java Fri Nov 11 08:51:11 2005
@@ -59,7 +59,7 @@
     }
 
     /**
-     * Gets the thread local variable and registers the listener with {@link ThreadEventNotifier}
+     * Gets the thread local variable and registers the listener with ThreadEventNotifier
      * if the thread local variable has been initialized. The registration cannot be done from
      * within {@link CleanableThreadLocal#initialValue()} because the notifier's thread local
      * variable will be overwritten and the listeners for the thread will be lost.

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/baseservice/BaseInterceptorServiceImpl.java Fri Nov 11 08:51:11 2005
@@ -62,6 +62,10 @@
 
     /** the Avalon temp directory */
     private File serviceTempDir;
+    
+    /** the supplied class loader */
+    private ClassLoader classLoader;
+    
 
     /////////////////////////////////////////////////////////////////////////
     // Avalon Service Lifecycle Implementation
@@ -83,6 +87,7 @@
         this.serviceName = (String) context.get("urn:avalon:name");
         this.serviceApplicationDir = (File) context.get("urn:avalon:home");
         this.serviceTempDir = (File) context.get("urn:avalon:temp");
+        this.classLoader = (ClassLoader) context.get("urn:avalon:classloader");
     }
 
     /**
@@ -232,6 +237,33 @@
     {
         return serviceTempDir;
     }
+    
+    /**
+		 * @return Returns the classLoader.
+		 */
+		protected ClassLoader getClassLoader() {
+			return this.classLoader;
+		}
+
+		/**
+     * Determines the file location of the given name. If the name denotes
+     * a relative file location it will be resolved using the application
+     * home directory.
+     *
+     * @param name the filename
+     * @return the file
+     */
+    protected File makeAbsoluteFile( String name )
+    {
+        File result = new File(name);
+
+        if( result.isAbsolute() == false )
+        {
+            result = new File( this.getServiceApplicationDir(), name );
+        }
+
+        return result;
+    }
 
     /**
      * @return Returns the serviceMap.
@@ -239,6 +271,5 @@
     private HashSet getServiceSet()
     {
         return serviceSet;
-    }
-
+    }      
 }

Added: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorService.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorService.java?rev=332597&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorService.java (added)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorService.java Fri Nov 11 08:51:11 2005
@@ -0,0 +1,31 @@
+package org.apache.fulcrum.yaafi.interceptor.jamon;
+
+/*
+ * Copyright 2004 Apache Software Foundation
+ * Licensed  under the  Apache License,  Version 2.0  (the "License");
+ * you may not use  this file  except in  compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService;
+
+/**
+ * A service using JAMON for performance monitoring
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public interface JamonInterceptorService extends AvalonInterceptorService, Runnable
+{
+    // This interface doesn't exposes any other methods
+}
\ No newline at end of file

Added: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorServiceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorServiceImpl.java?rev=332597&view=auto
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorServiceImpl.java (added)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/jamon/JamonInterceptorServiceImpl.java Fri Nov 11 08:51:11 2005
@@ -0,0 +1,382 @@
+package org.apache.fulcrum.yaafi.interceptor.jamon;
+
+/*
+ * Copyright 2004 Apache Software Foundation
+ * Licensed  under the  Apache License,  Version 2.0  (the "License");
+ * you may not use  this file  except in  compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed  under the  License is distributed on an "AS IS" BASIS,
+ * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.Reconfigurable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext;
+import org.apache.fulcrum.yaafi.framework.reflection.Clazz;
+import org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl;
+import org.apache.fulcrum.yaafi.interceptor.util.MethodToStringBuilderImpl;
+
+/**
+ * A service using JAMon for performance monitoring. The implementation
+ * relies on reflection to invoke JAMON to avoid compile-time coupling.
+ *
+ * @author <a href="mailto:siegfried.goeschl@it20one.at">Siegfried Goeschl</a>
+ */
+
+public class JamonInterceptorServiceImpl
+    extends BaseInterceptorServiceImpl
+    implements JamonInterceptorService, Reconfigurable, ThreadSafe, Disposable, Initializable
+{
+	/** are the JAMon classes in the classpath */
+	private boolean isJamonAvailable;
+
+    /** the file to hold the report */
+    private File reportFile;
+
+    /** the time in ms between two reports */
+    private long reportTimeout;
+
+    /** do we create a report during disposal of the service */
+    private boolean reportOnExit;
+
+    /** the time when the next report is due */
+    private long nextReportTimestamp;
+
+    /** the class for JAMon MonitorFactory */
+    private Class monitorFactoryClass;
+
+    /** the class name of the JAMon MonitorFactory */
+    private static final String MONITORFACTOTY_CLASSNAME = "com.jamonapi.MonitorFactory";
+
+    /////////////////////////////////////////////////////////////////////////
+    // Avalon Service Lifecycle Implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * Constructor
+     */
+    public JamonInterceptorServiceImpl()
+    {
+        super();
+    }
+
+    /**
+     * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure(Configuration configuration) throws ConfigurationException
+    {
+        String reportFileName = null;
+
+        super.configure(configuration);
+        this.reportTimeout = configuration.getChild("reportTimeout").getValueAsLong(0);
+
+        // parse the report file name
+
+        reportFileName = configuration.getChild("reportFile").getValue("./jamon.html");
+        this.reportFile = this.makeAbsoluteFile( reportFileName );
+
+        // determine when to create the next report
+
+        this.nextReportTimestamp = System.currentTimeMillis() + this.reportTimeout;
+
+        // do we create a report on disposal
+
+        this.reportOnExit = configuration.getChild("reportOnExit").getValueAsBoolean(false);
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Initializable#initialize()
+     */
+    public void initialize() throws Exception
+    {
+        ClassLoader classLoader = this.getClassLoader();
+
+        if (Clazz.hasClazz(classLoader, MONITORFACTOTY_CLASSNAME))
+        {
+            this.monitorFactoryClass = Clazz.getClazz(
+                classLoader,
+                MONITORFACTOTY_CLASSNAME
+                );
+
+            this.isJamonAvailable = true;
+        }
+        else
+        {
+            String msg = "The JamonInterceptorService is disabled since the JAMON classes are not found in the classpath";
+            this.getLogger().warn(msg);
+            this.isJamonAvailable = false;
+        }
+    }
+
+        /**
+     * @see org.apache.avalon.framework.configuration.Reconfigurable#reconfigure(org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void reconfigure(Configuration configuration) throws ConfigurationException
+    {
+        super.reconfigure(configuration);
+        this.configure(configuration);
+    }
+
+    /**
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
+     */
+    public void dispose()
+    {
+        if( this.reportOnExit )
+        {
+            this.getLogger().debug( "Creating JAMOM report ..." );
+            this.run();
+        }
+
+        this.monitorFactoryClass = null;
+        this.reportFile = null;
+    }
+
+    /////////////////////////////////////////////////////////////////////////
+    // Service interface implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * @see org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService#onEntry(org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext)
+     */
+    public void onEntry(AvalonInterceptorContext interceptorContext)
+    {
+        this.writeReport();
+
+        if( this.isJamonAvailable() && this.isServiceMonitored(interceptorContext ) )
+        {
+            this.createMonitor(interceptorContext);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService#onError(org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext, java.lang.Throwable)
+     */
+    public void onError(AvalonInterceptorContext interceptorContext,Throwable t)
+    {
+        if( this.isJamonAvailable() && this.isServiceMonitored(interceptorContext) )
+        {
+            Object monitor = this.getMonitor(interceptorContext);
+            this.stopMonitor(monitor);
+        }
+    }
+
+    /**
+     * @see org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorService#onExit(org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext, java.lang.Object)
+     */
+    public void onExit(AvalonInterceptorContext interceptorContext, Object result)
+    {
+        if( this.isJamonAvailable() && this.isServiceMonitored(interceptorContext) )
+        {
+            Object monitor = this.getMonitor(interceptorContext);
+            this.stopMonitor(monitor);
+        }
+    }
+    
+    /**
+     * Writes the JAMON report to the file system.
+     * 
+     * @see java.lang.Runnable#run()
+     */
+    public void run()
+    {
+        this.writeReport(this.reportFile);
+    }
+    
+    /////////////////////////////////////////////////////////////////////////
+    // Service Implementation
+    /////////////////////////////////////////////////////////////////////////
+
+    /**
+     * @return Returns the isJamonAvailable.
+     */
+    protected boolean isJamonAvailable()
+    {
+        return this.isJamonAvailable;
+    }
+
+    /**
+     * Creates a JAMON monitor
+     *
+     * @param interceptorContext the current interceptor context
+     */
+    protected void createMonitor(
+        AvalonInterceptorContext interceptorContext )
+    {
+        Method method = interceptorContext.getMethod();
+        MethodToStringBuilderImpl methodToStringBuilder = new MethodToStringBuilderImpl(method,0);
+        String monitorCategory = methodToStringBuilder.toString();
+        Object monitor = this.createMonitor(monitorCategory);
+        interceptorContext.getRequestContext().put(this.getServiceName(),monitor);
+    }
+
+    /**
+     * Gets the JAMON Monitor
+     *
+     * @param interceptorContext the current interceptor context
+     * @return the monitor
+     */
+    protected Object getMonitor(
+        AvalonInterceptorContext interceptorContext )
+    {
+        return interceptorContext.getRequestContext().remove(
+            this.getServiceName()
+            );
+    }
+
+    /**
+     * Write a report file
+     */
+    protected void writeReport()
+    {
+        if( this.reportTimeout > 0 )
+        {
+            long currTimestamp = System.currentTimeMillis();
+
+            if( currTimestamp > this.nextReportTimestamp )
+            {
+                this.nextReportTimestamp = currTimestamp + this.reportTimeout;
+                this.writeReport(this.reportFile);
+            }
+        }
+    }
+
+    /**
+     * Write the HTML report to the given destination.
+     *
+     * @param reportFile the report destination
+     */
+    protected void writeReport( File reportFile )
+    {
+        if( this.isJamonAvailable() )
+        {
+            PrintWriter printWriter = null;
+            String report = null;
+
+            try
+            {
+                if( this.getLogger().isDebugEnabled() )
+                {
+                    this.getLogger().debug( "Writing JAMOM report to " + reportFile.getAbsolutePath() );
+                }
+
+                FileOutputStream fos = new FileOutputStream( reportFile );
+                printWriter = new PrintWriter( fos );
+                report = this.createReport();
+                printWriter.write( report );
+                printWriter.close();
+            }
+            catch( Throwable t )
+            {
+                String msg = "Generating the JAMON report failed for " + reportFile.getAbsolutePath();
+                this.getLogger().error(msg,t);
+            }
+            finally
+            {
+                if( printWriter != null )
+                {
+                    printWriter.close();
+                    printWriter = null;
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates a JAMON monitor for the category name.
+     *
+     * @param category the category name
+     * @return the monitor
+     */
+    private Object createMonitor(String category)
+    {
+		Object result = null;
+		String methodName = "start";
+		Class[] signature = { String.class };
+		Object[] args = { category };
+		
+		// invoke MonitorFactory.start(String);
+
+        try
+        {
+            result = Clazz.invoke( this.monitorFactoryClass, methodName, signature, args );
+        }
+        catch (Exception e)
+        {
+            String msg = "Invoking com.jamonapi.MonitorFactory.start() failed";
+            this.getLogger().error( msg, e );
+        }
+
+        return result;
+    }
+
+    /**
+     * Stop the JAMON monitor.
+     *
+     * @param monitor the monitor to be stopped
+     */
+    private void stopMonitor( Object monitor )
+    {
+        String methodName = "stop";
+        Class[] signature = {};
+        Object[] args = {};
+
+        // invoke MonitorFactory.start(String);
+
+        try
+        {
+            Clazz.invoke(monitor, methodName, signature, args);
+        }
+        catch (Throwable t)
+        {
+            String msg = "Invoking com.jamonapi.MonitorFactory.start() failed";
+            this.getLogger().error(msg,t);
+        }
+    }
+
+    /**
+     * Create a JAMON report.
+     *
+     * @return the report
+     */
+    private String createReport()
+    {
+        String result = null;
+        Object rootMonitor = null;
+        Class[] signature = {};
+        Object[] args = {};
+
+        try
+        {
+            // invoke MonitorFactory.getRootMonitor().getReport()
+
+            rootMonitor = Clazz.invoke(this.monitorFactoryClass, "getRootMonitor", signature, args);
+            result = (String) Clazz.invoke(rootMonitor, "getReport", signature, args);
+        }
+        catch (Throwable t)
+        {
+            String msg = "Invoking com.jamonapi.MonitorFactory.getRootMonitor().getReport()() failed";
+            this.getLogger().error(msg,t);
+            result = "<" + t + ">";
+        }
+
+        return result;
+    }
+}

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/logging/LoggingInterceptorServiceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/logging/LoggingInterceptorServiceImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/logging/LoggingInterceptorServiceImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/logging/LoggingInterceptorServiceImpl.java Fri Nov 11 08:51:11 2005
@@ -25,10 +25,10 @@
 import org.apache.avalon.framework.configuration.Reconfigurable;
 import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext;
 import org.apache.fulcrum.yaafi.framework.reflection.Clazz;
-import org.apache.fulcrum.yaafi.framework.util.ExceptionUtils;
-import org.apache.fulcrum.yaafi.framework.util.StringUtils;
 import org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl;
-import org.apache.fulcrum.yaafi.interceptor.util.MethodToStringBuilder;
+import org.apache.fulcrum.yaafi.interceptor.util.InterceptorToStringBuilder;
+import org.apache.fulcrum.yaafi.interceptor.util.MethodToStringBuilderImpl;
+import org.apache.fulcrum.yaafi.interceptor.util.ArgumentToStringBuilderImpl;
 import org.apache.fulcrum.yaafi.interceptor.util.StopWatch;
 
 /**
@@ -45,18 +45,14 @@
     /** the maximum length of a dumped argument */
     private static final int MAX_ARG_LENGTH = 2000;
 
-    /** this matches all services */
-    private static final String STRING_BUILDER_CLASS =
-        "org.apache.commons.lang.builder.ReflectionToStringBuilder";
-
     /** seperator for the arguments in the logfile */
     private static final String SEPERATOR = ";";
 
-    /** maximumline lengthfor dumping arguments */
+    /** maximum argument length for dumping arguments */
     private int maxArgLength;
 
-    /** use ReflectionToStringBuilder if available */
-    boolean useReflection;
+    /** the class name of the string builder to use */
+    private String toStringBuilderClassName;
 
     /** monitor all excpetions independent from the monitored services */
     private boolean monitorAllExceptions;
@@ -75,7 +71,6 @@
     {
         super();
         this.maxArgLength = MAX_ARG_LENGTH;
-        this.useReflection = false;
     }
 
     /**
@@ -86,7 +81,7 @@
         super.configure(configuration);
         
         this.maxArgLength = configuration.getChild("maxArgLength").getValueAsInteger(MAX_ARG_LENGTH);
-        this.useReflection = configuration.getChild("useReflection").getValueAsBoolean(false);
+        this.toStringBuilderClassName = configuration.getChild("toStringBuilderClass").getValue(ArgumentToStringBuilderImpl.class.getName());
         this.monitorAllExceptions = configuration.getChild("monitorAllExceptions").getValueAsBoolean(true);
     }
 
@@ -95,17 +90,25 @@
      */
     public void initialize() throws Exception
     {
-        // load the ReflectionToStringBuilder class if available
+        // load the string builder class
 
         ClassLoader classLoader = this.getClass().getClassLoader();
 
-        if( Clazz.hasClazz(classLoader, STRING_BUILDER_CLASS) )
+        if( Clazz.hasClazz(classLoader, this.getToStringBuilderClassName()) )
         {
             this.toStringBuilderClass = Clazz.getClazz(
                 classLoader,
-                STRING_BUILDER_CLASS
+                this.getToStringBuilderClassName()
                 );
         }
+        
+        // create an instance of the StringBuilder to see if everything works
+        
+        InterceptorToStringBuilder interceptorToStringBuilder = this.createArgumentToStringBuilder(
+            this
+            );
+            
+        interceptorToStringBuilder.toString();        
     }
 
     /**
@@ -142,12 +145,15 @@
      */
     public void onError(AvalonInterceptorContext interceptorContext,Throwable t)
     {
-        if( this.isMonitorAllExceptions() || this.isServiceMonitored(interceptorContext) )
+        if( this.getLogger().isErrorEnabled() )
         {
-            StopWatch stopWatch = this.getStopWatch(interceptorContext);
-            stopWatch.stop();
-            String msg = this.toString(interceptorContext, stopWatch, t);
-            this.getLogger().error(msg);
+	        if( this.isMonitorAllExceptions() || this.isServiceMonitored(interceptorContext) )
+	        {
+	            StopWatch stopWatch = this.getStopWatch(interceptorContext);
+	            stopWatch.stop();
+	            String msg = this.toString(interceptorContext, stopWatch, t);
+	            this.getLogger().error(msg);
+	        }
         }
     }
 
@@ -231,19 +237,48 @@
     {
         return toStringBuilderClass;
     }
-
+    
     /**
-     * @return Returns the useReflection.
+     * @return Returns the toStringBuilderClassName.
      */
-    protected boolean isUseReflection()
+    protected String getToStringBuilderClassName()
     {
-        return useReflection;
+        return toStringBuilderClassName;
     }
-
+    
+    /**
+     * Create an instance of an InterceptorToStringBuilder
+     * 
+     * @param target the object to stringify
+     * @return the string builder
+     */
+    protected InterceptorToStringBuilder createArgumentToStringBuilder(Object target)
+    {
+        InterceptorToStringBuilder result = null;
+        
+        try
+        {
+            result = (InterceptorToStringBuilder) 
+            	this.getToStringBuilderClass().newInstance();
+        }
+        catch (Exception e)
+        {
+            String msg = "Unable to create an instance for " + this.getToStringBuilderClassName();
+            this.getLogger().error(msg,e);
+        }
+     
+        result.setTarget(target);
+        result.setMaxArgLength(this.getMaxArgLength());
+        result.setMode(1);
+        
+        return result;
+    }
+    
     /**
      * Create a string representation of a service invocation returning a result.
      *
      * @param avalonInterceptorContext the interceptor context
+     * @param stopWatch the stopwatch for the execution time
      * @param result the result of the service invocation
      * @return the string representation of the result
      */
@@ -253,11 +288,12 @@
         Object result )
     {
         StringBuffer methodSignature = new StringBuffer();
+        InterceptorToStringBuilder toStringBuilder = this.createArgumentToStringBuilder(result);
 
         methodSignature.append( this.toString(avalonInterceptorContext, stopWatch, ON_EXIT) );
         methodSignature.append(SEPERATOR);
         methodSignature.append( "result={" );
-        methodSignature.append( this.toString(result) );
+        methodSignature.append( toStringBuilder.toString() );
         methodSignature.append( "}" );
         
         return methodSignature.toString();
@@ -267,6 +303,7 @@
      * Create a string representation of a service invocation throwing a Throwable
      *
      * @param avalonInterceptorContext the interceptor context
+     * @param stopWatch the stopwatch for the execution time
      * @param throwable the result of the service invocation
      * @return the string representation of the result
      */
@@ -276,144 +313,23 @@
         Throwable throwable )
     {
         StringBuffer methodSignature = new StringBuffer();
+        InterceptorToStringBuilder toStringBuilder = this.createArgumentToStringBuilder(throwable);
 
         methodSignature.append( this.toString(avalonInterceptorContext, stopWatch, ON_ERROR) );
         methodSignature.append(SEPERATOR);
         methodSignature.append( throwable.getClass().getName() );
         methodSignature.append(SEPERATOR);
-        methodSignature.append( this.toString(throwable) );
+        methodSignature.append( toStringBuilder.toString() );
 
         return methodSignature.toString();
     }
 
     /**
-     * Create a String representation for an arbitrary object.
-     *
-     * @param object the object
-     * @return string representation
-     */
-    protected String toString(Object object)
-    {
-        StringBuffer stringBuffer = new StringBuffer();
-        boolean isTruncated = false;
-
-        if( object == null )
-        {
-            stringBuffer.append("<null>");
-        }
-        else
-        {
-            String temp = null;
-
-            // invoke ReflectionToStringBuilder.toString() if desired
-            // otherwise plain Object.toString()
-            
-            if( this.isUseReflection() && (this.getToStringBuilderClass() != null) )
-            {
-                String methodName = "toString";
-                Class[] signature = { Object.class };
-                Object[] args = { object };
-
-                try
-                {
-                    temp = (String) Clazz.invoke( this.getToStringBuilderClass(),
-                        methodName,
-                        signature,
-                        args
-                        );
-                }
-                catch (Throwable t)
-                {
-                    String msg = "Using ReflectionToStringBuilder failed";
-                    this.getLogger().error(msg,t);
-                    temp = object.toString();
-                }
-            }
-            else
-            {
-                temp = object.toString();
-            }
-
-            // trim the string to avoid dumping tons of data
-
-            if( temp.length() > this.getMaxArgLength() )
-            {
-                temp = temp.substring(0,this.getMaxArgLength()+1);
-                isTruncated = true;
-            }
-
-            // remove the line breaks and tabs for logging output and replace
-
-            temp = StringUtils.replaceChars(temp,"\r\n\t"," ");
-            temp = StringUtils.replaceChars(temp,SEPERATOR,"|");
-
-            // show the user that we truncated the ouptut
-
-            if( isTruncated )
-            {
-                stringBuffer.append( temp );
-                stringBuffer.append( "..." );
-            }
-            else
-            {
-                stringBuffer.append(temp);
-            }
-        }
-
-        return stringBuffer.toString();
-    }
-
-    /**
-     * Create a String representation for an excpeption.
-     *
-     * @param throwable the Throwable
-     * @return the string representation
-     */
-    protected String toString(Throwable throwable)
-    {
-        StringBuffer stringBuffer = new StringBuffer();
-
-        if( throwable == null )
-        {
-            stringBuffer.append("<null>");
-        }
-        else
-        {
-            stringBuffer.append('[');
-            String temp = ExceptionUtils.getStackTrace(throwable);
-
-            // trim the string to avoid dumping tons of data
-
-            if( temp.length() > this.getMaxArgLength() )
-            {
-                temp = temp.substring(0,this.getMaxArgLength()+1);
-            }
-
-            // show the user that we truncated the ouptut
-
-            if( temp.length() > this.getMaxArgLength() )
-            {                stringBuffer.append( temp );
-                stringBuffer.append( " ..." );
-                stringBuffer.append(']');
-
-            }
-            else
-            {
-                stringBuffer.append(temp);
-            }
-        }
-
-        String temp = stringBuffer.toString();        
-        temp = StringUtils.replaceChars(temp,"\r\n\t"," ");
-        temp = StringUtils.replaceChars(temp,SEPERATOR,"|");
-
-        return temp;
-    }
-
-    /**
      * Create a method signature.
      *
      * @param interceptorContext the avalonInterceptorContext
+     * @param stopWatch the stopwatch for the execution time
+     * @param mode the mode (onEntry, onExit, onError)
      * @return the debug output
      */
     protected String toString( 
@@ -422,7 +338,8 @@
         StringBuffer result = new StringBuffer();
         Method method = interceptorContext.getMethod();
         Object[] args = interceptorContext.getArgs();
-        MethodToStringBuilder methodToStringBuilder = new MethodToStringBuilder(method);
+        InterceptorToStringBuilder toStringBuilder = null;
+        MethodToStringBuilderImpl methodToStringBuilder = new MethodToStringBuilderImpl(method);
 
         if( args == null )
         {
@@ -458,9 +375,10 @@
         {
 	        for( int i=0; i<args.length; i++ )
 	        {
+	            toStringBuilder = this.createArgumentToStringBuilder(args[i]);
 	            result.append(SEPERATOR);
 	            result.append("arg[" + i + "]:={");
-	            result.append( this.toString(args[i]));
+	            result.append( toStringBuilder.toString());
 	            result.append("}");
 	        }
         }

Modified: jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java?rev=332597&r1=332596&r2=332597&view=diff
==============================================================================
--- jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java (original)
+++ jakarta/turbine/fulcrum/trunk/yaafi/src/java/org/apache/fulcrum/yaafi/interceptor/performance/PerformanceInterceptorServiceImpl.java Fri Nov 11 08:51:11 2005
@@ -26,7 +26,8 @@
 import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.fulcrum.yaafi.framework.interceptor.AvalonInterceptorContext;
 import org.apache.fulcrum.yaafi.interceptor.baseservice.BaseInterceptorServiceImpl;
-import org.apache.fulcrum.yaafi.interceptor.util.MethodToStringBuilder;
+import org.apache.fulcrum.yaafi.interceptor.util.ArgumentToStringBuilderImpl;
+import org.apache.fulcrum.yaafi.interceptor.util.MethodToStringBuilderImpl;
 import org.apache.fulcrum.yaafi.interceptor.util.StopWatch;
 
 /**
@@ -39,15 +40,21 @@
     extends BaseInterceptorServiceImpl
     implements PerformanceInterceptorService, Reconfigurable, Contextualizable, ThreadSafe
 {
+	  /** the maximum length of a dumped argument */
+	  private static final int MAX_ARG_LENGTH = 100;
+
     /** default length of the StringBuffer */
-    private static final int BUFFER_LENGTH = 1000;
+    private static final int BUFFER_LENGTH = 2000;
 
     /** seperator for the arguments in the logfile */
     private static final String SEPERATOR = ";";
 
     /** the tresholds in milliseconds to determine the loglevel */
     private int[] tresholdList;
-    
+
+    /** maximum argument length for dumping arguments */
+    private int maxArgLength;
+
     /////////////////////////////////////////////////////////////////////////
     // Avalon Service Lifecycle Implementation
     /////////////////////////////////////////////////////////////////////////
@@ -68,6 +75,7 @@
     {
         super.configure(configuration);
         
+        this.maxArgLength = configuration.getChild("maxArgLength").getValueAsInteger(MAX_ARG_LENGTH);
         Configuration tresholdConfiguration = configuration.getChild("tresholds");
         this.tresholdList[0] = tresholdConfiguration.getChild("fatal").getAttributeAsInteger("millis", 5000);
         this.tresholdList[1] = tresholdConfiguration.getChild("error").getAttributeAsInteger("millis", 1000);
@@ -180,7 +188,7 @@
         {
             if( this.getLogger().isFatalErrorEnabled() )
             {
-	            msg = this.toString(mode,interceptorContext,stopWatch);
+	            msg = this.toString(interceptorContext,stopWatch,mode);
 	            this.getLogger().fatalError(msg);
             }
         }
@@ -188,7 +196,7 @@
         {
             if( this.getLogger().isErrorEnabled() )
             {
-	            msg = this.toString(mode,interceptorContext,stopWatch);
+	            msg = this.toString(interceptorContext,stopWatch,mode);
 	            this.getLogger().error(msg);
             }
         }
@@ -196,7 +204,7 @@
         {
             if( this.getLogger().isWarnEnabled() )
             {
-	            msg = this.toString(mode,interceptorContext,stopWatch);
+	            msg = this.toString(interceptorContext,stopWatch,mode);
 	            this.getLogger().warn(msg);
             }
         }
@@ -204,7 +212,7 @@
         {
             if( this.getLogger().isInfoEnabled() )
             {
-	            msg = this.toString(mode,interceptorContext,stopWatch);
+	            msg = this.toString(interceptorContext,stopWatch,mode);
 	            this.getLogger().info(msg);
             }
         }
@@ -212,14 +220,10 @@
         {
             if( this.getLogger().isDebugEnabled() )
             {
-	            msg = this.toString(mode,interceptorContext,stopWatch);
+	            msg = this.toString(interceptorContext,stopWatch,mode);
 	            this.getLogger().debug(msg);
             }            
         }
-        else
-        {
-            // nothing to do
-        }
     }
     
     /**
@@ -227,16 +231,18 @@
      * 
      * @param interceptorContext the context
      * @param stopWatch the stopwatch
+     * @param mode the mode (onEntry, onExit, onError)
      * @return the log message
      */
     protected String toString(
-        int mode,
         AvalonInterceptorContext interceptorContext, 
-        StopWatch stopWatch 
+        StopWatch stopWatch,
+        int mode
         )
     {
         Method method = interceptorContext.getMethod();
-        MethodToStringBuilder methodToStringBuilder = new MethodToStringBuilder(method);
+        Object[] args = interceptorContext.getArgs();
+        MethodToStringBuilderImpl methodToStringBuilder = new MethodToStringBuilderImpl(method);
         StringBuffer result = new StringBuffer(BUFFER_LENGTH);
 
         result.append(interceptorContext.getTransactionId());
@@ -254,7 +260,41 @@
         result.append(stopWatch.getTime());        
         result.append(SEPERATOR);
         result.append(methodToStringBuilder.toString());
+        result.append(SEPERATOR);
+        result.append(this.toString(args));
 
         return result.toString();
     }
+    
+    /**
+     * Prints the argument list.
+     * 
+     * @return the debug output
+     */
+    protected String toString( Object[] args )
+    {
+        StringBuffer result = new StringBuffer();
+        ArgumentToStringBuilderImpl toStringBuilder = null;
+
+        if( args == null )
+        {
+            args = new Object[0];
+        }
+
+        for( int i=0; i<args.length; i++ )
+        {
+            toStringBuilder = new ArgumentToStringBuilderImpl(args[i],this.maxArgLength,1);
+            result.append("arg[" + i + "]:={");
+            result.append( toStringBuilder.toString());
+            result.append("}");
+            
+            if( i<args.length-1)
+            {
+            		result.append(SEPERATOR);
+            }
+        }
+        
+        return result.toString();
+    }   
+    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org