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
022/**
023 * An exception occurring during the execution of a rule. Based off of
024 * EnforcerRuleException, but separated to keep the rule dependencies to a
025 * minimum.
026 *
027 * @author <a href="mailto:brianf@apache.org">Brian Fox</a>
028 */
029public class EnforcerRuleException
030    extends Exception
031{
032
033    /** serialVersionUID. */
034    private static final long serialVersionUID = 1L;
035
036    /** The source. */
037    protected Object source;
038
039    /** The long message. */
040    protected String longMessage;
041
042    /**
043     * Gets the long message.
044     *
045     * @return the long message
046     */
047    public String getLongMessage()
048    {
049        return longMessage;
050    }
051
052    /**
053     * Gets the source.
054     *
055     * @return the source
056     */
057    public Object getSource()
058    {
059        return source;
060    }
061
062    /**
063     * Construct a new <code>EnforcerRuleException</code> exception providing
064     * the source and a short and long message.
065     *
066     * @param source the source
067     * @param shortMessage the short message
068     * @param longMessage the long message
069     */
070    public EnforcerRuleException( Object source, String shortMessage, String longMessage )
071    {
072        super( shortMessage );
073        this.source = source;
074        this.longMessage = longMessage;
075    }
076
077    /**
078     * Construct a new <code>EnforcerRuleException</code> exception wrapping
079     * an underlying <code>Exception</code> and providing a
080     * <code>message</code>.
081     *
082     * @param message the message
083     * @param cause the cause
084     */
085    public EnforcerRuleException( String message, Exception cause )
086    {
087        super( message, cause );
088    }
089
090    /**
091     * Construct a new <code>EnforcerRuleException</code> exception wrapping
092     * an underlying <code>Throwable</code> and providing a
093     * <code>message</code>.
094     *
095     * @param message the message
096     * @param cause the cause
097     */
098    public EnforcerRuleException( String message, Throwable cause )
099    {
100        super( message, cause );
101    }
102
103    /**
104     * Construct a new <code>EnforcerRuleException</code> exception providing
105     * a <code>message</code>.
106     *
107     * @param message the message
108     */
109    public EnforcerRuleException( String message )
110    {
111        super( message );
112    }
113}