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.om.folder;
018:
019: import java.util.List;
020:
021: import org.apache.jetspeed.om.page.Link;
022: import org.apache.jetspeed.om.page.Page;
023: import org.apache.jetspeed.om.page.PageSecurity;
024: import org.apache.jetspeed.page.PageNotFoundException;
025: import org.apache.jetspeed.page.document.DocumentException;
026: import org.apache.jetspeed.page.document.DocumentNotFoundException;
027: import org.apache.jetspeed.page.document.Node;
028: import org.apache.jetspeed.page.document.NodeException;
029: import org.apache.jetspeed.page.document.NodeSet;
030:
031: /**
032: * Folder
033: *
034: * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
035: * @author <a href="mailto:jford@apache.org">Jeremy Ford</a>
036: * @version $Id: Folder.java 516448 2007-03-09 16:25:47Z ate $
037: */
038: public interface Folder extends Node {
039: String FOLDER_TYPE = "folder";
040:
041: String FALLBACK_DEFAULT_PAGE = "default-page.psml";
042: String PAGE_NOT_FOUND_PAGE = "page_not_found.psml";
043:
044: String RESERVED_SUBSITE_FOLDER_PREFIX = "__";
045: String RESERVED_FOLDER_PREFIX = "_";
046: String RESERVED_USER_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "user";
047: String RESERVED_ROLE_FOLDER_NAME = RESERVED_FOLDER_PREFIX + "role";
048: String RESERVED_GROUP_FOLDER_NAME = RESERVED_FOLDER_PREFIX
049: + "group";
050: String RESERVED_MEDIATYPE_FOLDER_NAME = RESERVED_FOLDER_PREFIX
051: + "mediatype";
052: String RESERVED_LANGUAGE_FOLDER_NAME = RESERVED_FOLDER_PREFIX
053: + "language";
054: String RESERVED_COUNTRY_FOLDER_NAME = RESERVED_FOLDER_PREFIX
055: + "country";
056:
057: String USER_FOLDER = PATH_SEPARATOR + RESERVED_USER_FOLDER_NAME
058: + PATH_SEPARATOR;
059: String ROLE_FOLDER = PATH_SEPARATOR + RESERVED_ROLE_FOLDER_NAME
060: + PATH_SEPARATOR;
061: String GROUP_FOLDER = PATH_SEPARATOR + RESERVED_GROUP_FOLDER_NAME
062: + PATH_SEPARATOR;
063: String MEDIATYPE_FOLDER = PATH_SEPARATOR
064: + RESERVED_MEDIATYPE_FOLDER_NAME + PATH_SEPARATOR;
065: String LANGUAGE_FOLDER = PATH_SEPARATOR
066: + RESERVED_LANGUAGE_FOLDER_NAME + PATH_SEPARATOR;
067: String COUNTRY_FOLDER = PATH_SEPARATOR
068: + RESERVED_COUNTRY_FOLDER_NAME + PATH_SEPARATOR;
069:
070: int RESERVED_FOLDER_NONE = 0;
071: int RESERVED_FOLDER_SUBSITES = 1;
072: int RESERVED_FOLDER_USERS = 2;
073: int RESERVED_FOLDER_ROLES = 3;
074: int RESERVED_FOLDER_GROUPS = 4;
075: int RESERVED_FOLDER_MEDIATYPE = 5;
076: int RESERVED_FOLDER_LANGUAGE = 6;
077: int RESERVED_FOLDER_COUNTRY = 7;
078: int RESERVED_FOLDER_OTHER = 9999;
079:
080: /**
081: * Returns the name of the skin that applies to this
082: * folder.
083: *
084: * @return the page default skin name
085: */
086: String getSkin();
087:
088: /**
089: * Modifies the skin for this folder.
090: *
091: * @param skinName the name of the new skin for the folder
092: */
093: void setSkin(String skinName);
094:
095: /**
096: * Returns the name of the default decorator as set here or
097: * in parent folders that applies to page fragments
098: * in this folder or subfolders.
099: *
100: * @param fragmentType the type of fragment considered
101: * @return the decorator name for the selected type
102: */
103: String getEffectiveDefaultDecorator(String fragmentType);
104:
105: /**
106: * Returns the name of the default decorator that applies to page
107: * fragments in this folder or subfolders.
108: *
109: * @param fragmentType the type of fragment considered
110: * @return the decorator name for the selected type
111: */
112: String getDefaultDecorator(String fragmentType);
113:
114: /**
115: * Modifies the default decorator for the specified fragment type.
116: *
117: * @param decoratorName the name of the new decorator for the type
118: * @param fragmentType the type of fragment considered
119: */
120: void setDefaultDecorator(String decoratorName, String fragmentType);
121:
122: /**
123: * getDocumentOrder
124: *
125: * @return list of ordered document names in folder
126: */
127: List getDocumentOrder();
128:
129: /**
130: * setDocumentOrder
131: *
132: * @param docIndexes list of ordered document names in folder
133: */
134: void setDocumentOrder(List docIndexes);
135:
136: /**
137: *
138: * <p>
139: * getDefaultPage
140: * </p>
141: *
142: * @return A String representing the default psml page for this folder
143: */
144: String getDefaultPage();
145:
146: /**
147: *
148: * <p>
149: * setDefaultPage
150: * </p>
151: *
152: * @param defaultPage
153: */
154: void setDefaultPage(String defaultPage);
155:
156: /**
157: *
158: * <p>
159: * getFolders
160: * </p>
161: *
162: * @return A <code>NodeSet</code> containing all sub-folders directly under
163: * this folder.
164: * @throws DocumentException
165: */
166: NodeSet getFolders() throws DocumentException;
167:
168: /**
169: *
170: * <p>
171: * getFolder
172: * </p>
173: *
174: * @param name
175: * @return A Folder referenced by this folder.
176: * @throws FolderNotFoundException
177: * @throws DocumentException
178: */
179: Folder getFolder(String name) throws FolderNotFoundException,
180: DocumentException;
181:
182: /**
183: *
184: * <p>
185: * getPages
186: * </p>
187: *
188: * @return NodeSet of all the Pages referenced by this Folder.
189: * @throws NodeException
190: * @throws PageNotFoundException if any of the Pages referenced by this Folder
191: * could not be found.
192: */
193: NodeSet getPages() throws NodeException;
194:
195: /**
196: *
197: * <p>
198: * getPage
199: * </p>
200: *
201: * @param name
202: * @return A Page referenced by this folder.
203: * @throws PageNotFoundException if the Page requested could not be found.
204: * @throws DocumentException
205: * @throws NodeException
206: */
207: Page getPage(String name) throws PageNotFoundException,
208: NodeException;
209:
210: /**
211: *
212: * <p>
213: * getLinks
214: * </p>
215: *
216: * @return NodeSet of all the Links referenced by this Folder.
217: * @throws DocumentException
218: * @throws NodeException
219: */
220: NodeSet getLinks() throws NodeException;
221:
222: /**
223: *
224: * <p>
225: * getLink
226: * </p>
227: *
228: * @param name
229: * @return A Link referenced by this folder.
230: * @throws DocumentNotFoundException if the document requested could not be found.
231: * @throws NodeException
232: */
233: Link getLink(String name) throws DocumentNotFoundException,
234: NodeException;
235:
236: /**
237: *
238: * <p>
239: * getPageSecurity
240: * </p>
241: *
242: * @param name
243: * @return A PageSecurity referenced by this folder.
244: * @throws DocumentNotFoundException if the document requested could not be found.
245: * @throws NodeException
246: */
247: PageSecurity getPageSecurity() throws DocumentNotFoundException,
248: NodeException;
249:
250: /**
251: *
252: * <p>
253: * getAll
254: * </p>
255: *
256: * @return A <code>NodeSet</code> containing all sub-folders and documents directly under
257: * this folder.
258: * @throws DocumentException
259: */
260: NodeSet getAll() throws DocumentException;
261:
262: /**
263: * getMenuDefinitions - get list of menu definitions
264: *
265: * @return definition list
266: */
267: List getMenuDefinitions();
268:
269: /**
270: * newMenuDefinition - creates a new empty menu definition
271: *
272: * @return a newly created MenuDefinition object for use in Folder
273: */
274: MenuDefinition newMenuDefinition();
275:
276: /**
277: * newMenuExcludeDefinition - creates a new empty menu exclude definition
278: *
279: * @return a newly created MenuExcludeDefinition object for use in Folder
280: */
281: MenuExcludeDefinition newMenuExcludeDefinition();
282:
283: /**
284: * newMenuIncludeDefinition - creates a new empty menu include definition
285: *
286: * @return a newly created MenuIncludeDefinition object for use in Folder
287: */
288: MenuIncludeDefinition newMenuIncludeDefinition();
289:
290: /**
291: * newMenuOptionsDefinition - creates a new empty menu options definition
292: *
293: * @return a newly created MenuOptionsDefinition object for use in Folder
294: */
295: MenuOptionsDefinition newMenuOptionsDefinition();
296:
297: /**
298: * newMenuSeparatorDefinition - creates a new empty menu separator definition
299: *
300: * @return a newly created MenuSeparatorDefinition object for use in Folder
301: */
302: MenuSeparatorDefinition newMenuSeparatorDefinition();
303:
304: /**
305: * setMenuDefinitions - set list of menu definitions
306: *
307: * @param definitions definition list
308: */
309: void setMenuDefinitions(List definitions);
310:
311: /**
312: * Determines if a folder is a reserved folder.
313: * Reserved folders are special folders that can
314: * hold subsites, the root of user folders, and the
315: * root of role folders.
316: * @return
317: */
318: boolean isReserved();
319:
320: /**
321: * Returns a valid reserved folder type:
322: * RESERVED_FOLDER_SUBSITES
323: * RESERVED_FOLDER_USERS
324: * RESERVED_FOLDER_ROLES
325: * RESERVED_FOLDER_GROUPS
326: * RESERVED_FOLDER_MEDIATYPE
327: * RESERVED_FOLDER_LANGUAGE
328: * RESERVED_FOLDER_COUNTRY
329: *
330: * @return one of the valid reserved folder types
331: */
332: int getReservedType();
333: }
|