/**
* create the namespace in the repository. (if not exist)
+ *
* @param repositoryId
* @param namespace
* @throws MetadataRepositoryException
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;
/**
* 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
*/
/**
* FIXME need a unit test!!!
* Only remove {@link MetadataFacet} for the artifact
+ *
* @param repositoryId
* @param namespace
* @param project
/**
* basically just checking it exists not complete data returned
+ *
* @param repoId
* @param namespace
* @param projectId
throws MetadataResolutionException;
/**
- *
* @param repoId
* @param namespace
* @return {@link Collection} of child namespaces of the namespace argument
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;
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
boolean canObtainAccess( Class<?> aClass );
- <T>T obtainAccess( Class<T> aClass )
+ <T> T obtainAccess( Class<T> aClass )
throws MetadataRepositoryException;
}
<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>
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() )
{
.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() )
{
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 ) ) //
.addInsertion( key, cf, column( "key", entry.getKey() ) ) //
.addInsertion( key, cf, column( "value", entry.getValue() ) ) //
.execute();
-
}
else
{
{
this.artifactMetadataTemplate.deleteRow( row.getKey() );
}
-
-
}
import org.apache.archiva.metadata.repository.cassandra.CassandraUtils;
-import javax.persistence.Column;
import java.io.Serializable;
import java.util.Date;
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()
import org.apache.archiva.metadata.repository.cassandra.CassandraUtils;
-import javax.persistence.Column;
-
/**
* Cassandra storage model for {@link org.apache.archiva.metadata.model.MetadataFacet}
*
*/
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;
import org.apache.archiva.metadata.repository.cassandra.CassandraUtils;
-import javax.persistence.Column;
-import javax.persistence.Id;
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
{
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;
*/
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()
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();
}