001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.jetspeed.page.document;
018:
019: import org.apache.jetspeed.om.folder.Folder;
020: import org.apache.jetspeed.om.folder.FolderNotFoundException;
021: import org.apache.jetspeed.om.folder.InvalidFolderException;
022:
023: /**
024: * <p>
025: * FolderHandler
026: * </p>
027: * <p>
028: *
029: * </p>
030: * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
031: * @version $Id: FolderHandler.java 553584 2007-07-05 18:09:45Z taylor $
032: *
033: */
034: public interface FolderHandler {
035: /**
036: *
037: * <p>
038: * getFolder
039: * </p>
040: * <p>
041: * Locates a folder given using the <code>path</code> argument. This should behave
042: * as <code>getFolder("folder/subfolder, true);</code>
043: * </p>
044: *
045: * @param path fully-quallified path to a folder
046: * @return Folder represented by the <code>path</code> argument. Never returns <code>null</code>
047: * @throws DocumentException if there was an error processing the request.
048: * @throws InvalidFolderException
049: * @throws NodeException
050: * @throws DocumentNotFoundException If there is no folder at the <code>path</code> specified.
051: */
052: Folder getFolder(String path) throws FolderNotFoundException,
053: InvalidFolderException, NodeException;
054:
055: /**
056: *
057: * <p>
058: * updateFolder
059: * </p>
060: * <p>
061: * Updates the folder specified with the <code>folder</code> argument.
062: * </p>
063: *
064: * @param folder folder to update
065: */
066: void updateFolder(Folder folder)
067: throws FailedToUpdateFolderException;
068:
069: /**
070: *
071: * <p>
072: * removeFolder
073: * </p>
074: * <p>
075: * Removes the folder specified with the <code>folder</code> argument.
076: * </p>
077: *
078: * @param folder folder to update
079: */
080: void removeFolder(Folder folder)
081: throws FailedToDeleteFolderException;
082:
083: /**
084: *
085: * <p>
086: * getFolder
087: * </p>
088: * <p>
089: * Locates a folder given using the <code>path</code> argument.
090: * </p>
091: *
092: * @param path fully-quallified path to a folder
093: * @param fromCache whether or not to check the cache first before checking the underlying folder
094: * repository.
095: * @return Folder represented by the <code>path</code> argument. Never returns <code>null</code>
096: * @throws DocumentException if there was an error processing the request.
097: * @throws InvalidFolderException
098: * @throws NodeException
099: * @throws DocumentNotFoundException If there is no folder at the <code>path</code> specified.
100: */
101: Folder getFolder(String path, boolean fromCache)
102: throws FolderNotFoundException, InvalidFolderException,
103: NodeException;
104:
105: /**
106: *
107: * <p>
108: * getFolders
109: * </p>
110: *
111: * @param path Path from which to locate child folders
112: * @return NodeSet of sub-folders located under the <code>path</code> argument.
113: * @throws FolderNotFoundException if folder under the <code>path</code> does not actually
114: * exist
115: * @throws DocumentException if an error is encountered reading the folders.
116: * @throws InvalidFolderException
117: * @throws NodeException
118: */
119: NodeSet getFolders(String path) throws FolderNotFoundException,
120: InvalidFolderException, NodeException;
121:
122: /**
123: *
124: * <p>
125: * list
126: * </p>
127: * <p>
128: * generates a list of document names, relative to the <code>folderPath</code> argument
129: * of the type indicated by the <code>documentType</code> argument.
130: * </p>
131: * @param folderPath folder path to search under
132: * @param documentType document type to filter on.
133: * @return a <code>String[]</code> of child document names relative to the <code>folderPath</code>
134: * argument and matching the <code>documentType</code> argument.
135: * @throws FolderNotFoundException if the <code>folderPath</code> does not exsit.
136: */
137: String[] list(String folderPath, String documentType)
138: throws FolderNotFoundException;
139:
140: String[] listAll(String folderPath) throws FolderNotFoundException;
141:
142: /**
143: * <p>
144: * getNodes
145: * </p>
146: * <p>
147: * Returns a set of nodes relative to the <code>folder</code> argument of the type
148: * indicated by the <code>documentType</code> argument. The <code>folder</code> argument
149: * may include regular expressions if indicated by the <code>regex</code> argument. The
150: * returned set is unordered.
151: * </p>
152: *
153: * @param path Path from which to locate documents
154: * @param regexp Flag indicating whether regexp should be expanded in path
155: * @param documentType document type to filter on.
156: * @return NodeSet of documents and folders located under the <code>path</code> argument.
157: * @throws FolderNotFoundException if folder under the <code>path</code> does not actually exist.
158: * @throws DocumentException if an error is encountered reading the folders.
159: * @throws InvalidFolderException
160: * @throws NodeException
161: */
162: NodeSet getNodes(String path, boolean regexp, String documentType)
163: throws FolderNotFoundException, InvalidFolderException,
164: NodeException;
165:
166: /**
167: * Returns true if the path is a folder
168: *
169: * @param path
170: * @return
171: */
172: boolean isFolder(String path);
173:
174: }
|