--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+ ~ Licensed to the Apache Software Foundation (ASF) under one\r
+ ~ or more contributor license agreements. See the NOTICE file\r
+ ~ distributed with this work for additional information\r
+ ~ regarding copyright ownership. The ASF licenses this file\r
+ ~ to you under the Apache License, Version 2.0 (the\r
+ ~ "License"); you may not use this file except in compliance\r
+ ~ with the License. You may obtain a copy of the License at\r
+ ~\r
+ ~ http://www.apache.org/licenses/LICENSE-2.0\r
+ ~\r
+ ~ Unless required by applicable law or agreed to in writing,\r
+ ~ software distributed under the License is distributed on an\r
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r
+ ~ KIND, either express or implied. See the License for the\r
+ ~ specific language governing permissions and limitations\r
+ ~ under the License.\r
+ -->\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <parent>\r
+ <groupId>org.apache.archiva</groupId>\r
+ <artifactId>archiva-base</artifactId>\r
+ <version>1.4-M3-SNAPSHOT</version>\r
+ </parent>\r
+\r
+ <artifactId>archiva-maven2-model</artifactId>\r
+ <version>1.4-M3-SNAPSHOT</version>\r
+ <packaging>bundle</packaging>\r
+\r
+ <name>Archiva Base :: Maven 2 Model</name>\r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.codehaus.jackson</groupId>\r
+ <artifactId>jackson-core-asl</artifactId>\r
+ </dependency>\r
+\r
+ </dependencies>\r
+\r
+ <build>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.felix</groupId>\r
+ <artifactId>maven-bundle-plugin</artifactId>\r
+ <configuration>\r
+ <instructions>\r
+ <Bundle-SymbolicName>org.apache.archiva.maven2.model</Bundle-SymbolicName>\r
+ <Bundle-Version>${project.version}</Bundle-Version>\r
+ <Import-Package>\r
+ javax.xml.bind.annotation,\r
+ org.codehaus.jackson.annotate,\r
+ </Import-Package>\r
+ <Export-Package>\r
+ org.apache.archiva.maven2.model*;version=${project.version}\r
+ </Export-Package>\r
+ </instructions>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+\r
+</project>\r
--- /dev/null
+package org.apache.archiva.maven2.model;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.List;
+
+@XmlRootElement( name = "artifact" )
+public class Artifact
+ implements Serializable
+{
+ // The (optional) context for this result.
+ private String context;
+
+ // Basic hit, direct to non-artifact resource.
+ private String url;
+
+ // Advanced hit, reference to groupId.
+ private String groupId;
+
+ // Advanced hit, reference to artifactId.
+ private String artifactId;
+
+ private String repositoryId;
+
+ private String version;
+
+ /**
+ * Plugin goal prefix (only if packaging is "maven-plugin")
+ */
+ private String prefix;
+
+ /**
+ * Plugin goals (only if packaging is "maven-plugin")
+ */
+ private List<String> goals;
+
+ /**
+ * contains osgi metadata Bundle-Version if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleVersion;
+
+ /**
+ * contains osgi metadata Bundle-SymbolicName if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleSymbolicName;
+
+ /**
+ * contains osgi metadata Export-Package if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleExportPackage;
+
+ /**
+ * contains osgi metadata Export-Service if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleExportService;
+
+ /**
+ * contains osgi metadata Bundle-Description if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleDescription;
+
+ /**
+ * contains osgi metadata Bundle-Name if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleName;
+
+ /**
+ * contains osgi metadata Bundle-License if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleLicense;
+
+ /**
+ * contains osgi metadata Bundle-DocURL if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleDocUrl;
+
+ /**
+ * contains osgi metadata Import-Package if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleImportPackage;
+
+ /**
+ * contains osgi metadata Require-Bundle if available
+ *
+ * @since 1.4-M1
+ */
+ private String bundleRequireBundle;
+
+ private String classifier;
+
+ private String packaging;
+
+ /**
+ * file extension of the artifact
+ *
+ * @since 1.4-M2
+ */
+ private String fileExtension;
+
+ /**
+ * human readable size : not available for all services
+ *
+ * @since 1.4-M3
+ */
+ private String size;
+
+ /**
+ * @since 1.4-M3
+ */
+ private String type;
+
+
+ /**
+ * @since 1.4-M3
+ */
+ private String path;
+
+ /**
+ * concat of artifactId+'-'+version+'.'+type
+ *
+ * @since 1.4-M3
+ */
+ private String id;
+
+ /**
+ * @since 1.4-M3
+ */
+ private String scope;
+
+
+ public Artifact()
+ {
+ // no op
+ }
+
+ public Artifact( String groupId, String artifactId, String version )
+ {
+ this.artifactId = artifactId;
+ this.groupId = groupId;
+ this.version = version;
+ }
+
+ /**
+ * @since 1.4-M3
+ */
+ public Artifact( String groupId, String artifactId, String version, String scope )
+ {
+ this( groupId, artifactId, version );
+ this.scope = scope;
+ }
+
+ /**
+ * @since 1.4-M3
+ */
+ public Artifact( String groupId, String artifactId, String version, String scope, String classifier )
+ {
+ this( groupId, artifactId, version );
+ this.scope = scope;
+ this.classifier = classifier;
+ }
+
+ public String getGroupId()
+ {
+ return groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return artifactId;
+ }
+
+ public String getVersion()
+ {
+ return version;
+ }
+
+ public String getRepositoryId()
+ {
+ return repositoryId;
+ }
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ public void setRepositoryId( String repositoryId )
+ {
+ this.repositoryId = repositoryId;
+ }
+
+ public String getContext()
+ {
+ return context;
+ }
+
+ public void setContext( String context )
+ {
+ this.context = context;
+ }
+
+ public String getUrl()
+ {
+ return url;
+ }
+
+ public void setUrl( String url )
+ {
+ this.url = url;
+ }
+
+ public String getPrefix()
+ {
+ return prefix;
+ }
+
+ public void setPrefix( String prefix )
+ {
+ this.prefix = prefix;
+ }
+
+ public List<String> getGoals()
+ {
+ return goals;
+ }
+
+ public void setGoals( List<String> goals )
+ {
+ this.goals = goals;
+ }
+
+ public String getBundleVersion()
+ {
+ return bundleVersion;
+ }
+
+ public void setBundleVersion( String bundleVersion )
+ {
+ this.bundleVersion = bundleVersion;
+ }
+
+ public String getBundleSymbolicName()
+ {
+ return bundleSymbolicName;
+ }
+
+ public void setBundleSymbolicName( String bundleSymbolicName )
+ {
+ this.bundleSymbolicName = bundleSymbolicName;
+ }
+
+ public String getBundleExportPackage()
+ {
+ return bundleExportPackage;
+ }
+
+ public void setBundleExportPackage( String bundleExportPackage )
+ {
+ this.bundleExportPackage = bundleExportPackage;
+ }
+
+ public String getBundleExportService()
+ {
+ return bundleExportService;
+ }
+
+ public void setBundleExportService( String bundleExportService )
+ {
+ this.bundleExportService = bundleExportService;
+ }
+
+ public String getBundleDescription()
+ {
+ return bundleDescription;
+ }
+
+ public void setBundleDescription( String bundleDescription )
+ {
+ this.bundleDescription = bundleDescription;
+ }
+
+ public String getBundleName()
+ {
+ return bundleName;
+ }
+
+ public void setBundleName( String bundleName )
+ {
+ this.bundleName = bundleName;
+ }
+
+ public String getBundleLicense()
+ {
+ return bundleLicense;
+ }
+
+ public void setBundleLicense( String bundleLicense )
+ {
+ this.bundleLicense = bundleLicense;
+ }
+
+ public String getBundleDocUrl()
+ {
+ return bundleDocUrl;
+ }
+
+ public void setBundleDocUrl( String bundleDocUrl )
+ {
+ this.bundleDocUrl = bundleDocUrl;
+ }
+
+ public String getBundleImportPackage()
+ {
+ return bundleImportPackage;
+ }
+
+ public void setBundleImportPackage( String bundleImportPackage )
+ {
+ this.bundleImportPackage = bundleImportPackage;
+ }
+
+ public String getBundleRequireBundle()
+ {
+ return bundleRequireBundle;
+ }
+
+ public void setBundleRequireBundle( String bundleRequireBundle )
+ {
+ this.bundleRequireBundle = bundleRequireBundle;
+ }
+
+ public String getClassifier()
+ {
+ return classifier;
+ }
+
+ public void setClassifier( String classifier )
+ {
+ this.classifier = classifier;
+ }
+
+
+ public String getPackaging()
+ {
+ return packaging;
+ }
+
+ public void setPackaging( String packaging )
+ {
+ this.packaging = packaging;
+ }
+
+ public String getFileExtension()
+ {
+ return fileExtension;
+ }
+
+ public void setFileExtension( String fileExtension )
+ {
+ this.fileExtension = fileExtension;
+ }
+
+ public String getSize()
+ {
+ return size;
+ }
+
+ public void setSize( String size )
+ {
+ this.size = size;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public void setType( String type )
+ {
+ this.type = type;
+ }
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath( String path )
+ {
+ this.path = path;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ public String getScope()
+ {
+ return scope;
+ }
+
+ public void setScope( String scope )
+ {
+ this.scope = scope;
+ }
+
+ @Override
+ public String toString()
+ {
+ final StringBuilder sb = new StringBuilder();
+ sb.append( "Artifact" );
+ sb.append( "{context='" ).append( context ).append( '\'' );
+ sb.append( ", url='" ).append( url ).append( '\'' );
+ sb.append( ", groupId='" ).append( groupId ).append( '\'' );
+ sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
+ sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' );
+ sb.append( ", version='" ).append( version ).append( '\'' );
+ sb.append( ", prefix='" ).append( prefix ).append( '\'' );
+ sb.append( ", goals=" ).append( goals );
+ sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
+ sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
+ sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
+ sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
+ sb.append( ", bundleDescription='" ).append( bundleDescription ).append( '\'' );
+ sb.append( ", bundleName='" ).append( bundleName ).append( '\'' );
+ sb.append( ", bundleLicense='" ).append( bundleLicense ).append( '\'' );
+ sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
+ sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
+ sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
+ sb.append( ", classifier='" ).append( classifier ).append( '\'' );
+ sb.append( ", packaging='" ).append( packaging ).append( '\'' );
+ sb.append( ", fileExtension='" ).append( fileExtension ).append( '\'' );
+ sb.append( ", size='" ).append( size ).append( '\'' );
+ sb.append( ", type='" ).append( type ).append( '\'' );
+ sb.append( ", path='" ).append( path ).append( '\'' );
+ sb.append( ", id='" ).append( id ).append( '\'' );
+ sb.append( '}' );
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( !( o instanceof Artifact ) )
+ {
+ return false;
+ }
+
+ Artifact artifact = (Artifact) o;
+
+ if ( !artifactId.equals( artifact.artifactId ) )
+ {
+ return false;
+ }
+ if ( bundleDescription != null
+ ? !bundleDescription.equals( artifact.bundleDescription )
+ : artifact.bundleDescription != null )
+ {
+ return false;
+ }
+ if ( bundleDocUrl != null ? !bundleDocUrl.equals( artifact.bundleDocUrl ) : artifact.bundleDocUrl != null )
+ {
+ return false;
+ }
+ if ( bundleExportPackage != null
+ ? !bundleExportPackage.equals( artifact.bundleExportPackage )
+ : artifact.bundleExportPackage != null )
+ {
+ return false;
+ }
+ if ( bundleExportService != null
+ ? !bundleExportService.equals( artifact.bundleExportService )
+ : artifact.bundleExportService != null )
+ {
+ return false;
+ }
+ if ( bundleImportPackage != null
+ ? !bundleImportPackage.equals( artifact.bundleImportPackage )
+ : artifact.bundleImportPackage != null )
+ {
+ return false;
+ }
+ if ( bundleLicense != null ? !bundleLicense.equals( artifact.bundleLicense ) : artifact.bundleLicense != null )
+ {
+ return false;
+ }
+ if ( bundleName != null ? !bundleName.equals( artifact.bundleName ) : artifact.bundleName != null )
+ {
+ return false;
+ }
+ if ( bundleRequireBundle != null
+ ? !bundleRequireBundle.equals( artifact.bundleRequireBundle )
+ : artifact.bundleRequireBundle != null )
+ {
+ return false;
+ }
+ if ( bundleSymbolicName != null
+ ? !bundleSymbolicName.equals( artifact.bundleSymbolicName )
+ : artifact.bundleSymbolicName != null )
+ {
+ return false;
+ }
+ if ( bundleVersion != null ? !bundleVersion.equals( artifact.bundleVersion ) : artifact.bundleVersion != null )
+ {
+ return false;
+ }
+ if ( classifier != null ? !classifier.equals( artifact.classifier ) : artifact.classifier != null )
+ {
+ return false;
+ }
+ if ( context != null ? !context.equals( artifact.context ) : artifact.context != null )
+ {
+ return false;
+ }
+ if ( fileExtension != null ? !fileExtension.equals( artifact.fileExtension ) : artifact.fileExtension != null )
+ {
+ return false;
+ }
+ if ( goals != null ? !goals.equals( artifact.goals ) : artifact.goals != null )
+ {
+ return false;
+ }
+ if ( !groupId.equals( artifact.groupId ) )
+ {
+ return false;
+ }
+ if ( id != null ? !id.equals( artifact.id ) : artifact.id != null )
+ {
+ return false;
+ }
+ if ( packaging != null ? !packaging.equals( artifact.packaging ) : artifact.packaging != null )
+ {
+ return false;
+ }
+ if ( path != null ? !path.equals( artifact.path ) : artifact.path != null )
+ {
+ return false;
+ }
+ if ( prefix != null ? !prefix.equals( artifact.prefix ) : artifact.prefix != null )
+ {
+ return false;
+ }
+ if ( repositoryId != null ? !repositoryId.equals( artifact.repositoryId ) : artifact.repositoryId != null )
+ {
+ return false;
+ }
+ if ( scope != null ? !scope.equals( artifact.scope ) : artifact.scope != null )
+ {
+ return false;
+ }
+ if ( size != null ? !size.equals( artifact.size ) : artifact.size != null )
+ {
+ return false;
+ }
+ if ( type != null ? !type.equals( artifact.type ) : artifact.type != null )
+ {
+ return false;
+ }
+ if ( url != null ? !url.equals( artifact.url ) : artifact.url != null )
+ {
+ return false;
+ }
+ if ( !version.equals( artifact.version ) )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int result = context != null ? context.hashCode() : 0;
+ result = 31 * result + ( url != null ? url.hashCode() : 0 );
+ result = 31 * result + groupId.hashCode();
+ result = 31 * result + artifactId.hashCode();
+ result = 31 * result + ( repositoryId != null ? repositoryId.hashCode() : 0 );
+ result = 31 * result + version.hashCode();
+ result = 31 * result + ( prefix != null ? prefix.hashCode() : 0 );
+ result = 31 * result + ( goals != null ? goals.hashCode() : 0 );
+ result = 31 * result + ( bundleVersion != null ? bundleVersion.hashCode() : 0 );
+ result = 31 * result + ( bundleSymbolicName != null ? bundleSymbolicName.hashCode() : 0 );
+ result = 31 * result + ( bundleExportPackage != null ? bundleExportPackage.hashCode() : 0 );
+ result = 31 * result + ( bundleExportService != null ? bundleExportService.hashCode() : 0 );
+ result = 31 * result + ( bundleDescription != null ? bundleDescription.hashCode() : 0 );
+ result = 31 * result + ( bundleName != null ? bundleName.hashCode() : 0 );
+ result = 31 * result + ( bundleLicense != null ? bundleLicense.hashCode() : 0 );
+ result = 31 * result + ( bundleDocUrl != null ? bundleDocUrl.hashCode() : 0 );
+ result = 31 * result + ( bundleImportPackage != null ? bundleImportPackage.hashCode() : 0 );
+ result = 31 * result + ( bundleRequireBundle != null ? bundleRequireBundle.hashCode() : 0 );
+ result = 31 * result + ( classifier != null ? classifier.hashCode() : 0 );
+ result = 31 * result + ( packaging != null ? packaging.hashCode() : 0 );
+ result = 31 * result + ( fileExtension != null ? fileExtension.hashCode() : 0 );
+ result = 31 * result + ( size != null ? size.hashCode() : 0 );
+ result = 31 * result + ( type != null ? type.hashCode() : 0 );
+ result = 31 * result + ( path != null ? path.hashCode() : 0 );
+ result = 31 * result + ( id != null ? id.hashCode() : 0 );
+ result = 31 * result + ( scope != null ? scope.hashCode() : 0 );
+ return result;
+ }
+}
--- /dev/null
+package org.apache.archiva.maven2.model;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.jackson.annotate.JsonIgnore;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ */
+@XmlRootElement( name = "treeEntry" )
+public class TreeEntry
+ implements Serializable
+{
+
+ private List<TreeEntry> childs = new ArrayList<TreeEntry>();
+
+ private Artifact artifact;
+
+ @JsonIgnore
+ private TreeEntry parent;
+
+ public TreeEntry()
+ {
+ // no op
+ }
+
+ public TreeEntry( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+
+ public Artifact getArtifact()
+ {
+ return artifact;
+ }
+
+ public void setArtifact( Artifact artifact )
+ {
+ this.artifact = artifact;
+ }
+
+ public List<TreeEntry> getChilds()
+ {
+ return childs;
+ }
+
+ public void setChilds( List<TreeEntry> childs )
+ {
+ this.childs = childs;
+ }
+
+ @JsonIgnore
+ public TreeEntry getParent()
+ {
+ return parent;
+ }
+
+ @JsonIgnore
+ public void setParent( TreeEntry parent )
+ {
+ this.parent = parent;
+ }
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+ if ( !( o instanceof TreeEntry ) )
+ {
+ return false;
+ }
+
+ TreeEntry treeEntry = (TreeEntry) o;
+
+ if ( artifact != null ? !artifact.equals( treeEntry.artifact ) : treeEntry.artifact != null )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return artifact != null ? artifact.hashCode() : 0;
+ }
+}
<module>archiva-repository-admin</module>
<module>archiva-security-common</module>
<module>archiva-maven2-metadata</module>
+ <module>archiva-maven2-model</module>
</modules>
</project>
\ No newline at end of file
<artifactId>metadata-model</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-maven2-model</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-scanner</artifactId>
+++ /dev/null
-package org.apache.archiva.rest.api.model;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.List;
-
-@XmlRootElement( name = "artifact" )
-public class Artifact
- implements Serializable
-{
- // The (optional) context for this result.
- private String context;
-
- // Basic hit, direct to non-artifact resource.
- private String url;
-
- // Advanced hit, reference to groupId.
- private String groupId;
-
- // Advanced hit, reference to artifactId.
- private String artifactId;
-
- private String repositoryId;
-
- private String version;
-
- /**
- * Plugin goal prefix (only if packaging is "maven-plugin")
- */
- private String prefix;
-
- /**
- * Plugin goals (only if packaging is "maven-plugin")
- */
- private List<String> goals;
-
- /**
- * contains osgi metadata Bundle-Version if available
- *
- * @since 1.4-M1
- */
- private String bundleVersion;
-
- /**
- * contains osgi metadata Bundle-SymbolicName if available
- *
- * @since 1.4-M1
- */
- private String bundleSymbolicName;
-
- /**
- * contains osgi metadata Export-Package if available
- *
- * @since 1.4-M1
- */
- private String bundleExportPackage;
-
- /**
- * contains osgi metadata Export-Service if available
- *
- * @since 1.4-M1
- */
- private String bundleExportService;
-
- /**
- * contains osgi metadata Bundle-Description if available
- *
- * @since 1.4-M1
- */
- private String bundleDescription;
-
- /**
- * contains osgi metadata Bundle-Name if available
- *
- * @since 1.4-M1
- */
- private String bundleName;
-
- /**
- * contains osgi metadata Bundle-License if available
- *
- * @since 1.4-M1
- */
- private String bundleLicense;
-
- /**
- * contains osgi metadata Bundle-DocURL if available
- *
- * @since 1.4-M1
- */
- private String bundleDocUrl;
-
- /**
- * contains osgi metadata Import-Package if available
- *
- * @since 1.4-M1
- */
- private String bundleImportPackage;
-
- /**
- * contains osgi metadata Require-Bundle if available
- *
- * @since 1.4-M1
- */
- private String bundleRequireBundle;
-
- private String classifier;
-
- private String packaging;
-
- /**
- * file extension of the artifact
- *
- * @since 1.4-M2
- */
- private String fileExtension;
-
- /**
- * human readable size : not available for all services
- * @since 1.4-M3
- */
- private String size;
-
- /**
- * @since 1.4-M3
- */
- private String type;
-
-
- /**
- * @since 1.4-M3
- */
- private String path;
-
- /**
- * concat of artifactId+'-'+version+'.'+type
- * @since 1.4-M3
- */
- private String id;
-
-
- public Artifact()
- {
- // no op
- }
-
- public Artifact( String groupId, String artifactId, String version )
- {
- this.artifactId = artifactId;
- this.groupId = groupId;
- this.version = version;
- }
-
- public String getGroupId()
- {
- return groupId;
- }
-
- public String getArtifactId()
- {
- return artifactId;
- }
-
- public String getVersion()
- {
- return version;
- }
-
- public String getRepositoryId()
- {
- return repositoryId;
- }
-
- public void setGroupId( String groupId )
- {
- this.groupId = groupId;
- }
-
- public void setArtifactId( String artifactId )
- {
- this.artifactId = artifactId;
- }
-
- public void setVersion( String version )
- {
- this.version = version;
- }
-
- public void setRepositoryId( String repositoryId )
- {
- this.repositoryId = repositoryId;
- }
-
- public String getContext()
- {
- return context;
- }
-
- public void setContext( String context )
- {
- this.context = context;
- }
-
- public String getUrl()
- {
- return url;
- }
-
- public void setUrl( String url )
- {
- this.url = url;
- }
-
- public String getPrefix()
- {
- return prefix;
- }
-
- public void setPrefix( String prefix )
- {
- this.prefix = prefix;
- }
-
- public List<String> getGoals()
- {
- return goals;
- }
-
- public void setGoals( List<String> goals )
- {
- this.goals = goals;
- }
-
- public String getBundleVersion()
- {
- return bundleVersion;
- }
-
- public void setBundleVersion( String bundleVersion )
- {
- this.bundleVersion = bundleVersion;
- }
-
- public String getBundleSymbolicName()
- {
- return bundleSymbolicName;
- }
-
- public void setBundleSymbolicName( String bundleSymbolicName )
- {
- this.bundleSymbolicName = bundleSymbolicName;
- }
-
- public String getBundleExportPackage()
- {
- return bundleExportPackage;
- }
-
- public void setBundleExportPackage( String bundleExportPackage )
- {
- this.bundleExportPackage = bundleExportPackage;
- }
-
- public String getBundleExportService()
- {
- return bundleExportService;
- }
-
- public void setBundleExportService( String bundleExportService )
- {
- this.bundleExportService = bundleExportService;
- }
-
- public String getBundleDescription()
- {
- return bundleDescription;
- }
-
- public void setBundleDescription( String bundleDescription )
- {
- this.bundleDescription = bundleDescription;
- }
-
- public String getBundleName()
- {
- return bundleName;
- }
-
- public void setBundleName( String bundleName )
- {
- this.bundleName = bundleName;
- }
-
- public String getBundleLicense()
- {
- return bundleLicense;
- }
-
- public void setBundleLicense( String bundleLicense )
- {
- this.bundleLicense = bundleLicense;
- }
-
- public String getBundleDocUrl()
- {
- return bundleDocUrl;
- }
-
- public void setBundleDocUrl( String bundleDocUrl )
- {
- this.bundleDocUrl = bundleDocUrl;
- }
-
- public String getBundleImportPackage()
- {
- return bundleImportPackage;
- }
-
- public void setBundleImportPackage( String bundleImportPackage )
- {
- this.bundleImportPackage = bundleImportPackage;
- }
-
- public String getBundleRequireBundle()
- {
- return bundleRequireBundle;
- }
-
- public void setBundleRequireBundle( String bundleRequireBundle )
- {
- this.bundleRequireBundle = bundleRequireBundle;
- }
-
- public String getClassifier()
- {
- return classifier;
- }
-
- public void setClassifier( String classifier )
- {
- this.classifier = classifier;
- }
-
-
- public String getPackaging()
- {
- return packaging;
- }
-
- public void setPackaging( String packaging )
- {
- this.packaging = packaging;
- }
-
- public String getFileExtension()
- {
- return fileExtension;
- }
-
- public void setFileExtension( String fileExtension )
- {
- this.fileExtension = fileExtension;
- }
-
- public String getSize()
- {
- return size;
- }
-
- public void setSize( String size )
- {
- this.size = size;
- }
-
- public String getType()
- {
- return type;
- }
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- public String getPath()
- {
- return path;
- }
-
- public void setPath( String path )
- {
- this.path = path;
- }
-
- public String getId()
- {
- return id;
- }
-
- public void setId( String id )
- {
- this.id = id;
- }
-
- @Override
- public String toString()
- {
- final StringBuilder sb = new StringBuilder();
- sb.append( "Artifact" );
- sb.append( "{context='" ).append( context ).append( '\'' );
- sb.append( ", url='" ).append( url ).append( '\'' );
- sb.append( ", groupId='" ).append( groupId ).append( '\'' );
- sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
- sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' );
- sb.append( ", version='" ).append( version ).append( '\'' );
- sb.append( ", prefix='" ).append( prefix ).append( '\'' );
- sb.append( ", goals=" ).append( goals );
- sb.append( ", bundleVersion='" ).append( bundleVersion ).append( '\'' );
- sb.append( ", bundleSymbolicName='" ).append( bundleSymbolicName ).append( '\'' );
- sb.append( ", bundleExportPackage='" ).append( bundleExportPackage ).append( '\'' );
- sb.append( ", bundleExportService='" ).append( bundleExportService ).append( '\'' );
- sb.append( ", bundleDescription='" ).append( bundleDescription ).append( '\'' );
- sb.append( ", bundleName='" ).append( bundleName ).append( '\'' );
- sb.append( ", bundleLicense='" ).append( bundleLicense ).append( '\'' );
- sb.append( ", bundleDocUrl='" ).append( bundleDocUrl ).append( '\'' );
- sb.append( ", bundleImportPackage='" ).append( bundleImportPackage ).append( '\'' );
- sb.append( ", bundleRequireBundle='" ).append( bundleRequireBundle ).append( '\'' );
- sb.append( ", classifier='" ).append( classifier ).append( '\'' );
- sb.append( ", packaging='" ).append( packaging ).append( '\'' );
- sb.append( ", fileExtension='" ).append( fileExtension ).append( '\'' );
- sb.append( ", size='" ).append( size ).append( '\'' );
- sb.append( ", type='" ).append( type ).append( '\'' );
- sb.append( ", path='" ).append( path ).append( '\'' );
- sb.append( ", id='" ).append( id ).append( '\'' );
- sb.append( '}' );
- return sb.toString();
- }
-
-}
* under the License.
*/
+import org.apache.archiva.maven2.model.Artifact;
+
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
+++ /dev/null
-package org.apache.archiva.rest.api.model;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- */
-@XmlRootElement( name = "treeEntry" )
-public class TreeEntry
- implements Serializable
-{
-
- private List<TreeEntry> childs = new ArrayList<TreeEntry>();
-
- private Artifact artifact;
-
- @JsonIgnore
- private TreeEntry parent;
-
- public TreeEntry()
- {
- // no op
- }
-
- public TreeEntry( Artifact artifact )
- {
- this.artifact = artifact;
- }
-
-
- public Artifact getArtifact()
- {
- return artifact;
- }
-
- public void setArtifact( Artifact artifact )
- {
- this.artifact = artifact;
- }
-
- public List<TreeEntry> getChilds()
- {
- return childs;
- }
-
- public void setChilds( List<TreeEntry> childs )
- {
- this.childs = childs;
- }
-
- @JsonIgnore
- public TreeEntry getParent()
- {
- return parent;
- }
-
- @JsonIgnore
- public void setParent( TreeEntry parent )
- {
- this.parent = parent;
- }
-}
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.ArtifactContent;
import org.apache.archiva.rest.api.model.ArtifactContentEntry;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.Entry;
-import org.apache.archiva.rest.api.model.TreeEntry;
+import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.archiva.rest.api.model.VersionsList;
import javax.ws.rs.DELETE;
import org.apache.archiva.redback.authorization.RedbackAuthorization;
import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
import org.apache.archiva.security.common.ArchivaRoleConstants;
*/
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.GroupIdList;
import org.apache.archiva.rest.api.model.SearchRequest;
import org.apache.archiva.rest.api.model.StringList;
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-scanner</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-maven2-model</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.apache.archiva.redback</groupId>
<artifactId>redback-authorization-api</artifactId>
import org.apache.archiva.redback.rest.services.RedbackRequestInformation;
import org.apache.archiva.redback.users.User;
import org.apache.archiva.redback.users.UserManager;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.security.AccessDeniedException;
import org.apache.archiva.security.ArchivaSecurityException;
import org.apache.archiva.common.utils.VersionComparator;
import org.apache.archiva.dependency.tree.maven2.DependencyTreeBuilder;
import org.apache.archiva.dependency.tree.maven2.Maven3DependencyTreeBuilder;
+import org.apache.archiva.maven2.model.Artifact;
+import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.archiva.metadata.generic.GenericMetadataFacet;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.model.MetadataFacet;
import org.apache.archiva.repository.RepositoryContentFactory;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryNotFoundException;
-import org.apache.archiva.rest.api.model.Artifact;
import org.apache.archiva.rest.api.model.ArtifactContent;
import org.apache.archiva.rest.api.model.ArtifactContentEntry;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.BrowseResultEntry;
import org.apache.archiva.rest.api.model.Entry;
-import org.apache.archiva.rest.api.model.TreeEntry;
import org.apache.archiva.rest.api.model.VersionsList;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.BrowseService;
import org.apache.archiva.rest.services.utils.ArtifactContentEntryComparator;
import org.apache.archiva.rest.services.utils.ArtifactDownloadInfoBuilder;
-import org.apache.archiva.rest.services.utils.TreeDependencyNodeVisitor;
import org.apache.archiva.security.ArchivaSecurityException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
{
List<String> selectedRepos = getSelectedRepos( repositoryId );
- List<TreeEntry> treeEntries = new ArrayList<TreeEntry>();
- TreeDependencyNodeVisitor treeDependencyNodeVisitor = new TreeDependencyNodeVisitor( treeEntries );
- /*
- try
- {
- dependencyTreeBuilder.buildDependencyTree( selectedRepos, groupId, artifactId, version,
- treeDependencyNodeVisitor );
- }
- catch ( DependencyTreeBuilderException e )
- {
- throw new ArchivaRestServiceException( e.getMessage(),
- Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), e );
- }
- */
try
{
- maven3DependencyTreeBuilder.buildDependencyTree( selectedRepos, groupId, artifactId, version,
- treeDependencyNodeVisitor );
+ return maven3DependencyTreeBuilder.buildDependencyTree( selectedRepos, groupId, artifactId, version );
}
catch ( Exception e )
log.error( e.getMessage(), e );
}
- log.debug( "treeEntrie: {}", treeEntries );
- return treeEntries;
+ return Collections.emptyList();
}
public List<ManagedRepository> getUserRepositories()
import org.apache.archiva.repository.scanner.RepositoryScanStatistics;
import org.apache.archiva.repository.scanner.RepositoryScanner;
import org.apache.archiva.repository.scanner.RepositoryScannerException;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.ArtifactTransferRequest;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoriesService;
import org.apache.archiva.indexer.search.SearchResultHit;
import org.apache.archiva.indexer.search.SearchResultLimits;
import org.apache.archiva.indexer.search.SearchResults;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.Dependency;
import org.apache.archiva.rest.api.model.GroupIdList;
import org.apache.archiva.rest.api.model.SearchRequest;
import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
import org.apache.archiva.model.ArtifactReference;
import org.apache.archiva.repository.ManagedRepositoryContent;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.commons.io.FilenameUtils;
import java.io.File;
+++ /dev/null
-package org.apache.archiva.rest.services.utils;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import net.sf.beanlib.provider.replicator.BeanReplicator;
-import org.apache.archiva.rest.api.model.Artifact;
-import org.apache.archiva.rest.api.model.TreeEntry;
-import org.apache.maven.shared.dependency.tree.DependencyNode;
-import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor;
-import org.sonatype.aether.graph.DependencyVisitor;
-
-import java.util.List;
-
-/**
- * @author Olivier Lamy
- * @since 1.4-M3
- */
-public class TreeDependencyNodeVisitor
- implements DependencyNodeVisitor, DependencyVisitor
-{
-
- final List<TreeEntry> treeEntries;
-
- private TreeEntry currentEntry;
-
- private DependencyNode firstNode;
-
- private org.sonatype.aether.graph.DependencyNode firstDependencyNode;
-
- public TreeDependencyNodeVisitor( List<TreeEntry> treeEntries )
- {
- this.treeEntries = treeEntries;
- }
-
- public boolean visit( DependencyNode node )
- {
- TreeEntry entry = new TreeEntry( new BeanReplicator().replicateBean( node.getArtifact(), Artifact.class ) );
- entry.setParent( currentEntry );
- currentEntry = entry;
-
- if ( firstNode == null )
- {
- firstNode = node;
- treeEntries.add( currentEntry );
- }
- else
- {
- currentEntry.getParent().getChilds().add( currentEntry );
- }
- return true;
- }
-
- public boolean endVisit( DependencyNode node )
- {
- currentEntry = currentEntry.getParent();
- return true;
- }
-
- public boolean visitEnter( org.sonatype.aether.graph.DependencyNode dependencyNode )
- {
- TreeEntry entry = new TreeEntry( new BeanReplicator().replicateBean( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
- entry.setParent( currentEntry );
- currentEntry = entry;
-
- if ( firstDependencyNode == null )
- {
- firstDependencyNode = dependencyNode;
- treeEntries.add( currentEntry );
- }
- else
- {
- currentEntry.getParent().getChilds().add( currentEntry );
- }
- return true;
- }
-
- public boolean visitLeave( org.sonatype.aether.graph.DependencyNode dependencyNode )
- {
- currentEntry = currentEntry.getParent();
- return true;
- }
-}
*/
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.ArtifactContentEntry;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.BrowseResultEntry;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.common.utils.FileUtil;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.BrowseResult;
import org.apache.archiva.rest.api.model.BrowseResultEntry;
import org.apache.archiva.rest.api.model.VersionsList;
*/
import org.apache.archiva.admin.model.beans.UiConfiguration;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.SearchRequest;
import org.apache.archiva.rest.api.services.SearchService;
import org.fest.assertions.api.Assertions;
import org.apache.archiva.audit.Auditable;
import org.apache.archiva.checksum.ChecksumAlgorithm;
import org.apache.archiva.common.utils.VersionUtil;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.services.ArchivaRestServiceException;
import org.apache.archiva.rest.api.services.RepositoriesService;
import org.apache.archiva.security.AccessDeniedException;
import org.apache.archiva.repository.RepositoryContentFactory;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryNotFoundException;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.services.utils.ArtifactDownloadInfoBuilder;
import org.apache.commons.lang.StringUtils;
import org.springframework.context.annotation.Scope;
import org.apache.archiva.admin.model.beans.ProxyConnector;
import org.apache.archiva.admin.model.beans.RemoteRepository;
import org.apache.archiva.admin.model.beans.RepositoryGroup;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.rest.api.model.SearchRequest;
import org.apache.archiva.rest.api.services.ManagedRepositoriesService;
import org.apache.archiva.rest.api.services.ProxyConnectorService;
import org.apache.archiva.metadata.model.ProjectVersionReference;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.RepositorySession;
-import org.apache.archiva.rest.api.model.Artifact;
+import org.apache.archiva.maven2.model.Artifact;
import org.apache.archiva.webtest.memory.TestMetadataResolver;
import org.apache.archiva.webtest.memory.TestRepositorySessionFactory;
import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-configuration</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-maven2-model</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
</dependency>
+ <dependency>
+ <groupId>net.sf.beanlib</groupId>
+ <artifactId>beanlib</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>aopalliance</groupId>
+ <artifactId>aopalliance</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>net.sf.beanlib</groupId>
- <artifactId>beanlib</artifactId>
+ <groupId>org.easytesting</groupId>
+ <artifactId>fest-assert-core</artifactId>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>cglib</groupId>
- <artifactId>cglib</artifactId>
- </exclusion>
- <exclusion>
- <groupId>aopalliance</groupId>
- <artifactId>aopalliance</artifactId>
- </exclusion>
- </exclusions>
</dependency>
+
</dependencies>
<build>
<plugins>
import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
+import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator;
import org.apache.archiva.proxy.common.WagonFactory;
import org.apache.maven.artifact.Artifact;
import javax.inject.Named;
import java.io.File;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
builder = defaultModelBuilderFactory.newInstance();
}
- public void buildDependencyTree( List<String> repositoryIds, String groupId, String artifactId, String version,
- DependencyVisitor dependencyVisitor )
+ public List<TreeEntry> buildDependencyTree( List<String> repositoryIds, String groupId, String artifactId,
+ String version )
throws Exception
{
Artifact projectArtifact = factory.createProjectArtifact( groupId, artifactId, version );
if ( repository == null )
{
// metadata could not be resolved
- return;
+ return Collections.emptyList();
}
// MRM-1411
}
}
+ List<TreeEntry> treeEntries = new ArrayList<TreeEntry>();
+ TreeDependencyNodeVisitor treeDependencyNodeVisitor = new TreeDependencyNodeVisitor( treeEntries );
+
// FIXME take care of relative path
- resolve( repository.getLocation(), groupId, artifactId, version, dependencyVisitor );
+ resolve( repository.getLocation(), groupId, artifactId, version, treeDependencyNodeVisitor );
+ log.debug( "treeEntrie: {}", treeEntries );
+ return treeEntries;
}
--- /dev/null
+package org.apache.archiva.dependency.tree.maven2;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import net.sf.beanlib.provider.replicator.BeanReplicator;
+import org.apache.archiva.maven2.model.Artifact;
+import org.apache.archiva.maven2.model.TreeEntry;
+import org.sonatype.aether.graph.DependencyNode;
+import org.sonatype.aether.graph.DependencyVisitor;
+
+import java.util.List;
+
+/**
+ * @author Olivier Lamy
+ * @since 1.4-M3
+ */
+public class TreeDependencyNodeVisitor
+ implements DependencyVisitor
+{
+
+ final List<TreeEntry> treeEntries;
+
+ private TreeEntry currentEntry;
+
+ private org.sonatype.aether.graph.DependencyNode firstDependencyNode;
+
+ public TreeDependencyNodeVisitor( List<TreeEntry> treeEntries )
+ {
+ this.treeEntries = treeEntries;
+ }
+
+
+ public boolean visitEnter( DependencyNode dependencyNode )
+ {
+ TreeEntry entry = new TreeEntry(
+ new BeanReplicator().replicateBean( dependencyNode.getDependency().getArtifact(), Artifact.class ) );
+ entry.getArtifact().setScope( dependencyNode.getDependency().getScope() );
+ entry.setParent( currentEntry );
+ currentEntry = entry;
+
+ if ( firstDependencyNode == null )
+ {
+ firstDependencyNode = dependencyNode;
+ treeEntries.add( currentEntry );
+ }
+ else
+ {
+ currentEntry.getParent().getChilds().add( currentEntry );
+ }
+ return true;
+ }
+
+ public boolean visitLeave( DependencyNode dependencyNode )
+ {
+ currentEntry = currentEntry.getParent();
+ return true;
+ }
+}
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.versioning.VersionRange;
control.verify();
}
+
}
import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.Configuration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
+import org.apache.archiva.maven2.model.Artifact;
+import org.apache.archiva.maven2.model.TreeEntry;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.easymock.MockControl;
+import org.fest.assertions.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.sonatype.aether.RepositorySystem;
-import org.sonatype.aether.artifact.Artifact;
-import org.sonatype.aether.graph.Dependency;
-import org.sonatype.aether.graph.DependencyNode;
-import org.sonatype.aether.graph.DependencyVisitor;
-import org.sonatype.aether.impl.internal.DefaultRepositorySystem;
-import org.sonatype.aether.util.artifact.DefaultArtifact;
-import org.sonatype.aether.util.graph.DefaultDependencyNode;
import org.springframework.test.context.ContextConfiguration;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.File;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.List;
@RunWith( ArchivaSpringJUnit4ClassRunner.class )
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
private static final String TEST_GROUP_ID = "org.apache.archiva";
- private DefaultRepositorySystem defaultRepositorySystem;
-
-
- final Map<String, DependencyNode> nodes = new HashMap<String, DependencyNode>();
@Inject
@Named( value = "archivaConfiguration#test" )
{
super.setUp();
- defaultRepositorySystem = (DefaultRepositorySystem) plexusSisuBridge.lookup( RepositorySystem.class );
-
Configuration configuration = new Configuration();
ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
repoConfig.setId( TEST_REPO_ID );
private Artifact createArtifact( String groupId, String artifactId, String version )
{
- return new DefaultArtifact( groupId, artifactId, "jar", version );
+ return new Artifact( groupId, artifactId, version );
}
private String getId( Artifact artifact )
throws Exception
{
- DependencyNode springContext = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.springframework", "spring-context", "2.5.6" ), "compile" ) );
-
- //springContext.setPremanagedVersion( "2.5.5" );
-
- nodes.put( getId( springContext.getDependency().getArtifact() ), springContext );
-
- DependencyNode springTest = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.springframework", "spring-test", "2.5.5" ), "test" ) );
-
- nodes.put( getId( springTest.getDependency().getArtifact() ), springTest );
-
- DependencyNode plexusUtils = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.codehaus.plexus", "plexus-utils", "1.4.5" ), "compile" ) );
-
- //plexusUtils.setPremanagedVersion( "1.5.1" );
-
- nodes.put( getId( plexusUtils.getDependency().getArtifact() ), plexusUtils );
-
- DependencyNode slf4jLog4j12 = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.slf4j", "slf4j-log4j12", "1.5.0" ), "runtime" ) );
-
- //slf4jLog4j12.setPremanagedScope( "test" );
-
- nodes.put( getId( slf4jLog4j12.getDependency().getArtifact() ), slf4jLog4j12 );
-
- DependencyNode plexusLog4j = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.codehaus.plexus", "plexus-log4j-logging", "1.1-alpha-3" ), "test" ) );
-
- nodes.put( getId( plexusLog4j.getDependency().getArtifact() ), plexusLog4j );
-
- DependencyNode log4j =
- new DefaultDependencyNode( new Dependency( createArtifact( "log4j", "log4j", "1.2.14" ), "test" ) );
-
- nodes.put( getId( log4j.getDependency().getArtifact() ), log4j );
-
- DependencyNode mavenArtifact = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.apache.maven", "maven-artifact", "2.0.8" ), "test" ) );
-
- nodes.put( getId( mavenArtifact.getDependency().getArtifact() ), mavenArtifact );
-
- DependencyNode mavenProject = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.apache.maven", "maven-project", "2.0.8" ), "test" ) );
-
- nodes.put( getId( mavenProject.getDependency().getArtifact() ), mavenProject );
-
- DependencyNode mavenCore = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.apache.maven", "maven-core", "2.0.8" ), "test" ) );
-
- nodes.put( getId( mavenCore.getDependency().getArtifact() ), mavenCore );
-
- DependencyNode mavenSettings = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.apache.maven", "maven-settings", "2.0.8" ), "test" ) );
-
- nodes.put( getId( mavenSettings.getDependency().getArtifact() ), mavenSettings );
-
- DependencyNode mavenModel = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.apache.maven", "maven-model", "2.0.8" ), "test" ) );
-
- nodes.put( getId( mavenModel.getDependency().getArtifact() ), mavenModel );
-
- DependencyNode plexusCommandLine = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.codehaus.plexus", "plexus-command-line", "1.0-alpha-2" ), "test" ) );
-
- nodes.put( getId( plexusCommandLine.getDependency().getArtifact() ), plexusCommandLine );
-
- DependencyNode plexusRegistryCommons = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.codehaus.plexus.registry", "plexus-registry-commons", "1.0-alpha-2" ),
- "test" ) );
-
- nodes.put( getId( plexusRegistryCommons.getDependency().getArtifact() ), plexusRegistryCommons );
-
- //plexusRegistryCommons.setPremanagedVersion( "1.0-alpha-3" );
-
- DependencyNode plexusRegistryApi = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.codehaus.plexus.registry", "plexus-registry-api", "1.0-alpha-2" ),
- "test" ) );
-
- nodes.put( getId( plexusRegistryApi.getDependency().getArtifact() ), plexusRegistryApi );
-
- //plexusRegistryApi.setPremanagedVersion( "1.0-alpha-3" );
-
- DependencyNode plexusSpring = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.codehaus.plexus", "plexus-spring", "1.2" ), "test" ) );
-
- nodes.put( getId( plexusSpring.getDependency().getArtifact() ), plexusSpring );
-
- plexusSpring.getChildren().add( springContext );
- plexusSpring.getChildren().add( springTest );
- plexusSpring.getChildren().add( plexusUtils );
- plexusSpring.getChildren().add( slf4jLog4j12 );
- plexusSpring.getChildren().add( plexusLog4j );
- plexusSpring.getChildren().add( log4j );
- plexusSpring.getChildren().add( mavenArtifact );
- plexusSpring.getChildren().add( mavenProject );
- plexusSpring.getChildren().add( mavenCore );
- plexusSpring.getChildren().add( mavenSettings );
- plexusSpring.getChildren().add( mavenModel );
- plexusSpring.getChildren().add( plexusCommandLine );
- plexusSpring.getChildren().add( plexusRegistryCommons );
- plexusSpring.getChildren().add( plexusRegistryApi );
-
- DependencyNode commonsLang = new DefaultDependencyNode(
- new Dependency( createArtifact( "commons-lang", "commons-lang", "2.2" ), "compile" ) );
-
- nodes.put( getId( commonsLang.getDependency().getArtifact() ), commonsLang );
-
- DependencyNode commonsIO = new DefaultDependencyNode(
- new Dependency( createArtifact( "commons-io", "commons-io", "1.4" ), "compile" ) );
-
- nodes.put( getId( commonsIO.getDependency().getArtifact() ), commonsIO );
-
- DependencyNode slf4j = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.slf4j", "slf4j-api", "1.5.0" ), "compile" ) );
-
- nodes.put( getId( slf4j.getDependency().getArtifact() ), slf4j );
-
- DependencyNode plexusAPI = new DefaultDependencyNode(
- new Dependency( createArtifact( "org.codehaus.plexus", "plexus-component-api", "1.0-alpha-22" ),
- "compile" ) );
-
- nodes.put( getId( plexusAPI.getDependency().getArtifact() ), plexusAPI );
-
- DependencyNode xalan =
- new DefaultDependencyNode( new Dependency( createArtifact( "xalan", "xalan", "2.7.0" ), "compile" ) );
-
- nodes.put( getId( xalan.getDependency().getArtifact() ), xalan );
-
- DependencyNode dom4j =
- new TestDefaultDependencyNode( new Dependency( createArtifact( "dom4j", "dom4j", "1.6.1" ), "test" ) );
+ List<TreeEntry> treeEntries =
+ builder.buildDependencyTree( Collections.singletonList( TEST_REPO_ID ), TEST_GROUP_ID, TEST_ARTIFACT_ID,
+ TEST_VERSION );
- nodes.put( getId( dom4j.getDependency().getArtifact() ), dom4j );
-
- //dom4j.setFailedUpdateScope("compile");
-
- DependencyNode junit =
- new TestDefaultDependencyNode( new Dependency( createArtifact( "junit", "junit", "3.8.1" ), "test" ) );
-
- nodes.put( getId( junit.getDependency().getArtifact() ), junit );
-
- DependencyNode easymock = new TestDefaultDependencyNode(
- new Dependency( createArtifact( "easymock", "easymock", "1.2_Java1.3" ), "test" ) );
-
- nodes.put( getId( easymock.getDependency().getArtifact() ), easymock );
-
- DependencyNode easymockExt = new TestDefaultDependencyNode(
- new Dependency( createArtifact( "easymock", "easymockclassextension", "1.2" ), "test" ) );
-
- nodes.put( getId( easymockExt.getDependency().getArtifact() ), easymockExt );
-
- DependencyNode mainNode = new TestDefaultDependencyNode(
- new Dependency( createArtifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION ), "" ) );
-
- nodes.put( getId( mainNode.getDependency().getArtifact() ), mainNode );
-
- mainNode.getChildren().add( commonsLang );
- mainNode.getChildren().add( commonsIO );
- mainNode.getChildren().add( slf4j );
- mainNode.getChildren().add( plexusAPI );
- mainNode.getChildren().add( plexusSpring );
- mainNode.getChildren().add( xalan );
- mainNode.getChildren().add( dom4j );
- mainNode.getChildren().add( junit );
- mainNode.getChildren().add( easymock );
- mainNode.getChildren().add( easymockExt );
-
- /*defaultRepositorySystem.setDependencyCollector( new DependencyCollector()
- {
-
- public CollectResult collectDependencies( RepositorySystemSession session, CollectRequest request )
- throws DependencyCollectionException
- {
- CollectResult collectResult = new CollectResult( request );
- collectResult.setRoot( new DefaultDependencyNode() );
- for ( Dependency dependency : request.getDependencies() )
- {
- DependencyNode node = nodes.get( getId( dependency.getArtifact() ) );
- if ( node != null )
- {
- collectResult.getRoot().getChildren().add( node );
- }
- }
- return collectResult;
- }
- } );
- */
-
- MockControl control = MockControl.createStrictControl( DependencyVisitor.class );
- DependencyVisitor visitor = (DependencyVisitor) control.getMock();
-
- control.expectAndReturn( visitor.visitEnter( mainNode ), true );
-
- control.expectAndReturn( visitor.visitEnter( commonsLang ), true );
- control.expectAndReturn( visitor.visitLeave( commonsLang ), true );
-
- control.expectAndReturn( visitor.visitEnter( commonsIO ), true );
- control.expectAndReturn( visitor.visitLeave( commonsIO ), true );
-
- control.expectAndReturn( visitor.visitEnter( slf4j ), true );
- control.expectAndReturn( visitor.visitLeave( slf4j ), true );
-
- control.expectAndReturn( visitor.visitEnter( plexusAPI ), true );
- control.expectAndReturn( visitor.visitLeave( plexusAPI ), true );
-
- control.expectAndReturn( visitor.visitEnter( plexusSpring ), true );
-
- control.expectAndReturn( visitor.visitEnter( springContext ), true );
- control.expectAndReturn( visitor.visitLeave( springContext ), true );
-
- control.expectAndReturn( visitor.visitEnter( springTest ), true );
- control.expectAndReturn( visitor.visitLeave( springTest ), true );
-
- control.expectAndReturn( visitor.visitEnter( plexusUtils ), true );
- control.expectAndReturn( visitor.visitLeave( plexusUtils ), true );
-
- control.expectAndReturn( visitor.visitEnter( slf4jLog4j12 ), true );
- control.expectAndReturn( visitor.visitLeave( slf4jLog4j12 ), true );
-
- control.expectAndReturn( visitor.visitEnter( plexusLog4j ), true );
- control.expectAndReturn( visitor.visitLeave( plexusLog4j ), true );
-
- control.expectAndReturn( visitor.visitEnter( log4j ), true );
- control.expectAndReturn( visitor.visitLeave( log4j ), true );
-
- control.expectAndReturn( visitor.visitEnter( mavenArtifact ), true );
- control.expectAndReturn( visitor.visitLeave( mavenArtifact ), true );
-
- control.expectAndReturn( visitor.visitEnter( mavenProject ), true );
- control.expectAndReturn( visitor.visitLeave( mavenProject ), true );
-
- control.expectAndReturn( visitor.visitEnter( mavenCore ), true );
- control.expectAndReturn( visitor.visitLeave( mavenCore ), true );
-
- control.expectAndReturn( visitor.visitEnter( mavenSettings ), true );
- control.expectAndReturn( visitor.visitLeave( mavenSettings ), true );
-
- control.expectAndReturn( visitor.visitEnter( mavenModel ), true );
- control.expectAndReturn( visitor.visitLeave( mavenModel ), true );
-
- control.expectAndReturn( visitor.visitEnter( plexusCommandLine ), true );
- control.expectAndReturn( visitor.visitLeave( plexusCommandLine ), true );
-
- control.expectAndReturn( visitor.visitEnter( plexusRegistryCommons ), true );
- control.expectAndReturn( visitor.visitLeave( plexusRegistryCommons ), true );
-
- control.expectAndReturn( visitor.visitEnter( plexusRegistryApi ), true );
- control.expectAndReturn( visitor.visitLeave( plexusRegistryApi ), true );
-
- control.expectAndReturn( visitor.visitLeave( plexusSpring ), true );
-
- control.expectAndReturn( visitor.visitEnter( xalan ), true );
- control.expectAndReturn( visitor.visitLeave( xalan ), true );
-
- control.expectAndReturn( visitor.visitEnter( dom4j ), true );
- control.expectAndReturn( visitor.visitLeave( dom4j ), true );
-
- control.expectAndReturn( visitor.visitEnter( junit ), true );
- control.expectAndReturn( visitor.visitLeave( junit ), true );
-
- control.expectAndReturn( visitor.visitEnter( easymock ), true );
- control.expectAndReturn( visitor.visitLeave( easymock ), true );
-
- control.expectAndReturn( visitor.visitEnter( easymockExt ), true );
- control.expectAndReturn( visitor.visitLeave( easymockExt ), true );
-
- control.expectAndReturn( visitor.visitLeave( mainNode ), true );
-
- control.replay();
-
- visitor = new DependencyVisitor()
- {
- public boolean visitEnter( DependencyNode dependencyNode )
- {
- return true;
- }
-
- public boolean visitLeave( DependencyNode dependencyNode )
- {
- return true;
- }
- };
-
- builder.buildDependencyTree( Collections.singletonList( TEST_REPO_ID ), TEST_GROUP_ID, TEST_ARTIFACT_ID,
- TEST_VERSION, visitor );
-
- control.verify();
+ Assertions.assertThat( treeEntries ).isNotNull().isNotEmpty().contains(
+ new TreeEntry( new Artifact( TEST_GROUP_ID, TEST_ARTIFACT_ID, TEST_VERSION, "", "" ) ) );
+ Assertions.assertThat( treeEntries.get( 0 ).getChilds() ).isNotNull().isNotEmpty().contains(
+ new TreeEntry( new Artifact( "commons-lang", "commons-lang", "2.2", "compile", "" ) ) );
}
- public static class TestDefaultDependencyNode
- extends DefaultDependencyNode
+
+ public static class TestTreeEntry
+ extends TreeEntry
{
+ Artifact a;
- private TestDefaultDependencyNode( Dependency dependency )
+ public TestTreeEntry( Artifact a )
{
- super( dependency );
+ this.a = a;
}
@Override
public int hashCode()
{
- return super.hashCode();
+ return this.a.hashCode();
}
@Override
public boolean equals( Object o )
{
- DependencyNode node = (DependencyNode) o;
- boolean equals = this.getDependency().getArtifact().getGroupId().equals(
- node.getDependency().getArtifact().getGroupId() ) &&
- this.getDependency().getArtifact().getArtifactId().equals(
- node.getDependency().getArtifact().getArtifactId() ) &&
- this.getDependency().getArtifact().getVersion().equals(
- node.getDependency().getArtifact().getVersion() );
- return equals;
+ Artifact artifact = ( (TreeEntry) o ).getArtifact();
+ return artifact.equals( this.a );
}
}
+
}
<artifactId>archiva-maven2-metadata</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>archiva-maven2-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.archiva</groupId>
<artifactId>archiva-repository-admin-api</artifactId>