diff options
author | Jonathan Sharp <forjsharp@gmail.com> | 2014-10-17 15:23:47 -0700 |
---|---|---|
committer | Jonathan Sharp <forjsharp@gmail.com> | 2014-10-17 15:23:47 -0700 |
commit | 7c9267111a4eb6b8a47b8b4891af98c487dd0c9b (patch) | |
tree | 28731e9883086797a8f854170a86b06b8b91584d /archiva-modules/archiva-web/archiva-webdav | |
parent | d3687d86b46a9638a8bc74c1e24aeb829947cf8c (diff) | |
download | archiva-7c9267111a4eb6b8a47b8b4891af98c487dd0c9b.tar.gz archiva-7c9267111a4eb6b8a47b8b4891af98c487dd0c9b.zip |
MRM-813 tweak APC interface and ADRF AuditEvents
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
3 files changed, 10 insertions, 10 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java index f9a4d9e51..074d13bda 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResource.java @@ -442,13 +442,13 @@ public class ArchivaDavResource } } - private void triggerAuditEvent( DavResource member, String event ) + private void triggerAuditEvent( DavResource member, String action ) throws DavException { String path = logicalResource + "/" + member.getDisplayName(); ArchivaDavResource resource = checkDavResourceIsArchivaDavResource( member ); - AuditEvent auditEvent = new AuditEvent( locator.getRepositoryId(), resource.principal, path, event ); + AuditEvent auditEvent = new AuditEvent( locator.getRepositoryId(), resource.principal, path, action ); auditEvent.setRemoteIP( resource.remoteAddr ); for ( AuditListener listener : auditListeners ) diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 1e225a60a..31e2b881f 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -47,6 +47,7 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.ArtifactReference; import org.apache.archiva.policies.ProxyDownloadException; import org.apache.archiva.proxy.model.RepositoryProxyConnectors; +import org.apache.archiva.proxy.model.ProxyFetchResult; import org.apache.archiva.redback.authentication.AuthenticationException; import org.apache.archiva.redback.authentication.AuthenticationResult; import org.apache.archiva.redback.authorization.AuthorizationException; @@ -626,9 +627,7 @@ public class ArchivaDavResourceFactory { boolean previouslyExisted = resourceFile.exists(); - // Attempt to fetch the resource from any defined proxy. - boolean fromProxy = - fetchContentFromProxies( managedRepositoryContent, request, logicalResource ); + boolean fromProxy = fetchContentFromProxies( managedRepositoryContent, request, logicalResource ); // At this point the incoming request can either be in default or // legacy layout format. @@ -656,14 +655,14 @@ public class ArchivaDavResourceFactory if ( fromProxy ) { - String event = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE ) + String action = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE ) + PROXIED_SUFFIX; log.debug( "Proxied artifact '{}' in repository '{}' (current user '{}')", resourceFile.getName(), managedRepositoryContent.getId(), activePrincipal ); triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(), - logicalResource.getPath(), event, activePrincipal ); + logicalResource.getPath(), action, activePrincipal ); } if ( !resourceFile.exists() ) @@ -793,7 +792,7 @@ public class ArchivaDavResourceFactory // Is it a Metadata resource? if ( repositoryRequest.isDefault( path ) && repositoryRequest.isMetadata( path ) ) { - return connectors.fetchMetatadaFromProxies( managedRepository, path ) != null; + return connectors.fetchMetadataFromProxies( managedRepository, path ).isModified(); } // Is it an Archetype Catalog? diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java index b8e460e26..edb8ab3d4 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/ArchivaDavResourceFactoryTest.java @@ -33,6 +33,7 @@ import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.RepositoryGroupConfiguration; import org.apache.archiva.proxy.DefaultRepositoryProxyConnectors; +import org.apache.archiva.proxy.model.ProxyFetchResult; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.repository.RepositoryContentFactory; import org.apache.archiva.repository.content.legacy.LegacyPathParser; @@ -645,7 +646,7 @@ public class ArchivaDavResourceFactoryTest extends DefaultRepositoryProxyConnectors { @Override - public File fetchMetatadaFromProxies( ManagedRepositoryContent repository, String logicalPath ) + public ProxyFetchResult fetchMetadataFromProxies( ManagedRepositoryContent repository, String logicalPath ) { File target = new File( repository.getRepoRoot(), logicalPath ); try @@ -657,7 +658,7 @@ public class ArchivaDavResourceFactoryTest } - return target; + return new ProxyFetchResult( target, true ); } } } |