mirror of https://github.com/apache/archiva.git
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
This commit is contained in:
parent
e6a1d209a2
commit
8d497e8555
|
@ -50,12 +50,15 @@
|
|||
<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>
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -31,5 +31,5 @@ public interface AuditListener
|
|||
*
|
||||
* @param event the event details.
|
||||
*/
|
||||
public void auditEvent( AuditEvent event );
|
||||
void auditEvent( AuditEvent event );
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue