1 package org.apache.maven.enforcer.rule.api; 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.Map; 24 25 import javax.annotation.Nonnull; 26 27 import org.apache.maven.plugin.logging.Log; 28 import org.codehaus.plexus.PlexusContainer; 29 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator; 30 import org.codehaus.plexus.component.repository.exception.ComponentLookupException; 31 32 33 /** 34 * This is the interface that all helpers will use. This 35 * provides access to the log, session and components to the 36 * rules. 37 * 38 * @author <a href="mailto:brianf@apache.org">Brian Fox</a> 39 */ 40 public interface EnforcerRuleHelper 41 extends ExpressionEvaluator 42 { 43 44 /** 45 * Gets the log. 46 * 47 * @return the log 48 */ 49 @Nonnull 50 Log getLog (); 51 52 /** 53 * Gets the component. 54 * 55 * @param clazz the clazz 56 * 57 * @return the component 58 * 59 * @throws ComponentLookupException the component lookup exception 60 */ 61 @Nonnull 62 <T> T getComponent ( Class<T> clazz ) 63 throws ComponentLookupException; 64 65 /** 66 * Gets the component. 67 * 68 * @param componentKey the component key 69 * 70 * @return the component 71 * 72 * @throws ComponentLookupException the component lookup exception 73 */ 74 @Nonnull 75 Object getComponent ( String componentKey ) 76 throws ComponentLookupException; 77 78 /** 79 * Gets the component. 80 * 81 * @param role the role 82 * @param roleHint the role hint 83 * 84 * @return the component 85 * 86 * @throws ComponentLookupException the component lookup exception 87 */ 88 Object getComponent ( String role, String roleHint ) 89 throws ComponentLookupException; 90 91 /** 92 * Gets the component. 93 * 94 * @param clazz the clazz 95 * @param roleHint the role hint 96 * 97 * @return the component 98 * 99 * @throws ComponentLookupException the component lookup exception 100 */ 101 <T> T getComponent ( Class<T> clazz, String roleHint ) 102 throws ComponentLookupException; 103 104 /** 105 * Gets the component map. 106 * 107 * @param role the role 108 * 109 * @return the component map 110 * 111 * @throws ComponentLookupException the component lookup exception 112 */ 113 Map<String, ?> getComponentMap ( String role ) 114 throws ComponentLookupException; 115 116 /** 117 * Gets the component list. 118 * 119 * @param role the role 120 * 121 * @return the component list 122 * 123 * @throws ComponentLookupException the component lookup exception 124 */ 125 List<?> getComponentList ( String role ) 126 throws ComponentLookupException; 127 128 /** 129 * Gets the container. 130 * 131 * @return the container 132 */ 133 PlexusContainer getContainer(); 134 }