continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jzurb...@apache.org
Subject svn commit: r766272 - in /continuum/trunk: continuum-purge/ continuum-purge/src/main/java/org/apache/continuum/purge/executor/ continuum-webapp/src/main/java/org/apache/continuum/web/util/ continuum-webapp/src/main/java/org/apache/maven/continuum/web/a...
Date Sat, 18 Apr 2009 08:51:09 GMT
Author: jzurbano
Date: Sat Apr 18 08:51:08 2009
New Revision: 766272

URL: http://svn.apache.org/viewvc?rev=766272&view=rev
Log:
modified logging [CONTINUUM-1853]

Added:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLog.java   (with props)
Modified:
    continuum/trunk/continuum-purge/pom.xml
    continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/AbstractContinuumPurgeExecutor.java
    continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutor.java
    continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutor.java
    continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutor.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildDefinitionTemplateAction.java
    continuum/trunk/continuum-webapp/src/main/resources/log4j.xml

Modified: continuum/trunk/continuum-purge/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/pom.xml?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/pom.xml (original)
+++ continuum/trunk/continuum-purge/pom.xml Sat Apr 18 08:51:08 2009
@@ -86,11 +86,6 @@
         </exclusion>
       </exclusions>
     </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <scope>runtime</scope>
-    </dependency>
     
     <!-- === Testing Dependencies === -->
     <dependency>

Modified: continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/AbstractContinuumPurgeExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/AbstractContinuumPurgeExecutor.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/AbstractContinuumPurgeExecutor.java (original)
+++ continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/AbstractContinuumPurgeExecutor.java Sat Apr 18 08:51:08 2009
@@ -38,10 +38,8 @@
 public abstract class AbstractContinuumPurgeExecutor
     implements ContinuumPurgeExecutor
 {
-    private static final char DELIM = ' ';
-
-    private Logger logger = LoggerFactory.getLogger( "AuditLog" );
-
+    private Logger log = LoggerFactory.getLogger( AbstractContinuumPurgeExecutor.class );
+    
     public void purge( Set<ArtifactReference> references, RepositoryManagedContent repository )
     {
         if ( references != null && !references.isEmpty() )
@@ -50,7 +48,7 @@
             {
                 File artifactFile = repository.toFile( reference );
                 artifactFile.delete();
-                triggerAuditEvent( artifactFile.getName(), ContinuumPurgeConstants.PURGE_ARTIFACT );
+                log.info( ContinuumPurgeConstants.PURGE_ARTIFACT + " - " + artifactFile.getName() );
                 purgeSupportFiles( artifactFile, artifactFile.getName() );
                 // purge maven metadata
                 purgeSupportFiles( artifactFile.getParentFile(), "maven-metadata" );
@@ -86,15 +84,8 @@
             if ( file.exists() && file.isFile() )
             {
                 file.delete();
-                triggerAuditEvent( file.getName(), ContinuumPurgeConstants.PURGE_FILE );
+                log.info( ContinuumPurgeConstants.PURGE_FILE + " - " + file.getName() );
             }
         }
     }
-    
-    protected void triggerAuditEvent( String resource, String action )
-    {
-        String msg = ContinuumPurgeConstants.PURGE + DELIM + "<continuum>" + DELIM + '\"' + resource + '\"' + DELIM + '\"' + action + '\"';
-        
-        logger.info( msg );
-    }
 }

Modified: continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutor.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutor.java (original)
+++ continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/CleanAllPurgeExecutor.java Sat Apr 18 08:51:08 2009
@@ -29,12 +29,17 @@
 import org.apache.maven.archiva.consumers.core.repository.ArtifactFilenameFilter;
 import org.codehaus.plexus.util.FileUtils;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * @author Maria Catherine Tan
  */
 public class CleanAllPurgeExecutor
     extends AbstractContinuumPurgeExecutor
 {
+    private Logger log = LoggerFactory.getLogger( CleanAllPurgeExecutor.class );
+    
     private final String purgeType;
 
     public CleanAllPurgeExecutor( String purgeType )
@@ -71,7 +76,7 @@
             throw new ContinuumPurgeExecutorException( "Error while purging all artifacts or directories in " + path,
                                                        e );
         }
