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;
019
020 /**
021 * An abstract implementation that returns default values for non-mandatory
022 * methods.
023 *
024 * @author Echo File Transfer Library
025 * @version $Id: AbstractDownloadProvider.java 248 2009-10-19 14:20:53Z sptrakesh $
026 */
027 public abstract class AbstractDownloadProvider
028 implements DownloadProvider
029 {
030 /**The file name of the content being enqueued to the client. */
031 protected String fileName;
032
033 /** The content length of the file (or equivalent) being enqueued to client. */
034 protected long size;
035
036 /** The content disposition for the file being sent to client. */
037 protected String contentDisposition = "attachment";
038
039 /**
040 * The content-type to set for the file. Specify only if you wish to
041 * over-ride default processing.
042 */
043 protected String contentType;
044
045 /** The status of the download process. */
046 protected Status status;
047
048 /** {@inheritDoc} */
049 public String getFileName()
050 {
051 return fileName;
052 }
053
054 /**
055 * Set the file name for the downloaded content. Specify if you wish
056 * to over-ride the default name.
057 *
058 * @param fileName The file name to send to client.
059 */
060 public void setFileName( final String fileName )
061 {
062 this.fileName = fileName;
063 }
064
065 /** {@inheritDoc} */
066 public long getSize()
067 {
068 return size;
069 }
070
071 /** {@inheritDoc} */
072 public String getContentDisposition()
073 {
074 return contentDisposition;
075 }
076
077 /**
078 * Set the content-type for the file. Specify if you wish to explicitly
079 * set the content-type rather than let default rules apply.
080 *
081 * @param contentType The content-type to set.
082 */
083 public void setContentType( final String contentType )
084 {
085 this.contentType = contentType;
086 }
087
088 /** {@inheritDoc} */
089 public Status getStatus()
090 {
091 return status;
092 }
093 }