KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > core > repository > IContentLocation


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Jul 1, 2005
14  * @author Marc Batchelor
15  *
16  */

17
18 package org.pentaho.core.repository;
19
20 import java.io.File JavaDoc;
21 import java.util.Iterator JavaDoc;
22
23 import org.pentaho.core.repository.content.ContentException;
24
25 /**
26  * A Content location is analagous to a folder. It is the location of the content.
27  *
28  * @see IContentItem
29  * @see IContentRepository
30  * @author mbatchel
31  *
32  */

33
34 public interface IContentLocation {
35
36     /**
37      * Create a new ContentItem parented to this content location.
38      *
39      * @param name
40      * The name of the content item
41      * @param title
42      * The title of the content item
43      * @param extension
44      * The extension (i.e. .txt or .pdf) of the content item.
45      * @param mimeType
46      * The mime type of the content item
47      * @param url
48      * Optional URL to get to the content.
49      * @param writeMode
50      * The write mode of the content item. Please see IContentItem
51      * for valid write modes
52      * @return A new IContentItem instance, parented to the ContentLocation
53      * @throws ContentException
54      */

55     public IContentItem newContentItem(String JavaDoc name, String JavaDoc title, String JavaDoc extension, String JavaDoc mimeType, String JavaDoc url, int writeMode) throws ContentException;
56
57     /**
58      * Create a new ContentItem parented to this content location. This version
59      * is used when the content Id is already generated.
60      *
61      * @param contentId
62      * The Identifier for the new content item
63      *
64      * @param name
65      * The name of the content item
66      * @param title
67      * The title of the content item
68      * @param extension
69      * The extension (i.e. .txt or .pdf) of the content item.
70      * @param mimeType
71      * The mime type of the content item
72      * @param url
73      * Optional URL to get to the content.
74      * @param writeMode
75      * The write mode of the content item. Please see IContentItem
76      * for valid write modes
77      * @return A new IContentItem instance, parented to the ContentLocation
78      * @throws ContentException
79      */

80     public IContentItem newContentItem(String JavaDoc contentId, String JavaDoc name, String JavaDoc title, String JavaDoc extension, String JavaDoc mimeType, String JavaDoc url, int writeMode) throws ContentException;
81     
82     /**
83      * @return The revision of the content item (as determined by Hibernate)
84      */

85     public int getRevision();
86
87     /**
88      * Iterates over registered content items.
89      *
90      * @return Iterator of the child content
91      */

92     public Iterator JavaDoc getContentItemIterator();
93
94     /**
95      * Removes a specific content item registered to this location.
96      *
97      * @param theFileName
98      * The file name to remove
99      * @param tryFileDelete
100      * If true, it will try to delete the file from the Operating
101      * System too
102      */

103     public boolean removeContentItemByName(String JavaDoc theFileName, boolean tryFileDelete) throws ContentException;
104
105     /**
106      * Gets a content item by its Id - this is the most efficient way to get a
107      * content item from a location
108      *
109      * @param contentItemId
110      * The id to retrieve
111      * @return The content item
112      */

113     public IContentItem getContentItemById(String JavaDoc contentItemId);
114
115     /**
116      * Gets a child content item by name. Returns the ContentItem with the
117      * specified name, and a parent of the content location
118      *
119      * @param name
120      * The name to find
121      * @return ContentItem
122      */

123     public IContentItem getContentItemByName(String JavaDoc name);
124
125     /**
126      * Returns the contentitem with the specified path
127      *
128      * @param path
129      * The path to look for
130      * @return The content item
131      */

132     public IContentItem getContentItemByPath(String JavaDoc path);
133
134     /**
135      * Gets a temporary file in the location.
136      *
137      * @param fileSuffix
138      * What the file suffix should be. If null, then .tmp will be
139      * used.
140      * @return File that is unique within the directory inside this location.
141      * @throws ContentException
142      */

143     public File JavaDoc getTmpFile(String JavaDoc fileSuffix) throws ContentException;
144
145     /**
146      * Gets a temporary file in the location.
147      *
148      * @param fileSuffix
149      * What the file suffix should be. If null, then .tmp will be
150      * used.
151      * @param deleteOnExit
152      * If true, will call the files' deleteOnExit method which will
153      * attempt to delete the file on VM termination.
154      * @return File that is unique within the directory inside this location.
155      * @throws ContentException
156      */

157     public File JavaDoc getTmpFile(String JavaDoc fileSuffix, boolean deleteOnExit) throws ContentException;
158
159     /**
160      * Creates a subdirectory in the content location.
161      *
162      * @param subDirName
163      * The directory name to create
164      * @return File created
165      * @throws ContentException
166      */

167     public File JavaDoc makeSubdirectory(String JavaDoc subDirName) throws ContentException;
168
169     /**
170      * @return The directory path
171      */

172     public String JavaDoc getDirPath();
173
174     /**
175      * @return Returns the UUID of the content location
176      */

177     public String JavaDoc getId();
178
179     /**
180      * @return The name of the content location
181      */

182     public String JavaDoc getName();
183
184     /**
185      * @return The Solution Id
186      */

187     public String JavaDoc getSolutionId();
188
189     /**
190      * @return The description of the Content Location
191      */

192     public String JavaDoc getDescription();
193
194 }
195
Popular Tags