<name>Archiva Core Plugins :: Cassandra JPA Storage for Metadata</name>
<properties>
+ <!-- upgrade need a new astyanax release > 1.56.42 see https://github.com/Netflix/astyanax/issues/352 -->
<cassandraVersion>1.2.5</cassandraVersion>
<astyanax.version>1.56.42</astyanax.version>
</properties>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.thrift</groupId>
+ <artifactId>libthrift</artifactId>
+ <version>0.9.1</version>
+ </dependency>
+
<dependency>
<groupId>org.springframework</groupId>
</execution>
</executions>
</plugin>
- <!-- TODO use dynamic port -->
-
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cassandra-maven-plugin</artifactId>
artifactMetadataModel.setArtifactMetadataModelId(
new ArtifactMetadataModel.KeyBuilder().withId( versionMetadata.getId() ).withRepositoryId(
repositoryId ).withNamespace( namespaceId ).withProjectVersion(
- versionMetadata.getVersion() ).build() );
+ versionMetadata.getVersion() ).withProject( projectId ).build() );
artifactMetadataModel.setRepositoryId( repositoryId );
artifactMetadataModel.setNamespace( namespaceId );
artifactMetadataModel.setProject( projectId );
}
} );
getArtifactMetadataModelEntityManager().remove( artifactMetadataModels );
- /*
- getMetadataFacetModelEntityManager().visitAll( new Function<MetadataFacetModel, Boolean>()
- {
- @Override
- public Boolean apply( MetadataFacetModel metadataFacetModel )
- {
- if ( metadataFacetModel != null )
- {
- ArtifactMetadataModel artifactMetadataModel = metadataFacetModel.getArtifactMetadataModel();
- if ( artifactMetadataModel != null )
- {
- if ( StringUtils.equals( repositoryId, artifactMetadataModel.getRepositoryId() )
- && StringUtils.equals( namespace, artifactMetadataModel.getNamespace() )
- && StringUtils.equals( project, artifactMetadataModel.getProject() ) && StringUtils.equals(
- version, artifactMetadataModel.getVersion() ) )
- {
- if ( StringUtils.equals( metadataFacetModel.getFacetId(), metadataFacet.getFacetId() )
- && StringUtils.equals( metadataFacetModel.getName(), metadataFacet.getName() ) )
- {
- metadataFacetModels.add( metadataFacetModel );
- }
- }
- }
- }
- return Boolean.TRUE;
- }
- } );
- getMetadataFacetModelEntityManager().remove( metadataFacetModels );
- */
+
}
return Boolean.TRUE;
}
} );
- /*
- getArtifactMetadataModelEntityManager().visitAll( new Function<ArtifactMetadataModel, Boolean>()
- {
- @Override
- public Boolean apply( ArtifactMetadataModel artifactMetadataModel )
- {
- if ( artifactMetadataModel != null )
- {
- if ( StringUtils.equals( repoId, artifactMetadataModel.getRepositoryId() ) && StringUtils.equals(
- namespace, artifactMetadataModel.getNamespace() ) )
- {
- projects.add( artifactMetadataModel.getProject() );
- }
- }
- return Boolean.TRUE;
- }
- } );
- */
return projects;
}
{
//repositoryId + namespaceId + project + projectVersion + id
// FIXME add some controls
- return this.repositoryId + "-" + this.namespaceId + "-" + this.project + "-" + this.projectVersion + "-"
- + this.id;
+ long hash = this.repositoryId.hashCode() + this.namespaceId.hashCode() + this.project.hashCode() + this.projectVersion.hashCode() + this.id.hashCode();
+ return Long.toString( hash );
}
}
{
// id is repositoryId + namespaceId + projectId + facetId + name + mapKey
@Id
- @Column( name = "id" )
+ @Column(name = "id")
private String id;
- @Column( name = "artifactMetadataModel" )
+ @Column(name = "artifactMetadataModel")
private ArtifactMetadataModel artifactMetadataModel;
- @Column( name = "facetId" )
+ @Column(name = "facetId")
private String facetId;
- @Column( name = "name" )
+ @Column(name = "name")
private String name;
- @Column( name = "key" )
+ @Column(name = "key")
private String key;
- @Column( name = "value" )
+ @Column(name = "value")
private String value;
public MetadataFacetModel()
// FIXME add some controls
// getArtifactMetadataModelId can have no namespace, no project and no projectid for statistics
// only repositoryId with artifactMetadataModel
- return ( this.artifactMetadataModel == null
- ? this.repositoryId
- : this.artifactMetadataModel.getArtifactMetadataModelId() ) + "-" + this.facetId + "-" + this.name + "-"
- + this.key;
+ long hash =
+ ( this.artifactMetadataModel == null
+ ? this.repositoryId.hashCode()
+ : Long.parseLong( this.artifactMetadataModel.getArtifactMetadataModelId() ) )
+ + this.facetId.hashCode()
+ + ( this.name == null ? 0 : this.name.hashCode() )
+ + ( this.key == null ? 0 : this.key.hashCode() );
+
+ String hashStr = Long.toString( hash );
+ return hashStr;
}
}
}
@Id
private String rowId;
- @Column( name = "namespace" )
+ @Column(name = "namespace")
private Namespace namespace;
/**
* id is the version
*/
- @Column( name = "id" )
+ @Column(name = "id")
private String id;
- @Column( name = "projectId" )
+ @Column(name = "projectId")
private String projectId;
@Column(name = "url")
public String build()
{
// FIXME add some controls
- return this.repositoryId + "-" + this.namespace + "-" + this.projectId + ( this.id == null
- ? ""
- : "-" + this.id );
+ long hash =
+ this.repositoryId.hashCode() + this.namespace.hashCode() + this.projectId.hashCode() + ( this.id == null
+ ? 0
+ : +this.id.hashCode() );
+ return Long.toString( hash );
}
}
}