package org.apache.maven.j2ee;

/* ====================================================================
 *   Copyright 2001-2004 The Apache Software Foundation.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * ====================================================================
 */

import java.util.EventObject;

/**
 * A class that holds details about the validation
 * 
 * @version $Id$
 * @author  dion
 */
public class ValidationEvent extends EventObject 
{
    
    /** A message describing the validation event that occurred */
    private String message;
    
    /** The thing being validated that the event relates to, e.g a WAR file */
    private Object subject;
    
    /**
     * Creates a new instance of ValidationEvent.
     * 
     * @param source the source of the event, some validator.
     */
    public ValidationEvent(Object source)
    {
        this(source, null, null);
    }

    /**
     * Creates a new instance of ValidationEvent.
     * 
     * @param source the source of the event, some validator.
     * @param subject the object being validated
     * @param message the validation message
     */
    public ValidationEvent(Object source, Object subject, String message)
    {
        super(source);
        setSubject(subject);
        setMessage(message);
    }

    /**
     * Getter for property message.
     * 
     * @return Value of property message.
     */
    public String getMessage()
    {
        return message;
    }
    
    /**
     * Setter for property message.
     * 
     * @param message New value of property message.
     */
    public void setMessage(String message)
    {
        this.message = message;
    }
    
    /**
     * Getter for property subject.
     * 
     * @return Value of property subject.
     */
    public Object getSubject()
    {
        return subject;
    }
    
    /**
     * Set the subject of the validation event.
     * 
     * @param subject New value of property subject.
     */
    public void setSubject(Object subject)
    {
        this.subject = subject;
    }
    
}
