You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Policy.java 2.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. package org.apache.archiva.policies;
  2. /*
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. */
  20. import java.util.List;
  21. import java.util.Locale;
  22. import java.util.MissingResourceException;
  23. /**
  24. * This is a generic interface for policies. Policies define different actions to apply to artifacts during the
  25. * repository lifecycle, e.g. download, upload, errors.
  26. */
  27. public interface Policy
  28. {
  29. String RESOURCE_BUNDLE = "archiva_policies";
  30. /**
  31. * Get the list of options for this policy.
  32. *
  33. * @return the list of options for this policy.
  34. */
  35. List<PolicyOption> getOptions();
  36. /**
  37. * Get the default option for this policy.
  38. *
  39. * @return the default policy for this policy.
  40. */
  41. PolicyOption getDefaultOption();
  42. /**
  43. * Get the id for this policy.
  44. *
  45. * @return the id for this policy.
  46. */
  47. String getId();
  48. /**
  49. * Get the display name for this policy.
  50. *
  51. * @return the name for this policy
  52. */
  53. String getName();
  54. /**
  55. * Get the policy name in the language of the given locale.
  56. * @param locale The locale
  57. * @return The policy name
  58. */
  59. String getName(Locale locale);
  60. /**
  61. * Return a description of the policy.
  62. * @param locale The language
  63. * @return The description
  64. */
  65. String getDescription(Locale locale);
  66. /**
  67. * Returns a description for the given option.
  68. * @param locale The locale for the description.
  69. * @param option The option to ask the description for.
  70. * @return A description of the option in the requested language.
  71. * @throws MissingResourceException if the option is not known by this policy.
  72. */
  73. String getOptionDescription(Locale locale, PolicyOption option) throws MissingResourceException;
  74. /**
  75. * Returns a name for the given option.
  76. * @param locale The locale for the name
  77. * @param option The option identifier
  78. * @return A name in the requested language.
  79. * @throws MissingResourceException if the option is not known by this policy.
  80. */
  81. String getOptionName(Locale locale, PolicyOption option) throws MissingResourceException;
  82. }