]> source.dussan.org Git - archiva.git/commitdiff
move audit plugin to spring annotations : it looks now mvn tomcat:run -Pdev works !!
authorOlivier Lamy <olamy@apache.org>
Fri, 10 Jun 2011 16:38:49 +0000 (16:38 +0000)
committerOlivier Lamy <olamy@apache.org>
Fri, 10 Jun 2011 16:38:49 +0000 (16:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1134378 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditEventFactory.java
archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditListener.java
archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/AuditLog.java
archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/Auditable.java
archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/DefaultAuditManager.java
archiva-modules/plugins/audit/src/main/java/org/apache/archiva/audit/MetadataAuditListener.java
archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileRepositorySessionFactory.java

index d65c5fbd7bd04cddab15bd57b64cd9b45c44fda8..ad1853073d700552539d87db187a16caa3dd9a27 100644 (file)
     <constructor-arg ref="nexusSearch"/>
   </bean>
 
+  <alias name="repositoryStatisticsManager#default" alias="repositoryStatisticsManager"/>
+  <!-- TODO olamy need to find a more dynamic way if using jcr impl -->
+  <alias name="repositorySessionFactory#file" alias="repositorySessionFactory"/>
   <!-- Web Services : Administration Service -->
   <bean name="administrationService" lazy-init="true" scope="singleton"
         class="org.apache.archiva.web.xmlrpc.services.AdministrationServiceImpl">
     <constructor-arg ref="archivaConfiguration"/>
     <constructor-arg ref="repositoryContentConsumers"/>
-    <constructor-arg ref="repositoryContentFactory"/>
+    <constructor-arg ref="repositoryContentFactory#default"/>
     <constructor-arg ref="repositorySessionFactory"/>
     <constructor-arg ref="archivaTaskScheduler#repository"/>
     <constructor-arg>
@@ -64,7 +67,7 @@
     <constructor-arg ref="repositoryStatisticsManager"/>
     <constructor-arg ref="repositoryMerger#maven2"/>
     <constructor-arg ref="auditListener#logging"/>
-    <constructor-arg ref="registry#commons-configuration"/>
+    <constructor-arg ref="commons-configuration"/>
 
   </bean>
 
index f2572054f3d7865446301cc4836050d3c2672b2d..f45db77f5ffc7a4c0e5301e3a09117644eeb14c0 100644 (file)
@@ -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
 {
index 204f7ae5cf9abbfa543ae80660ebe711a542808d..81d596fa9c90500ff944252f24f50cd26aef7627 100644 (file)
@@ -31,5 +31,5 @@ public interface AuditListener
      * 
      * @param event the event details.
      */
-    public void auditEvent( AuditEvent event );
+    void auditEvent( AuditEvent event );
 }
index f1b8c7fba1fad4ac742a3641ba11f021abdcdab5..00d779c789c2bc04abcd47007316e94d3569e537 100644 (file)
@@ -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 );
index b2655240c1f6a36f549a8915461e10a20b209051..0f2f4795889850e97fe0d19603fd6ebc9ade5c95 100644 (file)
@@ -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();
 }
index 1873574296029817508976b6f672ce0a643da1f2..d199b725db254aabfc69400b2d9da4b79685fb67 100644 (file)
@@ -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
 {
index 6c38d93a874b8bd949702ecee6f117e644f0f54c..181a58ba9fbf368d58a2614f557a3800bb9be531 100644 (file)
@@ -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 )
index 9b3ea500ed73d02406610714ea05054b14a61b6c..3b2f027502165bb10a078351337f91861578469b 100644 (file)
@@ -43,7 +43,7 @@ public class FileRepositorySessionFactory
     implements RepositorySessionFactory
 {
     /**
-     * @plexus.requirement role="org.apache.archiva.metadata.model.MetadataFacetFactory"
+     * plexus.requirement role="org.apache.archiva.metadata.model.MetadataFacetFactory"
      */
     private Map<String, MetadataFacetFactory> metadataFacetFactories;