001    /*
002     * This file is part of the Echo Point Project.  This project is a
003     * collection of Components that have extended the Echo Web Application
004     * Framework Version 3.
005     *
006     * Version: MPL 1.1
007     *
008     * The contents of this file are subject to the Mozilla Public License Version
009     * 1.1 (the "License"); you may not use this file except in compliance with
010     * the License. You may obtain a copy of the License at
011     * http://www.mozilla.org/MPL/
012     *
013     * Software distributed under the License is distributed on an "AS IS" basis,
014     * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
015     * for the specific language governing rights and limitations under the
016     * License.
017     */
018    package echopoint.tucana.event;
019    
020    import echopoint.tucana.FileUploadSelector;
021    
022    import java.util.EventObject;
023    
024    /**
025     * A base class that represents an upload event.
026    
027     * <p><b>Note:</b> Development of this component was sponsored by <a
028     * href='http://tcnbroadcasting.com/index.jsp' target='_top'>TCN
029     * Broadcasting</a>.  We are grateful for their support and sponsorship.</p>
030     *
031     * @author jvolkman (Echo2), Rakesh 2008-11-2
032     * @version $Id: UploadEvent.java 90 2008-11-11 01:41:05Z sptrakesh $
033     */
034    public abstract class UploadEvent extends EventObject
035    {
036      private static final long serialVersionUID = 1l;
037    
038      /** The unique upload index for the upload event. */
039      private final String index;
040    
041      /** The content type for the file that was uploaded. */
042      private final String contentType;
043    
044      /** The name of the file that was uploaded. */
045      private final String fileName;
046    
047      /**
048       * Creates a new {@link UploadEvent}.
049       *
050       * @param source the source of the event
051       * @param index the index of the upload
052       * @param fileName the name of the file, may not contain path information
053       * @param contentType the content type of the uploaded file
054       */
055      public UploadEvent( final FileUploadSelector source, final String index,
056          final String fileName,  final String contentType )
057      {
058        super( source );
059        this.index = index;
060        this.fileName = fileName;
061        this.contentType = contentType;
062      }
063    
064      /**
065       * Returns the index of the file.
066       *
067       * @return the index of the file.
068       */
069      public String getIndex()
070      {
071        return index;
072      }
073    
074      /**
075       * Return the content type of the uploaded file.
076       *
077       * @return The content type property of the uploaded file.
078       */
079      public String getContentType()
080      {
081        return contentType;
082      }
083    
084      /**
085       * The name of the file that was uploaded.
086       *
087       * @return The file name.
088       */
089      public String getFileName()
090      {
091        return fileName;
092      }
093    }