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.DownloadCommand;
021
022 import java.util.EventObject;
023
024 /**
025 * A base download event class used to indicate a file/content download
026 * process.
027 *
028 * @author Rakesh 2008-11-11
029 * @version $Id: DownloadEvent.java 92 2008-11-11 19:49:44Z sptrakesh $
030 */
031 public abstract class DownloadEvent extends EventObject
032 {
033 private static final long serialVersionUID = 1l;
034
035 /** The file name (if any) of the content being downloaded. */
036 protected final String fileName;
037
038 /** The total size in bytes of the content that is being downloaded. */
039 protected final long contentLength;
040
041 /** The mime type of the content that is being downloaded. */
042 protected final String contentType;
043
044 /**
045 * Constructs a new download event with the specified content attributes.
046 *
047 * @param source The object on which the Event initially occurred.
048 * @param fileName The name of the file that is being downnloaded.
049 * @param contentLength The size in bytes of the content.
050 * @param contentType The mime type of the content.
051 * @throws IllegalArgumentException if source is null.
052 */
053 public DownloadEvent( final DownloadCommand source, final String fileName,
054 final long contentLength, String contentType )
055 throws IllegalArgumentException
056 {
057 super( source );
058 this.fileName = fileName;
059 this.contentLength = contentLength;
060 this.contentType = contentType;
061 }
062
063 /**
064 * Accessor for property 'fileName'.
065 *
066 * @return Value for property 'fileName'.
067 */
068 public String getFileName()
069 {
070 return fileName;
071 }
072
073 /**
074 * Accessor for property 'contentLength'.
075 *
076 * @return Value for property 'contentLength'.
077 */
078 public long getContentLength()
079 {
080 return contentLength;
081 }
082
083 /**
084 * Accessor for property 'contentType'.
085 *
086 * @return Value for property 'contentType'.
087 */
088 public String getContentType()
089 {
090 return contentType;
091 }
092 }