1package org.apache.archiva.converter.artifact;
23/*4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122import org.apache.maven.artifact.Artifact;
23import org.apache.maven.artifact.repository.ArtifactRepository;
24import org.apache.maven.artifact.repository.metadata.AbstractRepositoryMetadata;
25import org.apache.maven.artifact.repository.metadata.Snapshot;
2627/**28 *29 * This is a copy of org.apache.maven.artifact.repository.metadata.SnapshotArtifactRepositoryMetadata30 * from the maven-compat module, because this is the only class that we use from the compat module and31 * we can get rid of the dependency.32 *33 * Metadata for the artifact version directory of the repository.34 *35 *36 * @author <a href="mailto:brett@apache.org">Brett Porter</a>37 *38 */39publicclassSnapshotArtifactRepositoryMetadata40extends AbstractRepositoryMetadata
41 {
42private Artifact artifact;
4344publicSnapshotArtifactRepositoryMetadata( Artifact artifact )
45 {
46super( createMetadata( artifact, null ) );
47this.artifact = artifact;
48 }
4950publicSnapshotArtifactRepositoryMetadata( Artifact artifact,
51 Snapshot snapshot )
52 {
53super( createMetadata( artifact, createVersioning( snapshot ) ) );
54this.artifact = artifact;
55 }
5657publicboolean storedInGroupDirectory()
58 {
59return false;
60 }
6162publicboolean storedInArtifactVersionDirectory()
63 {
64returntrue;
65 }
6667public String getGroupId()
68 {
69return artifact.getGroupId();
70 }
7172public String getArtifactId()
73 {
74return artifact.getArtifactId();
75 }
7677public String getBaseVersion()
78 {
79return artifact.getBaseVersion();
80 }
8182public Object getKey()
83 {
84return"snapshot " + artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getBaseVersion();
85 }
8687publicboolean isSnapshot()
88 {
89return artifact.isSnapshot();
90 }
9192publicint getNature()
93 {
94return isSnapshot() ? SNAPSHOT : RELEASE;
95 }
9697public ArtifactRepository getRepository()
98 {
99return artifact.getRepository();
100 }
101102publicvoid setRepository( ArtifactRepository remoteRepository )
103 {
104 artifact.setRepository( remoteRepository );
105 }
106 }