You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2004/06/02 05:43:31 UTC

svn commit: rev 20750 - incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi

Author: akarasulu
Date: Tue Jun  1 20:43:30 2004
New Revision: 20750

Modified:
   incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/LoggingProfileDAOMonitor.java
   incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/ProfileDAOMonitor.java
Log:
Commit changes ...

 o documented profile dao monitor interface callbacks 
 o implemented methods for the profile dao's logging monitor



Modified: incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/LoggingProfileDAOMonitor.java
==============================================================================
--- incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/LoggingProfileDAOMonitor.java	(original)
+++ incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/LoggingProfileDAOMonitor.java	Tue Jun  1 20:43:30 2004
@@ -27,9 +27,262 @@
  * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public abstract class LoggingProfileDAOMonitor implements ProfileDAOMonitor
+public class LoggingProfileDAOMonitor implements ProfileDAOMonitor
 {
     /** the log used by this logging monitor */
-    private Log log = LogFactory.getLog( ApplicationDAO.class ) ;
+    private Log log = LogFactory.getLog( ProfileDAO.class ) ;
 
+
+    public void failedOnLookup( ProfileDAO dao, String appName,
+                                String userName, Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed too lookup a profile for "
+                        + userName + " on application " + appName + ": "
+                        + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnCleanupOperation( ProfileDAO dao, String op,
+                                          Object resource, Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed too cleanup resource " + resource
+                        + ": " + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void cleanedUp( ProfileDAO dao, String op, Object resource )
+    {
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao + " called " + resource + "." + op +
+                        " to cleanup resource" ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnHas( ProfileDAO dao, String appName, String userName,
+                             Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed while checking for user " + userName
+                        + " profile on application " + appName + ": "
+                        + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void profileExists( ProfileDAO dao, String appName,
+                               String userName )
+    {
+        try
+        {
+            if ( log.isWarnEnabled() )
+            {
+                log.warn( dao + " failed to create profile for user "
+                        + userName + " on application " + appName
+                        + " because that profile already exists" ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnCreate( ProfileDAO dao, String appName,
+                                String userName, Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed too create profile for user " + userName
+                        + " on application " + appName +": "
+                        + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnDelete( ProfileDAO dao, Object info, String appName,
+                                String userName, Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed on delete of profile for user " + userName
+                        + " on application " + appName + ": " + info + ": "
+                        + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnDelete( ProfileDAO dao, String appName,
+                                String userName, Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed on delete of profile for user " + userName
+                        + " on application " + appName + ": "
+                        + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void profileDeleted( ProfileDAO dao, String appName,
+                                String userName )
+    {
+        try
+        {
+            if ( log.isDebugEnabled() )
+            {
+                log.debug( dao
+                        + " deleted profile for user " + userName
+                        + " on application " + appName ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void constraintViolationOnDelete( ProfileDAO dao, String appName,
+                                             String userName )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " delete operation on profile for user " + userName
+                        + " on application " + appName
+                        + " violated constraint: check to see roles are not "
+                        + "assigned to this profile." ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnListUserNames( ProfileDAO dao, String appName,
+                                       Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed listing users with profiles for application "
+                        + appName + ": " + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnListApplicationNames( ProfileDAO dao, String userName,
+                                              Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao
+                        + " failed listing applications with profiles for user "
+                        + userName + ": " + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
+
+
+    public void failedOnUpdate( ProfileDAO dao, String appName,
+                                String userName, byte[] grants,
+                                byte[] denials, byte[] permissions,
+                                Throwable fault )
+    {
+        try
+        {
+            if ( log.isErrorEnabled() )
+            {
+                log.error( dao + " to update profiles for user " + userName
+                        + " on application " + appName + ": "
+                        + fault.getMessage() ) ;
+            }
+        }
+        catch ( Throwable t )
+        {
+            log.warn( "monitor failure", t ) ;
+        }
+    }
 }

Modified: incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/ProfileDAOMonitor.java
==============================================================================
--- incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/ProfileDAOMonitor.java	(original)
+++ incubator/directory/rms/trunk/spi/src/java/org/apache/rms/spi/ProfileDAOMonitor.java	Tue Jun  1 20:43:30 2004
@@ -17,10 +17,6 @@
 package org.apache.rms.spi ;
 
 
-import java.io.UnsupportedEncodingException;
-import java.io.IOException;
-
-
 /**
  * The monitor interface for a Profile data access object.
  * 
@@ -29,51 +25,157 @@
  */
 public interface ProfileDAOMonitor
 {
+    /**
+     * Callback method used to monitor failures to lookup a profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     * @param fault the failure that caused this event
+     */
     void failedOnLookup( ProfileDAO dao, String appName, String userName,
                          Throwable fault ) ;
 
 
+    /**
+     * Callback method used to monitor failures to cleanup DAO resources.
+     *
+     * @param dao the data access object attempting the operation
+     * @param op the name of the cleanup operation on the resource
+     * @param resource the resource being cleaned up
+     * @param fault the failure that caused this event
+     */
     void failedOnCleanupOperation( ProfileDAO dao, String op, Object resource,
                                    Throwable fault ) ;
 
-
+    /**
+     * Callback method used to monitor failures to lookup a profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param op the name of the cleanup operation on the resource
+     * @param resource the resource being cleaned up
+     */
     void cleanedUp( ProfileDAO dao, String op, Object resource ) ;
 
 
+    /**
+     * Callback method used to monitor failures to check for a profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     * @param fault the failure that caused this event
+     */
     void failedOnHas( ProfileDAO dao, String appName, String userName,
                       Throwable fault ) ;
 
 
+    /**
+     * Callback method used to monitor failures to create a profile because
+     * it already exists.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     */
     void profileExists( ProfileDAO dao, String appName, String userName ) ;
 
 
+    /**
+     * Callback method used to monitor failures to create a profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     * @param fault the failure that caused this event
+     */
     void failedOnCreate( ProfileDAO dao, String appName, String userName,
                          Throwable fault ) ;
 
 
+    /**
+     * Callback method used to monitor failures to delete a profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param info dap implementation specific information if any
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     * @param fault the failure that caused this event
+     */
     void failedOnDelete( ProfileDAO dao, Object info,
                          String appName, String userName, Throwable fault ) ;
 
 
+    /**
+     * Callback method used to monitor failures to delete a profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     * @param fault the failure that caused this event
+     */
     void failedOnDelete( ProfileDAO dao, String appName, String userName,
                          Throwable fault ) ;
 
 
+    /**
+     * Callback method used to monitor profile deletions.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     */
     void profileDeleted( ProfileDAO dao, String appName, String userName ) ;
 
 
+    /**
+     * Callback method used to monitor failures to delete a profile due to some
+     * constraint violations.  This often results when roles are assigned to
+     * profiles and not removed before attempting to delete the profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     */
     void constraintViolationOnDelete( ProfileDAO dao, String appName,
                                       String userName ) ;
 
 
+    /**
+     * Callback method used to monitor failures to list the user that have a
+     * profile for some application.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param fault the failure that caused this event
+     */
     void failedOnListUserNames( ProfileDAO dao, String appName,
                                 Throwable fault ) ;
 
 
-    void failedOnListApplicationNames( ProfileDAO dao, 
+    /**
+     * Callback method used to monitor failures to list the applications that
+     * have a profile for a user.
+     *
+     * @param dao the data access object attempting the operation
+     * @param userName the name of the Profile user
+     * @param fault the failure that caused this event
+     */
+    void failedOnListApplicationNames( ProfileDAO dao,
                                        String userName, Throwable fault ) ;
 
 
+    /**
+     * Callback method used to monitor failures to update a user's profile.
+     *
+     * @param dao the data access object attempting the operation
+     * @param appName the name of the Profile application
+     * @param userName the name of the Profile user
+     * @param grants the grant bits of permissions granted to the profile
+     * @param denials the bits of permissions explicitly denied for the profile
+     * @param permissions the effective computed permissions for the profile
+     * @param fault the failure that caused this event
+     */
     void failedOnUpdate( ProfileDAO dao, String appName, String userName,
                          byte[] grants, byte[] denials, byte[] permissions,
                          Throwable fault ) ;