-        triggerAuditEvent( path, ContinuumPurgeConstants.PURGE_REPO_CONTENTS );
+        log.info( ContinuumPurgeConstants.PURGE_REPO_CONTENTS + " - " + path );
     }
 
     private void purgeReleases( String path )
@@ -88,7 +93,7 @@
             for ( File releaseDir : releasesDir )
             {
                 FileUtils.deleteDirectory( releaseDir );
-                triggerAuditEvent( releaseDir.getName(), ContinuumPurgeConstants.PURGE_DIR_CONTENTS );
+                log.info( ContinuumPurgeConstants.PURGE_DIR_CONTENTS + " - " + releaseDir.getName() );
             }
         }
         catch ( IOException e )
@@ -111,7 +116,7 @@
             for ( File projectDir : projectsDir )
             {
                 FileUtils.cleanDirectory( projectDir );
-                triggerAuditEvent( projectDir.getName(), ContinuumPurgeConstants.PURGE_DIR_CONTENTS );
+                log.info( ContinuumPurgeConstants.PURGE_DIR_CONTENTS + " - " + projectDir.getName() );
             }
         }
         catch ( IOException e )

Modified: continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutor.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutor.java (original)
+++ continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/DaysOldDirectoryPurgeExecutor.java Sat Apr 18 08:51:08 2009
@@ -33,6 +33,9 @@
 import org.apache.continuum.purge.ContinuumPurgeConstants;
 import org.apache.maven.archiva.consumers.core.repository.ArtifactFilenameFilter;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * @author Maria Catherine Tan
  */
