aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/audit
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2011-06-10 16:38:49 +0000
committerOlivier Lamy <olamy@apache.org>2011-06-10 16:38:49 +0000
commit8d497e85550282d2255f5a7596c02fe21ce4d031 (patch)
treeb3ab63511c50261b9dc2781ecc4e0fe47a6ccd86 /archiva-modules/plugins/audit
parente6a1d209a2e5a3849ba5cd73d0b96254f5580759 (diff)
downloadarchiva-8d497e85550282d2255f5a7596c02fe21ce4d031.tar.gz
archiva-8d497e85550282d2255f5a7596c02fe21ce4d031.zip
move audit plugin to spring annotations : it looks now mvn tomcat:run -Pdev works !!
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134378 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/audit')
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEventFactory.java4
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditListener.java2
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditLog.java4
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/Auditable.java6
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java2
-rw-r--r--archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java12
6 files changed, 21 insertions, 9 deletions
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEventFactory.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEventFactory.java
index f2572054f..f45db77f5 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEventFactory.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEventFactory.java
@@ -21,10 +21,12 @@ package org.apache.archiva.audit;
import org.apache.archiva.metadata.model.MetadataFacet;
import org.apache.archiva.metadata.model.MetadataFacetFactory;
+import org.springframework.stereotype.Service;
/**
- * @plexus.component role="org.apache.archiva.metadata.model.MetadataFacetFactory" role-hint="org.apache.archiva.audit"
+ * plexus.component role="org.apache.archiva.metadata.model.MetadataFacetFactory" role-hint="org.apache.archiva.audit"
*/
+@Service("metadataFacetFactory#org.apache.archiva.audit")
public class AuditEventFactory
implements MetadataFacetFactory
{
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditListener.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditListener.java
index 204f7ae5c..81d596fa9 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditListener.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditListener.java
@@ -31,5 +31,5 @@ public interface AuditListener
*
* @param event the event details.
*/
- public void auditEvent( AuditEvent event );
+ void auditEvent( AuditEvent event );
}
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditLog.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditLog.java
index f1b8c7fba..00d779c78 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditLog.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditLog.java
@@ -21,6 +21,7 @@ package org.apache.archiva.audit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
/**
* AuditLog - Audit Log.
@@ -28,6 +29,7 @@ import org.slf4j.LoggerFactory;
* @version $Id$
* @plexus.component role="org.apache.archiva.audit.AuditListener" role-hint="logging"
*/
+@Service("auditListener#logging")
public class AuditLog
implements AuditListener
{
@@ -43,7 +45,7 @@ public class AuditLog
*/
public void auditEvent( AuditEvent event )
{
- StringBuffer msg = new StringBuffer();
+ StringBuilder msg = new StringBuilder();
msg.append( checkNull( event.getRepositoryId() ) ).append( DELIM );
msg.append( event.getUserId() ).append( DELIM );
msg.append( checkNull( event.getRemoteIP() ) ).append( DELIM );
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/Auditable.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/Auditable.java
index b2655240c..0f2f47958 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/Auditable.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/Auditable.java
@@ -31,17 +31,17 @@ public interface Auditable
*
* @param the listener to add.
*/
- public void addAuditListener( AuditListener auditListener );
+ void addAuditListener( AuditListener auditListener );
/**
* Remove an AuditListener.
*
* @param the listener to remove.
*/
- public void removeAuditListener( AuditListener auditListener );
+ void removeAuditListener( AuditListener auditListener );
/**
* Remove all registered {@link AuditListener} objects.
*/
- public void clearAuditListeners();
+ void clearAuditListeners();
}
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java
index 187357429..d199b725d 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java
@@ -23,6 +23,7 @@ import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -37,6 +38,7 @@ import java.util.TimeZone;
/**
* @plexus.component role="org.apache.archiva.audit.AuditManager"
*/
+@Service("auditManager#default")
public class DefaultAuditManager
implements AuditManager
{
diff --git a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java
index 6c38d93a8..181a58ba9 100644
--- a/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java
+++ b/archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java
@@ -24,26 +24,32 @@ import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+import javax.inject.Inject;
/**
- * @plexus.component role="org.apache.archiva.audit.AuditListener" role-hint="metadata"
+ * plexus.component role="org.apache.archiva.audit.AuditListener" role-hint="metadata"
*/
+@Service("uuditListener#metadata")
public class MetadataAuditListener
implements AuditListener
{
private static final Logger log = LoggerFactory.getLogger( MetadataAuditListener.class );
/**
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private AuditManager auditManager;
/**
* FIXME: this could be multiple implementations and needs to be configured. It also starts a separate session to
* the originator of the audit event that we may rather want to pass through.
*
- * @plexus.requirement
+ * plexus.requirement
*/
+ @Inject
private RepositorySessionFactory repositorySessionFactory;
public void auditEvent( AuditEvent event )