001package org.apache.maven.enforcer.rule.api;
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.Map;
024
025import javax.annotation.Nonnull;
026
027import org.apache.maven.plugin.logging.Log;
028import org.codehaus.plexus.PlexusContainer;
029import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
030import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
031
032
033/**
034 * This is the interface that all helpers will use. This
035 * provides access to the log, session and components to the
036 * rules.
037 *
038 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
039 */
040public interface EnforcerRuleHelper
041    extends ExpressionEvaluator
042{
043
044    /**
045     * Gets the log.
046     *
047     * @return the log
048     */
049    @Nonnull
050    Log getLog ();
051
052    /**
053     * Gets the component.
054     *
055     * @param clazz the clazz
056     *
057     * @return the component
058     *
059     * @throws ComponentLookupException the component lookup exception
060     */
061    @Nonnull
062    Object getComponent ( Class clazz )
063        throws ComponentLookupException;
064
065    /**
066     * Gets the component.
067     *
068     * @param componentKey the component key
069     *
070     * @return the component
071     *
072     * @throws ComponentLookupException the component lookup exception
073     */
074    @Nonnull
075    Object getComponent ( String componentKey )
076        throws ComponentLookupException;
077
078    /**
079     * Gets the component.
080     *
081     * @param role the role
082     * @param roleHint the role hint
083     *
084     * @return the component
085     *
086     * @throws ComponentLookupException the component lookup exception
087     */
088    Object getComponent ( String role, String roleHint )
089        throws ComponentLookupException;
090
091    /**
092     * Gets the component map.
093     *
094     * @param role the role
095     *
096     * @return the component map
097     *
098     * @throws ComponentLookupException the component lookup exception
099     */
100    Map getComponentMap ( String role )
101        throws ComponentLookupException;
102
103    /**
104     * Gets the component list.
105     *
106     * @param role the role
107     *
108     * @return the component list
109     *
110     * @throws ComponentLookupException the component lookup exception
111     */
112    List getComponentList ( String role )
113        throws ComponentLookupException;
114
115    /**
116     * Gets the container.
117     *
118     * @return the container
119     */
120    PlexusContainer getContainer();
121}