@@ -40,6 +43,8 @@
     extends AbstractContinuumPurgeExecutor
     implements ContinuumPurgeExecutor
 {
+    private Logger log = LoggerFactory.getLogger( DaysOldDirectoryPurgeExecutor.class );
+    
     private final int daysOlder;
 
     private final int retentionCount;
@@ -99,7 +104,7 @@
             {
                 try
                 {
-                    triggerAuditEvent( dir.getName(), ContinuumPurgeConstants.PURGE_DIR_CONTENTS );
+                    log.info( ContinuumPurgeConstants.PURGE_DIR_CONTENTS + " - " + dir.getName() );
                     FileUtils.deleteDirectory( dir );
                     countToPurge--;
                 }
@@ -147,12 +152,12 @@
                     try
                     {
                         FileUtils.deleteDirectory( buildDir );
-                        triggerAuditEvent( buildDir.getName(), ContinuumPurgeConstants.PURGE_DIR_CONTENTS );
+                        log.info( ContinuumPurgeConstants.PURGE_DIR_CONTENTS + " - " + buildDir.getName() );
                         File logFile = new File( buildDir.getAbsoluteFile() + ".log.txt" );
 
                         if ( logFile.exists() )
                         {
-                            triggerAuditEvent( logFile.getName(), ContinuumPurgeConstants.PURGE_FILE );
+                            log.info( ContinuumPurgeConstants.PURGE_FILE + " - " + logFile.getName() );
                             logFile.delete();
                         }
 

Modified: continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutor.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutor.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutor.java (original)
+++ continuum/trunk/continuum-purge/src/main/java/org/apache/continuum/purge/executor/ReleasedSnapshotsRepositoryPurgeExecutor.java Sat Apr 18 08:51:08 2009
@@ -34,6 +34,9 @@
 import org.apache.maven.archiva.repository.ContentNotFoundException;
 import org.apache.maven.archiva.repository.layout.LayoutException;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * Codes were taken from Archiva's CleanupReleasedSnapshotsRepositoryPurge and just made some few changes
  *
@@ -42,6 +45,8 @@
 public class ReleasedSnapshotsRepositoryPurgeExecutor
     extends AbstractContinuumPurgeExecutor
 {
+    private Logger log = LoggerFactory.getLogger( ReleasedSnapshotsRepositoryPurgeExecutor.class );
+    
     private final RepositoryManagedContent repository;
 
     public ReleasedSnapshotsRepositoryPurgeExecutor( RepositoryManagedContent repository )
@@ -108,7 +113,7 @@
                     versionRef.setVersion( version );
                     repository.deleteVersion( versionRef );
                     
-                    triggerAuditEvent( VersionedReference.toKey( versionRef ), ContinuumPurgeConstants.PURGE_PROJECT );
+                    log.info( ContinuumPurgeConstants.PURGE_PROJECT + " - " + VersionedReference.toKey( versionRef ) );
 
                     removeMetadata( versionRef );
                 }

Added: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLog.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLog.java?rev=766272&view=auto
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLog.java (added)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLog.java Sat Apr 18 08:51:08 2009
@@ -0,0 +1,114 @@
+package org.apache.continuum.web.util;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+
+/**
+ * @author Jevica Arianne B. Zurbano
+ * @version $Id: AuditLog.java
+ * @since 17 apr 09
+ */
+public class AuditLog
+{
+    private Logger logger = LoggerFactory.getLogger( AuditLog.class.getName() );
+
+    private String action;
+
+    private String category;
+    
+    private String resource;
+
+    private String currentUser;
+
+    public AuditLog( String action )
+    {
+        this.action = action;
+    }
+
+    public AuditLog( String resource, String action )
+    {
+        this.action = action;
+        this.resource = resource;
+    }
+
+    public void setCurrentUser( String currentUser )
+    {
+        this.currentUser = currentUser;
+    }
+
+    public String getCurrentUser()
+    {
+        return currentUser;
+    }
+
+    public void setResource( String resource )
+    {
+        this.resource = resource;
+    }
+
+    public String getResource()
+    {
+        return resource;
+    }
+
+    public void setCategory( String category )
+    {
+        this.category = category;
+    }
+
+    public String getCategory()
+    {
+        return category;
+    }
+
+    public void setAction( String action )
+    {
+        this.action = action;
+    }
+
+    public String getAction()
+    {
+        return action;
+    }
+
+    public void log()
+    {
+        if ( currentUser != null )
+        {
+            MDC.put( "security.currentUser", currentUser );
+        }
+        
+        if ( resource != null )
+        {
+            if ( category != null )
+            {
+                logger.info( category + " " + resource + " - " + action );
+            }
+            else
+            {
+                logger.info( resource + " - " + action );
+            }
+        }
+    }
+}
+

Propchange: continuum/trunk/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLog.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=766272&r1=766271&r2=766272&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 Sat Apr 18 08:51:08 2009
@@ -19,6 +19,11 @@
  * under the License.
  */
 
+/**
+ * @author Jevica Arianne B. Zurbano
+ * @version $Id: AuditLogConstants.java
+ * @since 09 apr 09
+ */
 public class AuditLogConstants
 {
     public static final String PROJECT = "PROJECT";
@@ -46,6 +51,8 @@
 
     public static final String ADD_M2_PROJECT = "Added M2 Project";
 
+    public static final String ADD_PROJECT = "Added Project";
+
     public static final String MODIFY_PROJECT = "Modified Project";
 
     public static final String REMOVE_PROJECT = "Removed Project";

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java Sat Apr 18 08:51:08 2009
@@ -19,16 +19,13 @@
  * under the License.
  */
 
-import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
-import java.io.InputStreamReader;
 import java.io.IOException;
 import java.util.List;
-import java.net.URL;
-import java.net.MalformedURLException;
 
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
@@ -64,14 +61,8 @@
     {
         ContinuumProjectBuildingResult result = null;
         
-        String groupId = "";
-        
-        String artifactId = "";
-        
-        String resource = "";
-
         // TODO: remove this part once uploading of an m2 project with modules is supported ( CONTINUUM-1098 )
-        if ( ( !checkProtocol ) || ( checkProtocol && pomUrl.startsWith( FILE_SCHEME ) ) )
+        if ( !checkProtocol )
         {
             MavenXpp3Reader m2pomReader = new MavenXpp3Reader();
 
@@ -91,14 +82,10 @@
                 }
 
                 Model model = m2pomReader.read( new FileReader( filePath ) );
-                
-                groupId = model.getGroupId();
-                artifactId = model.getArtifactId();
-                resource =  groupId + ":" + artifactId;
 
                 List modules = model.getModules();
 
-                if ( ( checkProtocol == false ) && ( modules != null && modules.size() != 0 ) )
+                if ( modules != null && modules.size() != 0 )
                 {
                     result = new ContinuumProjectBuildingResult();
                     result.addError( ERROR_UPLOADING_M2_PROJECT_WITH_MODULES );
@@ -117,41 +104,6 @@
                 throw new ContinuumException( ERROR_READING_POM_EXCEPTION_MESSAGE, e );
             }
         }
-        else
-        {
-            if ( ( pomUrl.startsWith( "http" ) ) && ( pomUrl.endsWith( "pom.xml" ) ) )
-            {
-                try
-                {
-                    URL url = new URL( pomUrl );
-                    BufferedReader in = new BufferedReader( new InputStreamReader( url.openStream() ) );
-                    StringBuilder content = new StringBuilder();
-                    String line = in.readLine();
-                    
-                    while ( line != null )
-                    {
-                        content.append( line );
-                        line = in.readLine();
-                    }
-                    in.close();
-                   
-                    if ( content.length() > 0 )
-                    {
-                        groupId = getSubString( content.toString(), "<groupId>", "</groupId>" );
-                        artifactId = getSubString( content.toString(), "<artifactId>", "</artifactId>" );
-                        resource = groupId + ":" + artifactId;
-                    }
-                }
-                catch ( MalformedURLException e )
-                {
-                    addActionError( ERROR_READING_POM_EXCEPTION_MESSAGE );
-                }
-                catch ( IOException e )
-                {
-                    throw new ContinuumException( ERROR_READING_POM_EXCEPTION_MESSAGE, e );
-                }
-            }
-        }
 
         if ( result == null )
         {
@@ -160,7 +112,10 @@
                                                         this.getBuildDefinitionTemplateId() );
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, resource, AuditLogConstants.ADD_M2_PROJECT );
+        AuditLog event = new AuditLog( pomUrl, AuditLogConstants.ADD_M2_PROJECT );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return result;
     }
@@ -206,15 +161,4 @@
     {
         this.nonRecursiveProject = nonRecursiveProject;
     }
-
-    private String getSubString( String content, String tagStart, String tagEnd )
-    {
-        String subString = "";
-        
-        int start = content.indexOf( tagStart ) + tagStart.length();
-        int end = content.indexOf( tagEnd );
-        subString = content.substring( start, end );
-        
-        return subString;
-    }
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java Sat Apr 18 08:51:08 2009
@@ -23,6 +23,8 @@
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
 import org.apache.maven.continuum.model.project.BuildDefinitionTemplate;
@@ -188,6 +190,11 @@
             this.setProjectGroupId( this.getSelectedProjectGroup() );
             return "projectGroupSummary";
         }
+        
+        AuditLog event = new AuditLog( projectNameTrim, AuditLogConstants.ADD_PROJECT );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java Sat Apr 18 08:51:08 2009
@@ -25,6 +25,7 @@
 
 import org.apache.continuum.model.repository.LocalRepository;
 import org.apache.continuum.repository.RepositoryServiceException;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.ProjectGroup;
@@ -153,7 +154,10 @@
             return ERROR;
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, name, AuditLogConstants.ADD_PROJECT_GROUP );
+        AuditLog event = new AuditLog( name, AuditLogConstants.ADD_PROJECT_GROUP );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java Sat Apr 18 08:51:08 2009
@@ -37,6 +37,7 @@
 import org.apache.maven.continuum.store.ContinuumStoreException;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
 import org.apache.maven.continuum.web.exception.ContinuumActionException;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -314,9 +315,11 @@
             return REQUIRES_AUTHORIZATION;
         }
         
