This project has retired. For details please refer to its Attic page.
Policy xref
View Javadoc
1   package org.apache.archiva.policies;
2   
3   /*
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
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
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
19   * under the License.
20   */
21  
22  import java.util.List;
23  import java.util.Locale;
24  import java.util.MissingResourceException;
25  
26  
27  /**
28   * This is a generic interface for policies. Policies define different actions to apply to artifacts during the
29   * repository lifecycle, e.g. download, upload, errors.
30   */
31  public interface Policy
32  {
33  
34      String RESOURCE_BUNDLE = "archiva_policies";
35  
36      /**
37       * Get the list of options for this policy.
38       *
39       * @return the list of options for this policy.
40       */
41      List<PolicyOption> getOptions();
42  
43      /**
44       * Get the default option for this policy.
45       *
46       * @return the default policy for this policy.
47       */
48      PolicyOption getDefaultOption();
49  
50      /**
51       * Get the id for this policy.
52       *
53       * @return the id for this policy.
54       */
55      String getId();
56  
57      /**
58       * Get the display name for this policy.
59       *
60       * @return the name for this policy
61       */
62      String getName();
63  
64      /**
65       * Get the policy name in the language of the given locale.
66       * @param locale The locale
67       * @return The policy name
68       */
69      String getName(Locale locale);
70  
71      /**
72       * Return a description of the policy.
73       * @param locale The language
74       * @return The description
75       */
76      String getDescription(Locale locale);
77  
78      /**
79       * Returns a description for the given option.
80       * @param locale The locale for the description.
81       * @param option The option to ask the description for.
82       * @return A description of the option in the requested language.
83       * @throws MissingResourceException if the option is not known by this policy.
84       */
85      String getOptionDescription(Locale locale, PolicyOption option) throws MissingResourceException;
86  
87      /**
88       * Returns a name for the given option.
89       * @param locale The locale for the name
90       * @param option  The option identifier
91       * @return  A name in the requested language.
92       * @throws MissingResourceException if the option is not known by this policy.
93       */
94      String getOptionName(Locale locale, PolicyOption option) throws MissingResourceException;
95  }