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.spi.artifact.generator;
020
021import org.eclipse.aether.RepositorySystemSession;
022import org.eclipse.aether.deployment.DeployRequest;
023import org.eclipse.aether.installation.InstallRequest;
024
025/**
026 * A factory to create artifact generators. Artifact generators can contribute additional artifacts during the
027 * installation/deployment of artifacts.
028 *
029 * @since 2.0.0
030 */
031public interface ArtifactGeneratorFactory {
032    /**
033     * Artifact property that carries generator id. Generated artifacts should have this property set.
034     */
035    String ARTIFACT_GENERATOR_ID = "artifactGeneratorId";
036
037    /**
038     * Creates a new artifact generator for the specified install request.
039     *
040     * @param session The repository system session from which to configure the generator, must not be {@code null}.
041     * @param request The install request the metadata generator is used for, must not be {@code null}.
042     * @return The artifact generator for the request or {@code null} if none.
043     */
044    ArtifactGenerator newInstance(RepositorySystemSession session, InstallRequest request);
045
046    /**
047     * Creates a new artifact generator for the specified deploy request.
048     *
049     * @param session The repository system session from which to configure the generator, must not be {@code null}.
050     * @param request The deploy request the metadata generator is used for, must not be {@code null}.
051     * @return The artifact generator for the request or {@code null} if none.
052     */
053    ArtifactGenerator newInstance(RepositorySystemSession session, DeployRequest request);
054
055    /**
056     * The priority of this factory. Factories with higher priority are invoked before those with lower priority.
057     *
058     * @return The priority of this factory.
059     */
060    float getPriority();
061}