-        Project proj = getContinuum().getProject( projectId );
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.BUILD_DEFINITION, proj.getGroupId() + ":" +
-                           proj.getArtifactId() + ":" + goals + " " + arguments, AuditLogConstants.ADD_GOAL );
+        String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+        AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+        event.setCategory( AuditLogConstants.BUILD_DEFINITION );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         if ( groupBuildView )
         {
@@ -364,8 +367,11 @@
 
         if ( projectId != 0 )
         {
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.BUILD_DEFINITION, getProjectGroupName() + ":" +
-                               goals + " " + arguments, AuditLogConstants.ADD_GOAL );
+            String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+            AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+            event.setCategory( AuditLogConstants.BUILD_DEFINITION );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
             return SUCCESS;
         }
         else
@@ -385,9 +391,11 @@
             {
                 getContinuum().removeBuildDefinitionFromProject( projectId, buildDefinitionId );
                 
-                Project proj = getContinuum().getProject( projectId );
-                triggerAuditEvent( getPrincipal(), AuditLogConstants.BUILD_DEFINITION, proj.getGroupId() + ":" +
-                                   proj.getArtifactId() + ":" + goals + " " + arguments, AuditLogConstants.REMOVE_GOAL );
+                String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+                AuditLog event = new AuditLog( resource, AuditLogConstants.REMOVE_GOAL );
+                event.setCategory( AuditLogConstants.BUILD_DEFINITION );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
 
                 return SUCCESS;
             }
