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.io.File;
021: import java.util.Iterator;
022:
023: import org.pentaho.core.repository.content.ContentException;
024:
025: /**
026: * A Content location is analagous to a folder. It is the location of the content.
027: *
028: * @see IContentItem
029: * @see IContentRepository
030: * @author mbatchel
031: *
032: */
033:
034: public interface IContentLocation {
035:
036: /**
037: * Create a new ContentItem parented to this content location.
038: *
039: * @param name
040: * The name of the content item
041: * @param title
042: * The title of the content item
043: * @param extension
044: * The extension (i.e. .txt or .pdf) of the content item.
045: * @param mimeType
046: * The mime type of the content item
047: * @param url
048: * Optional URL to get to the content.
049: * @param writeMode
050: * The write mode of the content item. Please see IContentItem
051: * for valid write modes
052: * @return A new IContentItem instance, parented to the ContentLocation
053: * @throws ContentException
054: */
055: public IContentItem newContentItem(String name, String title,
056: String extension, String mimeType, String url, int writeMode)
057: throws ContentException;
058:
059: /**
060: * Create a new ContentItem parented to this content location. This version
061: * is used when the content Id is already generated.
062: *
063: * @param contentId
064: * The Identifier for the new content item
065: *
066: * @param name
067: * The name of the content item
068: * @param title
069: * The title of the content item
070: * @param extension
071: * The extension (i.e. .txt or .pdf) of the content item.
072: * @param mimeType
073: * The mime type of the content item
074: * @param url
075: * Optional URL to get to the content.
076: * @param writeMode
077: * The write mode of the content item. Please see IContentItem
078: * for valid write modes
079: * @return A new IContentItem instance, parented to the ContentLocation
080: * @throws ContentException
081: */
082: public IContentItem newContentItem(String contentId, String name,
083: String title, String extension, String mimeType,
084: String url, int writeMode) throws ContentException;
085:
086: /**
087: * @return The revision of the content item (as determined by Hibernate)
088: */
089: public int getRevision();
090:
091: /**
092: * Iterates over registered content items.
093: *
094: * @return Iterator of the child content
095: */
096: public Iterator getContentItemIterator();
097:
098: /**
099: * Gets a content item by its Id - this is the most efficient way to get a
100: * content item from a location
101: *
102: * @param contentItemId
103: * The id to retrieve
104: * @return The content item
105: */
106: public IContentItem getContentItemById(String contentItemId);
107:
108: /**
109: * Gets a child content item by name. Returns the ContentItem with the
110: * specified name, and a parent of the content location
111: *
112: * @param name
113: * The name to find
114: * @return ContentItem
115: */
116: public IContentItem getContentItemByName(String name);
117:
118: /**
119: * Returns the contentitem with the specified path
120: *
121: * @param path
122: * The path to look for
123: * @return The content item
124: */
125: public IContentItem getContentItemByPath(String path);
126:
127: /**
128: * Gets a temporary file in the location.
129: *
130: * @param fileSuffix
131: * What the file suffix should be. If null, then .tmp will be
132: * used.
133: * @return File that is unique within the directory inside this location.
134: * @throws ContentException
135: */
136: public File getTmpFile(String fileSuffix) throws ContentException;
137:
138: /**
139: * Gets a temporary file in the location.
140: *
141: * @param fileSuffix
142: * What the file suffix should be. If null, then .tmp will be
143: * used.
144: * @param deleteOnExit
145: * If true, will call the files' deleteOnExit method which will
146: * attempt to delete the file on VM termination.
147: * @return File that is unique within the directory inside this location.
148: * @throws ContentException
149: */
150: public File getTmpFile(String fileSuffix, boolean deleteOnExit)
151: throws ContentException;
152:
153: /**
154: * Creates a subdirectory in the content location.
155: *
156: * @param subDirName
157: * The directory name to create
158: * @return File created
159: * @throws ContentException
160: */
161: public File makeSubdirectory(String subDirName)
162: throws ContentException;
163:
164: /**
165: * @return The directory path
166: */
167: public String getDirPath();
168:
169: /**
170: * @return Returns the UUID of the content location
171: */
172: public String getId();
173:
174: /**
175: * @return The name of the content location
176: */
177: public String getName();
178:
179: /**
180: * @return The Solution Id
181: */
182: public String getSolutionId();
183:
184: /**
185: * @return The description of the Content Location
186: */
187: public String getDescription();
188:
189: }
|