001: /*
002: * Copyright 2006 Pentaho Corporation. All rights reserved.
003: * This software was developed by Pentaho Corporation and is provided under the terms
004: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005: * this file except in compliance with the license. If you need a copy of the license,
006: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
007: * BI Platform. The Initial Developer is Pentaho Corporation.
008: *
009: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
011: * the license for the specific language governing your rights and limitations.
012: *
013: * @created Jul 11, 2005
014: * @author James Dixon
015: *
016: */
017: package org.pentaho.core.services;
018:
019: import java.io.InputStream;
020: import java.io.OutputStream;
021: import java.io.Reader;
022: import java.util.Date;
023: import java.util.List;
024:
025: import javax.activation.FileDataSource;
026:
027: import org.pentaho.core.repository.IContentItem;
028: import org.pentaho.core.solution.HttpOutputHandler;
029: import org.pentaho.core.solution.MimeTypeListener;
030: import org.pentaho.core.repository.content.ContentException;
031:
032: public class HttpContentItem implements IContentItem {
033:
034: private String mimeType;
035:
036: private OutputStream outputStream;
037:
038: private HttpOutputHandler outputHandler;
039:
040: private MimeTypeListener mimeTypeListener = null;
041:
042: public HttpContentItem(OutputStream outputStream,
043: HttpOutputHandler outputHandler) {
044: this .outputStream = outputStream;
045: this .outputHandler = outputHandler;
046: }
047:
048: public void closeOutputStream() {
049: // nothing to do here
050: }
051:
052: public String getId() {
053: return null;
054: }
055:
056: public String getPath() {
057: return null;
058: }
059:
060: public String getName() {
061: return null;
062: }
063:
064: public String getTitle() {
065: return null;
066: }
067:
068: public String getMimeType() {
069: return mimeType;
070: }
071:
072: public void setMimeType(String mimeType) {
073: this .mimeType = mimeType;
074: outputHandler.setMimeType(mimeType);
075: if (mimeTypeListener != null) {
076: mimeTypeListener.setMimeType(mimeType);
077: }
078: }
079:
080: public String getUrl() {
081: return null;
082: }
083:
084: public List getFileVersions() {
085: return null;
086: }
087:
088: public void removeAllVersions() {
089: }
090:
091: public void removeVersion(String fileId) {
092: }
093:
094: public InputStream getInputStream() throws ContentException {
095: return null;
096: }
097:
098: public FileDataSource getDataSource() {
099: // TODO
100: return null;
101: }
102:
103: public Reader getReader() throws ContentException {
104: return null;
105: }
106:
107: public OutputStream getOutputStream(String actionName) {
108: if (mimeType == null) {
109: setMimeType("text/html"); //$NON-NLS-1$
110: }
111: return outputStream;
112: }
113:
114: public void setOutputStream(OutputStream outputStream) {
115: this .outputStream = outputStream;
116: }
117:
118: public String getActionName() {
119: return null;
120: }
121:
122: public String getFileId() {
123: return null;
124: }
125:
126: public long getFileSize() {
127: return 0;
128: }
129:
130: public Date getFileDateTime() {
131: return null;
132: }
133:
134: public void makeTransient() {
135: // NOOP
136: }
137:
138: public MimeTypeListener getMimeTypeListener() {
139: return mimeTypeListener;
140: }
141:
142: public void setMimeTypeListener(MimeTypeListener mimeTypeListener) {
143: this.mimeTypeListener = mimeTypeListener;
144: }
145:
146: }
|