@@ -417,8 +425,11 @@
             {
                 getContinuum().removeBuildDefinitionFromProjectGroup( projectGroupId, buildDefinitionId );
                 
-                triggerAuditEvent( getPrincipal(), AuditLogConstants.BUILD_DEFINITION, getProjectGroupName() + ":" +
-                                   goals + " " + arguments, AuditLogConstants.REMOVE_GOAL );
+                String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+                AuditLog event = new AuditLog( resource, AuditLogConstants.REMOVE_GOAL );
+                event.setCategory( AuditLogConstants.BUILD_DEFINITION );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
 
                 return SUCCESS;
             }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildProjectAction.java Sat Apr 18 08:51:08 2009
@@ -20,8 +20,8 @@
  */
 
 import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.codehaus.plexus.util.StringUtils;
 
@@ -79,11 +79,15 @@
                 getContinuum().buildProjects();
             }
         }
+        
+        AuditLog event = new AuditLog( AuditLogConstants.FORCE_BUILD );
+        event.setCurrentUser( getPrincipal() );
 
         if ( projectId > 0 )
         {
-            Project proj = getContinuum().getProject( projectId );
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, proj.getGroupId() + ":" + proj.getArtifactId(), AuditLogConstants.FORCE_BUILD );
+            event.setResource( "Project id=" + projectId );
+            event.setCategory( AuditLogConstants.PROJECT );
+            event.log();
 
             if ( fromGroupPage )
             {
@@ -96,7 +100,9 @@
         }
         else
         {
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT_GROUP, new Integer( projectGroupId ).toString(), AuditLogConstants.FORCE_BUILD );
+            event.setResource( "Project Group id=" + projectGroupId );
+            event.setCategory( AuditLogConstants.PROJECT_GROUP );
+            event.log();
         }
 
         return SUCCESS;

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java Sat Apr 18 08:51:08 2009
@@ -30,7 +30,7 @@
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.taskqueue.BuildProjectTask;
-import org.apache.continuum.web.util.AuditLogConstants;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
@@ -69,9 +69,10 @@
 
             buildsManager.cancelBuild( projectId );
 
-            Project proj = getContinuum().getProject( projectId );
-
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, proj.getGroupId() + ":" + proj.getArtifactId(), AuditLogConstants.CANCEL_BUILD );
+            AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.CANCEL_BUILD );
+            event.setCategory( AuditLogConstants.PROJECT );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
         }
         catch ( AuthorizationRequiredException e )
         {
@@ -112,8 +113,11 @@
 
                 int projId = projectsId[index];
                 getContinuum().getBuildsManager().cancelBuild( projectsId[index] );
-                Project proj = getContinuum().getProject( projId );
-                triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, proj.getGroupId() + ":" + proj.getArtifactId(), AuditLogConstants.CANCEL_BUILD );
+                
+                AuditLog event = new AuditLog( "Project id=" + projId, AuditLogConstants.CANCEL_BUILD );
+                event.setCategory( AuditLogConstants.PROJECT );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
             }
 
         }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ContinuumActionSupport.java Sat Apr 18 08:51:08 2009
