1 package org.apache.maven.archiva.repository.layout;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.maven.archiva.model.ArchivaArtifact;
23 import org.apache.maven.archiva.model.ArtifactReference;
24 import org.apache.maven.archiva.model.VersionedReference;
27 * BidirectionalRepositoryLayout - Similar in scope to ArtifactRepositoryLayout, but does
28 * the both the Path to Artifact, and Artifact to Path conversions.
30 * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
33 public interface BidirectionalRepositoryLayout
36 * Get the identifier for this layout.
38 * @return the identifier for this layout.
40 public String getId();
43 * Given a repository relative path, return <code>true</code> if the path is valid
44 * according to the repository layout.
46 public boolean isValidPath( String path );
49 * Given an ArchivaArtifact, return the relative path to the artifact.
51 * @param artifact the artifact to use.
52 * @return the relative path to the artifact.
54 public String toPath( ArchivaArtifact artifact );
57 * Given an ArtifactReference, return the relative path to the artifact.
59 * @param reference the artifact reference to use.
60 * @return the relative path to the artifact.
62 public String toPath( ArtifactReference reference );
65 * Given a repository relative path to a filename, return the {@link ArchivaArtifact} object suitable for the path.
67 * @param path the path relative to the repository base dir for the artifact.
68 * @return the {@link ArchivaArtifact} representing the path. (or null if path cannot be converted to
69 * an {@link ArchivaArtifact})
70 * @throws LayoutException if there was a problem converting the path to an artifact.
72 public ArchivaArtifact toArtifact( String path )
73 throws LayoutException;
76 * Given a repository relative path to a filename, return the {@link VersionedReference} object suitable for the path.
78 * @param path the path relative to the repository base dir for the artifact.
79 * @return the {@link ArtifactReference} representing the path. (or null if path cannot be converted to
80 * a {@link ArtifactReference})
81 * @throws LayoutException if there was a problem converting the path to an artifact.
83 public ArtifactReference toArtifactReference( String path )
84 throws LayoutException;