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 1, 2005
014: * @author Marc Batchelor
015: *
016: */
017:
018: package org.pentaho.core.repository;
019:
020: import java.util.*;
021: import java.io.*;
022:
023: import org.pentaho.core.repository.content.ContentException;
024:
025: /**
026: * There is no access to this class outside of this package.
027: */
028: public interface IContentItemFile {
029:
030: /**
031: * @return The file name on disk.
032: */
033: public String getOsFileName();
034:
035: /**
036: * @return The path to the file on disk
037: */
038: public String getOsPath();
039:
040: /**
041: * @return The action name that created this file
042: */
043: public String getActionName();
044:
045: /**
046: * @return The Id of this file
047: */
048: public String getId();
049:
050: /**
051: * @return The file size
052: */
053: public long getFileSize();
054:
055: /**
056: * @return The file date/time
057: */
058: public Date getFileDateTime();
059:
060: /**
061: * @return An input stream from the file on disk
062: * @throws ContentException
063: */
064: public InputStream getInputStream() throws ContentException;
065:
066: /**
067: * @return A Reader from the file on disk.
068: * @throws ContentException
069: */
070: public Reader getReader() throws ContentException;
071:
072: /**
073: * @param overWriteOk
074: * Indicates whether overwriting the file on disk is ok.
075: * (determined by the write mode of the containing ContentItem).
076: * @return An OutputStream to write to
077: * @throws ContentException
078: */
079: public OutputStream getOutputStream(boolean overWriteOk)
080: throws ContentException;
081:
082: /**
083: * @param overWriteOk
084: * Indicates whether overwriting the file on disk is ok.
085: * (determined by the write mode of the containing ContentItem).
086: * @param append
087: * Indicates whether to append to the file.
088: * @return An OutputStream to write to
089: * @throws ContentException
090: */
091: public OutputStream getOutputStream(boolean overWriteOk,
092: boolean append) throws ContentException;
093:
094: /**
095: * Copies the latest file to another location
096: *
097: * @param newFileName
098: * File name to copy to. Must be fully qualified.
099: * @return Number of bytes copied
100: * @throws ContentException
101: */
102: public long copyToFile(String newFileName) throws ContentException;
103:
104: /**
105: * Deletes the file in the Operating System
106: *
107: * @return Success indicator
108: */
109: public boolean deleteOsFile();
110:
111: }
|