@@ -35,9 +35,6 @@
 import org.codehaus.plexus.redback.system.SecuritySystemConstants;
 import org.codehaus.plexus.util.StringUtils;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
 /**
  * ContinuumActionSupport
  *
@@ -70,10 +67,6 @@
      */
     private Continuum continuum;
     
-    private Logger logger = LoggerFactory.getLogger( "AuditLog" );
-    
-    private static final char DELIM = ' ';
-
     protected final SimpleDateFormat dateFormatter = new SimpleDateFormat( "MMM dd, yyyy hh:mm:ss aaa z" );
 
     public void prepare()
@@ -568,21 +561,5 @@
             principal = "unknown-user";
         }
         return principal;
-    }
-    
-    /*
-     * resource formats:
-     *   project - {groupId}:{artifactId}
-     *           - {groupId}:{artifactId}:{version} for release prepare/perform
-     *   project group - {group_name}
-     *   build definition - {project_group}:{goals}
-     *   schedule - {name}:(cron)
-     */
-    protected void triggerAuditEvent( String user, String category, String resource, String action )
-    {
-        
-        String msg = category + DELIM + user + DELIM + '\"' + resource + '\"' + DELIM + '\"' + action + '\"';
-        
-        logger.info( msg );
     }    
 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/DeleteProjectAction.java Sat Apr 18 08:51:08 2009
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
@@ -52,9 +53,10 @@
             return REQUIRES_AUTHORIZATION;
         }
         
-        Project proj = getContinuum().getProject( projectId );
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, proj.getGroupId() + ":" +
-                           proj.getArtifactId(), AuditLogConstants.REMOVE_PROJECT );
+        AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.REMOVE_PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.log();
 
         getContinuum().removeProject( projectId );
 

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java Sat Apr 18 08:51:08 2009
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
@@ -80,8 +81,11 @@
 
         getContinuum().updateProject( project );
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, project.getGroupId() + ":" +
-                           project.getArtifactId(), AuditLogConstants.MODIFY_PROJECT );
+        String resource = project.getGroupId() + ":" + project.getArtifactId();
+        AuditLog event = new AuditLog( resource, AuditLogConstants.MODIFY_PROJECT );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java Sat Apr 18 08:51:08 2009
@@ -34,6 +34,7 @@
 import org.apache.continuum.buildmanager.BuildsManager;
 import org.apache.continuum.model.project.ProjectScmRoot;
 import org.apache.continuum.model.repository.LocalRepository;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -313,7 +314,10 @@
             return CONFIRM;
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, getProjectGroupName(), AuditLogConstants.REMOVE_PROJECT_GROUP );
+        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.REMOVE_PROJECT_GROUP );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }
@@ -533,7 +537,10 @@
             }
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, getProjectGroupName(), AuditLogConstants.MODIFY_PROJECT_GROUP );
+        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.MODIFY_PROJECT_GROUP );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }
@@ -560,7 +567,10 @@
             getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId );
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, getProjectGroupName(), AuditLogConstants.FORCE_BUILD );
+        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.FORCE_BUILD );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         if ( this.isFromSummaryPage() )
         {

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java Sat Apr 18 08:51:08 2009
@@ -22,6 +22,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildDefinition;
@@ -98,9 +99,10 @@
 
                 try
                 {
-                    Project proj = getContinuum().getProject( projectId );
-                    triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, proj.getGroupId() + ":" +
-                                       proj.getArtifactId(), AuditLogConstants.REMOVE_PROJECT );
+                    AuditLog event = new AuditLog( "Project id=" + selectedProject, AuditLogConstants.REMOVE_PROJECT );
+                    event.setCategory( AuditLogConstants.PROJECT );
+                    event.setCurrentUser( getPrincipal() );
+                    event.log();
 
                     getContinuum().removeProject( projectId );
                 }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java Sat Apr 18 08:51:08 2009
