Source code: com/RuntimeCollective/webapps/bean/WebFolder.java
1 /* $Header: /home/CVS/rjp/src/com/RuntimeCollective/webapps/bean/WebFolder.java,v 1.18 2003/09/30 15:13:10 joe Exp $
2 * $Revision: 1.18 $
3 * $Date: 2003/09/30 15:13:10 $
4 *
5 * ====================================================================
6 *
7 * Josephine : http://www.runtime-collective.com/josephine/index.html
8 *
9 * Copyright (C) 2003 Runtime Collective
10 *
11 * This product includes software developed by the
12 * Apache Software Foundation (http://www.apache.org/).
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
29
30 package com.RuntimeCollective.webapps.bean;
31
32 import com.RuntimeCollective.webapps.RuntimeParameters;
33 import com.RuntimeCollective.webapps.bean.User;
34
35 /**
36 * Object that represents the webfolder of a user -- a directory that sits on the server and can be accessed using WebDav.<p>
37 *
38 * <B>This requires the following <code>RuntimeParameters</code> to be set:</B>
39 *
40 * <ul>
41 *
42 * <li><code>webfolderPath</code> -- the fully-resolved path of the
43 * root directory for the webfolders (excluding trailing "/"). The
44 * webfolder for the user with id=0 would then be webfolderPath/0
45 * etc. </li>
46 *
47 * <li><code>webfolderURL</code> -- the fully-resolved URL of the root
48 * directory for the webfolders (including trailing "/", and leading
49 * "http://"). The webfolder for the user with id=0 would then be
50 * webfolderUrl/0 etc. </li>
51 *
52 * </ul>
53 */
54 public class WebFolder extends BeanFileFolder {
55
56 /**
57 * The URL of the webfolders
58 */
59 private String ivUrl;
60
61 /**
62 * The URL of the webfolders (Not including trailing "/")
63 */
64 public String getUrl() {
65 return ivUrl;
66 }
67
68 /** Set the url for the webfolder. */
69 public void setUrl( String url ) {
70 ivUrl = url;
71 }
72
73 /**
74 * Get the webfolder for this user. If no such directory exists on
75 * the file system, then one will be created.
76 *
77 * @exception RuntimeException thrown if RuntimeParameters.webfolderPath not set
78 */
79 public WebFolder(User user) {
80
81 super( user, RuntimeParameters.get("webfolderPath") );
82
83 // Get the file path and url of the base directory
84 setUrl( RuntimeParameters.get("webfolderURL") );
85 String dirBase = RuntimeParameters.get("webfolderPath");
86
87 // Check that the parameters has been set in the web.xml file. We
88 // can't do anything without it.
89 if(dirBase == null) {
90 RuntimeParameters.logFatal(this, "The webfolder directory base is null");
91 throw new RuntimeException("Runtime Parameter \"webfolderPath\" not defined.");
92 }
93 if(getUrl() == null) {
94 RuntimeParameters.logFatal(this, "The webfolder url base is null");
95 throw new RuntimeException("Runtime Parameter \"webfolderURL\" not defined.");
96 }
97
98 }
99
100 }
101
102
103