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.resolution;
020
021import org.eclipse.aether.RepositorySystemSession;
022
023/**
024 * Controls the handling of errors related to reading an artifact descriptor.
025 *
026 * @see RepositorySystemSession#getArtifactDescriptorPolicy()
027 */
028public interface ArtifactDescriptorPolicy {
029
030    /**
031     * Bit mask indicating that errors while reading the artifact descriptor should not be tolerated.
032     */
033    int STRICT = 0x00;
034
035    /**
036     * Bit flag indicating that missing artifact descriptors should be silently ignored.
037     */
038    int IGNORE_MISSING = 0x01;
039
040    /**
041     * Bit flag indicating that existent but invalid artifact descriptors should be silently ignored.
042     */
043    int IGNORE_INVALID = 0x02;
044
045    /**
046     * Bit mask indicating that all errors should be silently ignored.
047     */
048    int IGNORE_ERRORS = IGNORE_MISSING | IGNORE_INVALID;
049
050    /**
051     * Gets the error policy for an artifact's descriptor.
052     *
053     * @param session The repository session during which the policy is determined, must not be {@code null}.
054     * @param request The policy request holding further details, must not be {@code null}.
055     * @return The bit mask describing the desired error policy.
056     */
057    int getPolicy(RepositorySystemSession session, ArtifactDescriptorPolicyRequest request);
058}