@@ -25,6 +25,7 @@
 import org.apache.continuum.release.distributed.DistributedReleaseUtil;
 import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
 import org.apache.continuum.web.action.AbstractReleaseAction;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.Project;
@@ -266,8 +267,11 @@
                                     repository );
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, project.getGroupId() + ":" +
-                           project.getArtifactId() + ":" + project.getVersion(), AuditLogConstants.PERFORM_RELEASE );
+        String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
+        AuditLog event = new AuditLog( resource, AuditLogConstants.PERFORM_RELEASE );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java Sat Apr 18 08:51:08 2009
@@ -23,6 +23,7 @@
 import org.apache.continuum.release.distributed.DistributedReleaseUtil;
 import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
 import org.apache.continuum.web.action.AbstractReleaseAction;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.installation.InstallationService;
@@ -344,8 +345,11 @@
                                         workingDirectory, environments, executable );
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, project.getGroupId() + ":" + project.getArtifactId() + ":" +
-                           project.getVersion(), AuditLogConstants.PREPARE_RELEASE );
+        String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
+        AuditLog event = new AuditLog( resource, AuditLogConstants.PREPARE_RELEASE );
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java Sat Apr 18 08:51:08 2009
@@ -24,6 +24,7 @@
 
 import org.apache.continuum.configuration.BuildAgentConfigurationException;
 import org.apache.continuum.release.distributed.manager.DistributedReleaseManager;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.utils.WorkingDirectoryService;
@@ -107,8 +108,11 @@
                 }
             }
             
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.PROJECT, project.getGroupId() + ":" +
-                               project.getArtifactId() + ":" + project.getVersion(), AuditLogConstants.ROLLBACK_RELEASE );
+            String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
+            AuditLog event = new AuditLog( resource, AuditLogConstants.ROLLBACK_RELEASE );
+            event.setCategory( AuditLogConstants.PROJECT );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
     
             releaseManager.getPreparedReleases().remove( releaseId );
         }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java Sat Apr 18 08:51:08 2009
@@ -26,6 +26,7 @@
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildQueue;
@@ -239,12 +240,16 @@
                 logger.debug( "Unexpected error getting schedule" );
             }
         }
