diff options
Diffstat (limited to 'archiva-modules/archiva-base')
22 files changed, 163 insertions, 38 deletions
diff --git a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml index 7e5ee9023..47832322c 100644 --- a/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-artifact-converter/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-artifact-converter</artifactId> <name>Archiva Artifact Converter</name> diff --git a/archiva-modules/archiva-base/archiva-checksum/pom.xml b/archiva-modules/archiva-base/archiva-checksum/pom.xml index bf525a970..5d7053fea 100644 --- a/archiva-modules/archiva-base/archiva-checksum/pom.xml +++ b/archiva-modules/archiva-base/archiva-checksum/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-checksum</artifactId> <name>Archiva Checksum</name> diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml index 91bdca84e..995be9b2f 100644 --- a/archiva-modules/archiva-base/archiva-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-common/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-common</artifactId> diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index bae414035..ee8903172 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-configuration</artifactId> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml index a3fb436eb..48b798bb9 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-consumer-api</artifactId> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml index 369262da9..8984cc707 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-core-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/pom.xml index 12c821016..3f9c5d677 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-dependency-tree-consumer/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-dependency-tree-consumer</artifactId> <name>Archiva Consumers :: Dependency Tree Consumer</name> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml index 928534dfc..a876293b2 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-lucene-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml index ac3e6748a..1b87b3f0b 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-metadata-consumer/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>archiva-consumers</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-metadata-consumer</artifactId> <name>Archiva Metadata Consumer</name> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml index f9532f446..1420afcab 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-signature-consumers/pom.xml @@ -20,7 +20,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-consumers</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-signature-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-consumers/pom.xml b/archiva-modules/archiva-base/archiva-consumers/pom.xml index 8a1bfefe6..cb4c056c6 100644 --- a/archiva-modules/archiva-base/archiva-consumers/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-consumers</artifactId> diff --git a/archiva-modules/archiva-base/archiva-converter/pom.xml b/archiva-modules/archiva-base/archiva-converter/pom.xml index fb94cdbde..4f3b253a4 100644 --- a/archiva-modules/archiva-base/archiva-converter/pom.xml +++ b/archiva-modules/archiva-base/archiva-converter/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-converter</artifactId> diff --git a/archiva-modules/archiva-base/archiva-indexer/pom.xml b/archiva-modules/archiva-base/archiva-indexer/pom.xml index a91eb5956..003784012 100644 --- a/archiva-modules/archiva-base/archiva-indexer/pom.xml +++ b/archiva-modules/archiva-base/archiva-indexer/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-indexer</artifactId> diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index e9d201a09..cd76560e2 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-model</artifactId> diff --git a/archiva-modules/archiva-base/archiva-policies/pom.xml b/archiva-modules/archiva-base/archiva-policies/pom.xml index 22f14c2c0..f9e44d9ca 100644 --- a/archiva-modules/archiva-base/archiva-policies/pom.xml +++ b/archiva-modules/archiva-base/archiva-policies/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-policies</artifactId> diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index 334b003ba..c2765c4e1 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-proxy</artifactId> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml index cff1aae3b..041f1e919 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-layer/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-repository-layer</artifactId> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/audit/AuditEvent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/audit/AuditEvent.java index ead95b502..ec3556562 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/audit/AuditEvent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/audit/AuditEvent.java @@ -19,13 +19,25 @@ package org.apache.maven.archiva.repository.audit; * under the License. */ +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.apache.archiva.metadata.model.MetadataFacet; + /** * AuditEvent - * + * * @version $Id$ */ public class AuditEvent + implements MetadataFacet { + public static final String TIMESTAMP_FORMAT = "yyyy/MM/dd/HHmmss.SSS"; + public static final String CREATE_DIR = "Created Directory"; public static final String CREATE_FILE = "Created File"; @@ -82,47 +94,51 @@ public class AuditEvent public static final String DISABLE_REPO_CONSUMER = "Disabled Content Consumer"; - public static final String ENABLE_DB_CONSUMER = "Enabled Database Consumer"; - - public static final String DISABLE_DB_CONSUMER = "Disabled Database Consumer"; - public static final String ADD_PATTERN = "Added File Type Pattern"; public static final String REMOVE_PATTERN = "Removed File Type Pattern"; - public static final String DB_SCHEDULE = "Modified Scanning Schedule"; - private String repositoryId; private String userId; private String remoteIP; + // TODO: change to artifact reference? does it ever refer to just a path? + private String resource; private String action; + private Date timestamp; + + public static final String FACET_ID = "org.apache.archiva.audit"; + public AuditEvent() { /* do nothing */ } + public AuditEvent( String name, String repositoryId ) + { + try + { + timestamp = new SimpleDateFormat( TIMESTAMP_FORMAT ).parse( name ); + } + catch ( ParseException e ) + { + throw new IllegalArgumentException( "Improperly formatted timestamp for audit log event: " + name ); + } + this.repositoryId = repositoryId; + } + public AuditEvent( String repoId, String user, String resource, String action ) { this.repositoryId = repoId; this.userId = user; this.resource = resource; this.action = action; - } - - public AuditEvent( String user, String resource, String action ) - { - this( null, user, resource, action ); - } - - public AuditEvent( String principal, String action2 ) - { - this( null, principal, action2 ); + this.timestamp = Calendar.getInstance().getTime(); } public String getRepositoryId() @@ -174,4 +190,113 @@ public class AuditEvent { this.remoteIP = remoteIP; } + + public Date getTimestamp() + { + return timestamp; + } + + public void setTimestamp( Date timestamp ) + { + this.timestamp = timestamp; + } + + public String getFacetId() + { + return FACET_ID; + } + + public String getName() + { + return new SimpleDateFormat( TIMESTAMP_FORMAT ).format( timestamp ); + } + + public Map<String, String> toProperties() + { + Map<String, String> properties = new HashMap<String, String>(); + properties.put( "action", this.action ); + if ( this.userId != null ) + { + properties.put( "user", this.userId ); + } + if ( this.remoteIP != null ) + { + properties.put( "remoteIP", this.remoteIP ); + } + if ( this.resource != null ) + { + properties.put( "resource", this.resource ); + } + return properties; + } + + public void fromProperties( Map<String, String> properties ) + { + this.action = properties.get( "action" ); + this.remoteIP = properties.get( "remoteIP" ); + this.userId = properties.get( "user" ); + this.resource = properties.get( "resource" ); + } + + @Override + public boolean equals( Object o ) + { + if ( this == o ) + { + return true; + } + if ( o == null || getClass() != o.getClass() ) + { + return false; + } + + AuditEvent that = (AuditEvent) o; + + if ( !action.equals( that.action ) ) + { + return false; + } + if ( remoteIP != null ? !remoteIP.equals( that.remoteIP ) : that.remoteIP != null ) + { + return false; + } + if ( repositoryId != null ? !repositoryId.equals( that.repositoryId ) : that.repositoryId != null ) + { + return false; + } + if ( resource != null ? !resource.equals( that.resource ) : that.resource != null ) + { + return false; + } + if ( !timestamp.equals( that.timestamp ) ) + { + return false; + } + if ( userId != null ? !userId.equals( that.userId ) : that.userId != null ) + { + return false; + } + + return true; + } + + @Override + public int hashCode() + { + int result = repositoryId != null ? repositoryId.hashCode() : 0; + result = 31 * result + ( userId != null ? userId.hashCode() : 0 ); + result = 31 * result + ( remoteIP != null ? remoteIP.hashCode() : 0 ); + result = 31 * result + ( resource != null ? resource.hashCode() : 0 ); + result = 31 * result + action.hashCode(); + result = 31 * result + timestamp.hashCode(); + return result; + } + + @Override + public String toString() + { + return "AuditEvent{" + "repositoryId='" + repositoryId + '\'' + ", userId='" + userId + '\'' + ", remoteIP='" + + remoteIP + '\'' + ", resource='" + resource + '\'' + ", action='" + action + '\'' + ", timestamp=" + + timestamp + '}'; + } } diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml index bafad290f..59a853f03 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-scanner/pom.xml @@ -23,7 +23,7 @@ <parent> <artifactId>archiva-base</artifactId> <groupId>org.apache.archiva</groupId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-repository-scanner</artifactId> <name>Archiva Repository Scanner</name> diff --git a/archiva-modules/archiva-base/archiva-transaction/pom.xml b/archiva-modules/archiva-base/archiva-transaction/pom.xml index a3a534604..1a6b7ba85 100644 --- a/archiva-modules/archiva-base/archiva-transaction/pom.xml +++ b/archiva-modules/archiva-base/archiva-transaction/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-transaction</artifactId> <name>Archiva Transactions</name> diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml index 0ef72ddcb..cc2214218 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml +++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-base</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>archiva-xml-tools</artifactId> diff --git a/archiva-modules/archiva-base/pom.xml b/archiva-modules/archiva-base/pom.xml index 8a23e35fb..6e79dcd2a 100644 --- a/archiva-modules/archiva-base/pom.xml +++ b/archiva-modules/archiva-base/pom.xml @@ -23,7 +23,7 @@ <parent> <groupId>org.apache.archiva</groupId> <artifactId>archiva-modules</artifactId> - <version>1.3-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </parent> <artifactId>archiva-base</artifactId> |