001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied.  See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 */
019package org.eclipse.aether.internal.impl;
020
021import org.eclipse.aether.artifact.Artifact;
022import org.eclipse.aether.metadata.Metadata;
023
024/**
025 * Composes {@link Artifact} and {@link Metadata} relative paths to be used in
026 * {@link org.eclipse.aether.repository.LocalRepositoryManager}.
027 *
028 * @since 1.8.1
029 */
030public interface LocalPathComposer {
031    /**
032     * Gets the relative path for a locally installed (local=true) or remotely cached (local=false) artifact.
033     *
034     * @param artifact The artifact for which to determine the path, must not be {@code null}.
035     * @param local    {@code true} if artifact is locally installed or {@code false} if artifact is remotely cached.
036     * @return A relative path representing artifact path.
037     */
038    String getPathForArtifact(Artifact artifact, boolean local);
039
040    /**
041     * Gets the relative path for locally installed (repositoryKey=local) or remotely cached metadata. The
042     * {@code repositoryKey} should be used at caller discretion, it merely denotes the origin of the metadata, while
043     * value "local" usually means local origin, but again, this is not a must or enforced, just how things happened
044     * so far.
045     *
046     * @param metadata      The metadata for which to determine the path, must not be {@code null}.
047     * @param repositoryKey The repository key, never {@code null}.
048     * @return A relative path representing metadata path.
049     */
050    String getPathForMetadata(Metadata metadata, String repositoryKey);
051}