continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1332929 - in /continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web: action/admin/PurgeConfigurationAction.java util/AuditLogConstants.java
Date Wed, 02 May 2012 06:40:03 GMT
Author: ctan
Date: Wed May  2 06:40:03 2012
New Revision: 1332929

URL: http://svn.apache.org/viewvc?rev=1332929&view=rev
Log:
[CONTINUUM-2554] audit log forced directory and repository purges

Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java?rev=1332929&r1=1332928&r2=1332929&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/PurgeConfigurationAction.java
Wed May  2 06:40:03 2012
@@ -36,6 +36,8 @@ import org.apache.continuum.purge.Contin
 import org.apache.continuum.purge.PurgeConfigurationService;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.project.Schedule;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
@@ -298,6 +300,8 @@ public class PurgeConfigurationAction
         {
             purgeConfig = purgeConfigService.getPurgeConfiguration( purgeConfigId );
 
+            AuditLog event;
+            
             if ( purgeConfig instanceof RepositoryPurgeConfiguration )
             {
                 RepositoryPurgeConfiguration repoPurge = (RepositoryPurgeConfiguration) purgeConfig;
@@ -310,12 +314,29 @@ public class PurgeConfigurationAction
                 }
 
                 purgeManager.purgeRepository( repoPurge );
+
+                event = new AuditLog( repoPurge.getRepository().getName(), AuditLogConstants.PURGE_LOCAL_REPOSITORY
);
+                event.setCategory( AuditLogConstants.LOCAL_REPOSITORY );
             }
             else
             {
                 DirectoryPurgeConfiguration dirPurge = (DirectoryPurgeConfiguration) purgeConfig;
                 purgeManager.purgeDirectory( dirPurge );
+
+                if ( dirPurge.getDirectoryType().equals( PURGE_DIRECTORY_RELEASES ) )
+                {
+                    event = new AuditLog( dirPurge.getLocation(), AuditLogConstants.PURGE_DIRECTORY_RELEASES
);
+                }
+                else
+                {
+                    event = new AuditLog( dirPurge.getLocation(), AuditLogConstants.PURGE_DIRECTORY_BUILDOUTPUT
);
+                }
+
+                event.setCategory( AuditLogConstants.DIRECTORY );
             }
+
+            event.setCurrentUser( getPrincipal() );
+            event.log();
         }
 
         return SUCCESS;

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java?rev=1332929&r1=1332928&r2=1332929&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
Wed May  2 06:40:03 2012
@@ -44,6 +44,8 @@ public class AuditLogConstants
 
     public static final String LOCAL_REPOSITORY = "LOCAL_REPOSITORY";
 
+    public static final String DIRECTORY = "DIRECTORY";
+
     // events
     public static final String FORCE_BUILD = "Forced Project Build";
 
@@ -103,6 +105,10 @@ public class AuditLogConstants
 
     public static final String PURGE_LOCAL_REPOSITORY = "Purged Local Repository";
 
+    public static final String PURGE_DIRECTORY_RELEASES = "Purged Releases Directory";
+
+    public static final String PURGE_DIRECTORY_BUILDOUTPUT = "Purged Build Output Directory";
+
     public static final String ADD_BUILD_AGENT = "Added Build Agent";
 
     public static final String ADD_BUILD_AGENT_GROUP = "Added Build Agent Group";



Mime
View raw message