+        AuditLog event = null;
         if ( id == 0 )
         {
             try
             {
                 getContinuum().addSchedule( setFields( new Schedule() ) );
-                triggerAuditEvent( getPrincipal(), AuditLogConstants.SCHEDULE, getName() + ":" + getCronExpression(), AuditLogConstants.ADD_SCHEDULE );
+                event = new AuditLog( getName(), AuditLogConstants.ADD_SCHEDULE );
+                event.setCategory( AuditLogConstants.SCHEDULE );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
             }
             catch ( ContinuumException e )
             {
@@ -258,7 +263,10 @@
             try
             {
                 getContinuum().updateSchedule( setFields( getContinuum().getSchedule( id ) ) );
-                triggerAuditEvent( getPrincipal(), AuditLogConstants.SCHEDULE, getName() + ":" + getCronExpression(), AuditLogConstants.MODIFY_SCHEDULE );
+                event = new AuditLog( getName(), AuditLogConstants.MODIFY_SCHEDULE );
+                event.setCategory( AuditLogConstants.SCHEDULE );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
             }
             catch ( ContinuumException e )
             {
@@ -332,8 +340,6 @@
             return REQUIRES_AUTHENTICATION;
         }
         
-        String resource = getContinuum().getSchedule( id ).getName() + ":" + getCronExpression();
-
         if ( confirmed )
         {
             try
@@ -355,7 +361,10 @@
             return CONFIRM;
         }
         
-        triggerAuditEvent( getPrincipal(), AuditLogConstants.SCHEDULE, resource, AuditLogConstants.REMOVE_SCHEDULE );
+        AuditLog event = new AuditLog( name, AuditLogConstants.REMOVE_SCHEDULE );
+        event.setCategory( AuditLogConstants.SCHEDULE );
+        event.setCurrentUser( getPrincipal() );
+        event.log();
 
         return SUCCESS;
     }

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildDefinitionTemplateAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildDefinitionTemplateAction.java?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildDefinitionTemplateAction.java (original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildDefinitionTemplateAction.java Sat Apr 18 08:51:08 2009
@@ -27,6 +27,7 @@
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.continuum.web.util.AuditLog;
 import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.builddefinition.BuildDefinitionServiceException;
@@ -134,18 +135,24 @@
         throws Exception
     {
         List<BuildDefinition> selectedBuildDefinitions = getBuildDefinitionsFromSelectedBuildDefinitions();
+        
+        AuditLog event = new AuditLog( buildDefinitionTemplate.getName(), AuditLogConstants.ADD_TEMPLATE );
+        event.setCategory( AuditLogConstants.TEMPLATE );
+        event.setCurrentUser( getPrincipal() );
+        
         if ( this.buildDefinitionTemplate.getId() > 0 )
         {
             buildDefinitionTemplate.setBuildDefinitions( selectedBuildDefinitions );
             this.getContinuum().getBuildDefinitionService().updateBuildDefinitionTemplate( buildDefinitionTemplate );
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.TEMPLATE, buildDefinitionTemplate.getName(), AuditLogConstants.MODIFY_TEMPLATE );
+            event.setAction( AuditLogConstants.MODIFY_TEMPLATE );
+            event.log();
         }
         else
         {
             buildDefinitionTemplate.setBuildDefinitions( selectedBuildDefinitions );
             this.buildDefinitionTemplate =
                 this.getContinuum().getBuildDefinitionService().addBuildDefinitionTemplate( buildDefinitionTemplate );
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.TEMPLATE, buildDefinitionTemplate.getName(), AuditLogConstants.ADD_TEMPLATE );
+            event.log();
         }
 
         return SUCCESS;
@@ -158,7 +165,12 @@
         {
             buildDefinitionTemplate = getContinuum().getBuildDefinitionService().getBuildDefinitionTemplate(
                 this.buildDefinitionTemplate.getId() );
-            triggerAuditEvent( getPrincipal(), AuditLogConstants.TEMPLATE, buildDefinitionTemplate.getName(), AuditLogConstants.REMOVE_TEMPLATE );
+            
+            AuditLog event = new AuditLog( buildDefinitionTemplate.getName(), AuditLogConstants.REMOVE_TEMPLATE );
+            event.setCategory( AuditLogConstants.TEMPLATE );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
+            
             this.getContinuum().getBuildDefinitionService().removeBuildDefinitionTemplate( buildDefinitionTemplate );
         }
         else

Modified: continuum/trunk/continuum-webapp/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/resources/log4j.xml?rev=766272&r1=766271&r2=766272&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/resources/log4j.xml (original)
+++ continuum/trunk/continuum-webapp/src/main/resources/log4j.xml Sat Apr 18 08:51:08 2009
@@ -29,13 +29,13 @@
       <param name="ConversionPattern" value="%d [%t] %-5p %c %x - %m%n"/>
     </layout>
   </appender>
-  
+
   <appender name="continuumAuditlog" class="org.apache.log4j.DailyRollingFileAppender">
     <param name="file" value="${appserver.base}/logs/continuum-audit.log" />
     <param name="append" value="true" />
     <param name="datePattern" value="'.'yyyy-MM-dd" />
     <layout class="org.apache.log4j.PatternLayout">
-      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %m%n"/>
+      <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} - %X{security.currentUser} - %m%n"/>
     </layout>
   </appender>
 
@@ -48,7 +48,7 @@
     </layout>
   </appender>
   
-  <logger name="AuditLog">
+  <logger name="org.apache.continuum.web.util.AuditLog" additivity="false">
     <level value="info" />
     <appender-ref ref="continuumAuditlog" />
   </logger>



Mime
View raw message