This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.policies;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.util.List;
023import java.util.Locale;
024import java.util.MissingResourceException;
025
026
027/**
028 * This is a generic interface for policies. Policies define different actions to apply to artifacts during the
029 * repository lifecycle, e.g. download, upload, errors.
030 */
031public interface Policy
032{
033
034    String RESOURCE_BUNDLE = "archiva_policies";
035
036    /**
037     * Get the list of options for this policy.
038     *
039     * @return the list of options for this policy.
040     */
041    List<PolicyOption> getOptions();
042
043    /**
044     * Get the default option for this policy.
045     *
046     * @return the default policy for this policy.
047     */
048    PolicyOption getDefaultOption();
049
050    /**
051     * Get the id for this policy.
052     *
053     * @return the id for this policy.
054     */
055    String getId();
056
057    /**
058     * Get the display name for this policy.
059     *
060     * @return the name for this policy
061     */
062    String getName();
063
064    /**
065     * Get the policy name in the language of the given locale.
066     * @param locale The locale
067     * @return The policy name
068     */
069    String getName(Locale locale);
070
071    /**
072     * Return a description of the policy.
073     * @param locale The language
074     * @return The description
075     */
076    String getDescription(Locale locale);
077
078    /**
079     * Returns a description for the given option.
080     * @param locale The locale for the description.
081     * @param option The option to ask the description for.
082     * @return A description of the option in the requested language.
083     * @throws MissingResourceException if the option is not known by this policy.
084     */
085    String getOptionDescription(Locale locale, PolicyOption option) throws MissingResourceException;
086
087    /**
088     * Returns a name for the given option.
089     * @param locale The locale for the name
090     * @param option  The option identifier
091     * @return  A name in the requested language.
092     * @throws MissingResourceException if the option is not known by this policy.
093     */
094    String getOptionName(Locale locale, PolicyOption option) throws MissingResourceException;
095}