diff options
author | Olivier Lamy <olamy@apache.org> | 2014-03-26 06:02:09 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-03-26 06:02:09 +0000 |
commit | 0bfb850c1b9b4c01980ffe60f4931bb97fd7183b (patch) | |
tree | cb471825abbd0cbd2b2bcf42e31337d8ba01011a /archiva-modules | |
parent | 07bae44727657923d378e9d981c6cb419b0059d9 (diff) | |
download | archiva-0bfb850c1b9b4c01980ffe60f4931bb97fd7183b.tar.gz archiva-0bfb850c1b9b4c01980ffe60f4931bb97fd7183b.zip |
some cleanup
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1581702 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules')
8 files changed, 35 insertions, 176 deletions
diff --git a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java index 6a8f93f80..eb7648bdf 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java +++ b/archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java @@ -50,6 +50,7 @@ public interface MetadataRepository /** * create the namespace in the repository. (if not exist) + * * @param repositoryId * @param namespace * @throws MetadataRepositoryException @@ -61,12 +62,11 @@ public interface MetadataRepository throws MetadataRepositoryException; /** - * * @param repositoryId * @param facetId * @return true if the repository datas for this facetId - * @since 1.4-M4 * @throws MetadataRepositoryException + * @since 1.4-M4 */ boolean hasMetadataFacet( String repositoryId, String facetId ) throws MetadataRepositoryException; @@ -85,9 +85,10 @@ public interface MetadataRepository /** * if startTime or endTime are <code>null</code> they are not used for search + * * @param repositoryId - * @param startTime can be <code>null</code> - * @param endTime can be <code>null</code> + * @param startTime can be <code>null</code> + * @param endTime can be <code>null</code> * @return * @throws MetadataRepositoryException */ @@ -118,6 +119,7 @@ public interface MetadataRepository /** * FIXME need a unit test!!! * Only remove {@link MetadataFacet} for the artifact + * * @param repositoryId * @param namespace * @param project @@ -152,6 +154,7 @@ public interface MetadataRepository /** * basically just checking it exists not complete data returned + * * @param repoId * @param namespace * @param projectId @@ -186,7 +189,6 @@ public interface MetadataRepository throws MetadataResolutionException; /** - * * @param repoId * @param namespace * @return {@link Collection} of child namespaces of the namespace argument @@ -195,9 +197,22 @@ public interface MetadataRepository Collection<String> getNamespaces( String repoId, String namespace ) throws MetadataResolutionException; + /** + * @param repoId + * @param namespace + * @return + * @throws MetadataResolutionException + */ Collection<String> getProjects( String repoId, String namespace ) throws MetadataResolutionException; + /** + * @param repoId + * @param namespace + * @param projectId + * @return + * @throws MetadataResolutionException + */ Collection<String> getProjectVersions( String repoId, String namespace, String projectId ) throws MetadataResolutionException; @@ -212,12 +227,21 @@ public interface MetadataRepository void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion ) throws MetadataRepositoryException; + /** + * @param repoId + * @param namespace + * @param projectId + * @param projectVersion + * @return + * @throws MetadataResolutionException + */ Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId, String projectVersion ) throws MetadataResolutionException; /** * remove a project + * * @param repositoryId * @param namespace * @param projectId @@ -244,6 +268,6 @@ public interface MetadataRepository boolean canObtainAccess( Class<?> aClass ); - <T>T obtainAccess( Class<T> aClass ) + <T> T obtainAccess( Class<T> aClass ) throws MetadataRepositoryException; } diff --git a/archiva-modules/plugins/metadata-store-cassandra/pom.xml b/archiva-modules/plugins/metadata-store-cassandra/pom.xml index 7d6b6570f..8703d93ef 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/pom.xml +++ b/archiva-modules/plugins/metadata-store-cassandra/pom.xml @@ -75,12 +75,6 @@ <artifactId>modelmapper</artifactId> </dependency> - - <dependency> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jpa_2.0_spec</artifactId> - </dependency> - <dependency> <groupId>org.apache.cassandra</groupId> <artifactId>cassandra-all</artifactId> diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java index f49433202..a645d5dbe 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java @@ -1030,8 +1030,7 @@ public class CassandraMetadataRepository String key = result.get().iterator().next().getKey(); - ColumnFamilyResult<String, String> columnFamilyResult = - this.projectVersionMetadataTemplate.queryColumns( key ); + ColumnFamilyResult<String, String> columnFamilyResult = this.projectVersionMetadataTemplate.queryColumns( key ); if ( !columnFamilyResult.hasResults() ) { @@ -1547,9 +1546,8 @@ public class CassandraMetadataRepository .addEqualsExpression( "repositoryName", artifactMetadataModel.getRepositoryId() ) // .addEqualsExpression( "namespaceId", artifactMetadataModel.getNamespace() ) // .addEqualsExpression( "projectId", artifactMetadataModel.getProject() ) // - .addEqualsExpression( "projectVersion", - artifactMetadataModel.getProjectVersion() ).addEqualsExpression( "facetId", - facetId ) // + .addEqualsExpression( "projectVersion", artifactMetadataModel.getProjectVersion() ) // + .addEqualsExpression( "facetId", facetId ) // .execute(); for ( Row<String, String, String> row : result.get().getList() ) @@ -1686,23 +1684,12 @@ public class CassandraMetadataRepository { for ( Map.Entry<String, String> entry : metadataFacet.toProperties().entrySet() ) { - String key = new MetadataFacetModel.KeyBuilder().withRepositoryId( repositoryId ).withFacetId( metadataFacet.getFacetId() ).withName( metadataFacet.getName() ).withKey( entry.getKey() ).build(); boolean exists = this.metadataFacetTemplate.isColumnsExist( key ); if ( !exists ) { - //metadataFacetModel = new MetadataFacetModel(); - // we need to store the repositoryId - //ArtifactMetadataModel artifactMetadataModel = new ArtifactMetadataModel(); - //artifactMetadataModel.setRepositoryId( repositoryId ); - //metadataFacetModel.setArtifactMetadataModel( artifactMetadataModel ); - //metadataFacetModel.setId( key ); - //metadataFacetModel.setKey( entry.getKey() ); - //metadataFacetModel.setFacetId( metadataFacet.getFacetId() ); - //metadataFacetModel.setName( metadataFacet.getName() ); - String cf = this.cassandraArchivaManager.getMetadataFacetFamilyName(); this.metadataFacetTemplate.createMutator() // .addInsertion( key, cf, column( "repositoryName", repositoryId ) ) // @@ -1711,7 +1698,6 @@ public class CassandraMetadataRepository .addInsertion( key, cf, column( "key", entry.getKey() ) ) // .addInsertion( key, cf, column( "value", entry.getValue() ) ) // .execute(); - } else { @@ -1965,8 +1951,6 @@ public class CassandraMetadataRepository { this.artifactMetadataTemplate.deleteRow( row.getKey() ); } - - } diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ArtifactMetadataModel.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ArtifactMetadataModel.java index 6efe19743..ce8f552d8 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ArtifactMetadataModel.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ArtifactMetadataModel.java @@ -21,7 +21,6 @@ package org.apache.archiva.metadata.repository.cassandra.model; import org.apache.archiva.metadata.repository.cassandra.CassandraUtils; -import javax.persistence.Column; import java.io.Serializable; import java.util.Date; @@ -35,37 +34,26 @@ public class ArtifactMetadataModel implements Serializable { - @Column(name = "id") private String id; - @Column(name = "repositoryName") private String repositoryId; - @Column(name = "namespaceId") private String namespace; - @Column(name = "project") private String project; - @Column(name = "projectVersion") private String projectVersion; - @Column(name = "version") private String version; - @Column(name = "fileLastModified") private long fileLastModified; - @Column(name = "size") private long size; - @Column(name = "md5") private String md5; - @Column(name = "sha1") private String sha1; - @Column(name = "whenGathered") private long whenGathered; public ArtifactMetadataModel() diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/MetadataFacetModel.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/MetadataFacetModel.java index 3346e8ecd..ae494e1ab 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/MetadataFacetModel.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/MetadataFacetModel.java @@ -21,8 +21,6 @@ package org.apache.archiva.metadata.repository.cassandra.model; import org.apache.archiva.metadata.repository.cassandra.CassandraUtils; -import javax.persistence.Column; - /** * Cassandra storage model for {@link org.apache.archiva.metadata.model.MetadataFacet} * @@ -31,21 +29,12 @@ import javax.persistence.Column; */ public class MetadataFacetModel { - // id is repositoryId + namespaceId + projectId + facetId + name + mapKey - - //@Column(name = "artifactMetadataModel") - //private ArtifactMetadataModel artifactMetadataModel; - - @Column(name = "facetId") private String facetId; - @Column(name = "key") private String key; - @Column(name = "name") private String name; - @Column(name = "value") private String value; private String projectVersion; diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Project.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Project.java index 74ac18972..656e9099f 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Project.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/Project.java @@ -21,8 +21,6 @@ package org.apache.archiva.metadata.repository.cassandra.model; import org.apache.archiva.metadata.repository.cassandra.CassandraUtils; -import javax.persistence.Column; -import javax.persistence.Id; import java.io.Serializable; /** @@ -32,103 +30,6 @@ import java.io.Serializable; public class Project implements Serializable { - @Id - @Column(name = "projectKey") - private String projectKey; - - @Column(name = "projectId") - private String projectId; - - - @Column(name = "repository") - private Namespace namespace; - - public Project() - { - // no op - } - - public Project( String projectKey, String projectId, Namespace namespace ) - { - this.projectId = projectId; - this.projectKey = projectKey; - this.namespace = namespace; - } - - public String getProjectKey() - { - return projectKey; - } - - public void setProjectKey( String projectKey ) - { - this.projectKey = projectKey; - } - - public Namespace getNamespace() - { - return namespace; - } - - public void setNamespace( Namespace namespace ) - { - this.namespace = namespace; - } - - public String getProjectId() - { - return projectId; - } - - public void setProjectId( String projectId ) - { - this.projectId = projectId; - } - - @Override - public boolean equals( Object o ) - { - if ( this == o ) - { - return true; - } - if ( o == null || getClass() != o.getClass() ) - { - return false; - } - - Project project = (Project) o; - - if ( !projectKey.equals( project.projectKey ) ) - { - return false; - } - if ( !namespace.equals( project.namespace ) ) - { - return false; - } - - return true; - } - - @Override - public int hashCode() - { - int result = projectKey.hashCode(); - result = 31 * result + namespace.hashCode(); - return result; - } - - @Override - public String toString() - { - final StringBuilder sb = new StringBuilder( "Project{" ); - sb.append( "projectKey='" ).append( projectKey ).append( '\'' ); - sb.append( ", projectId='" ).append( projectId ).append( '\'' ); - sb.append( ", namespace=" ).append( namespace ); - sb.append( '}' ); - return sb.toString(); - } public static class KeyBuilder { diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ProjectVersionMetadataModel.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ProjectVersionMetadataModel.java index 4a01647a7..2f1b8115d 100644 --- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ProjectVersionMetadataModel.java +++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/model/ProjectVersionMetadataModel.java @@ -28,7 +28,6 @@ import org.apache.archiva.metadata.model.Organization; import org.apache.archiva.metadata.model.Scm; import org.apache.archiva.metadata.repository.cassandra.CassandraUtils; -import javax.persistence.Column; import java.util.ArrayList; import java.util.List; @@ -38,52 +37,32 @@ import java.util.List; */ public class ProjectVersionMetadataModel { - - - @Column(name = "namespaceId") // repositoryName private Namespace namespace; - /** - * id is the id - */ - @Column(name = "id") private String id; - @Column(name = "projectId") private String projectId; - @Column(name = "url") private String url; - @Column(name = "name") private String name; - @Column(name = "description") private String description; - @Column(name = "organization") private Organization organization; - @Column(name = "issueManagement") private IssueManagement issueManagement; - @Column(name = "scm") private Scm scm; - @Column(name = "ciManagement") private CiManagement ciManagement; - // FIXME store those values in a separate table - @Column(name = "licenses") private List<License> licenses = new ArrayList<License>(); - @Column(name = "mailingLists") private List<MailingList> mailingLists = new ArrayList<MailingList>(); - @Column(name = "dependencies") private List<Dependency> dependencies = new ArrayList<Dependency>(); - @Column(name = "incomplete") private boolean incomplete; public String getProjectId() diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java index f7e4e8f88..2e51337dc 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java @@ -1148,8 +1148,8 @@ public class JcrMetadataRepository for ( Node node : JcrUtils.getChildNodes( nodeAtPath ) ) { - if ( node.isNodeType( PROJECT_VERSION_NODE_TYPE ) && StringUtils.equals( node.getName(), - projectVersion ) ) + if ( node.isNodeType( PROJECT_VERSION_NODE_TYPE ) // + && StringUtils.equals( node.getName(), projectVersion ) ) { node.remove(); } |