KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > methodhead > res > DefaultResPolicy


1 /*
2  * Copyright (C) 2006 Methodhead Software LLC. All rights reserved.
3  *
4  * This file is part of TransferCM.
5  *
6  * TransferCM is free software; you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation; either version 2 of the License, or (at your option) any later
9  * version.
10  *
11  * TransferCM is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * TransferCM; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
18  * Fifth Floor, Boston, MA 02110-1301 USA
19  */

20
21 package com.methodhead.res;
22
23 import com.methodhead.auth.AuthUser;
24 import javax.servlet.http.HttpServletRequest JavaDoc;
25 import java.io.File JavaDoc;
26 import org.apache.struts.util.MessageResources;
27 import org.apache.struts.Globals;
28 import com.methodhead.util.OperationContext;
29
30 public class DefaultResPolicy
31 implements
32   ResPolicy {
33
34   // constructors /////////////////////////////////////////////////////////////
35

36   // constants ////////////////////////////////////////////////////////////////
37

38   // classes //////////////////////////////////////////////////////////////////
39

40   // methods //////////////////////////////////////////////////////////////////
41

42   public boolean isMappingAuthorized(
43     AuthUser user,
44     String JavaDoc path ) {
45     return true;
46   }
47
48   public FileManager newFileManager() {
49     return new FileManager();
50   }
51
52   /**
53    * Initializes the file manager, adding the app context root.
54    */

55   public void initFileManager(
56     HttpServletRequest JavaDoc request,
57     FileManager fileManager ) {
58
59     //
60
// get the webapp root directory
61
//
62
String JavaDoc path =
63       request.getSession().getServletContext().getRealPath( "" );
64
65     if ( path == null )
66       throw new ResException( "Couldn't get real path for webapp root." );
67
68     File JavaDoc f = new File JavaDoc( path );
69
70     //
71
// add the root directory using the name from message resources
72
//
73
MessageResources messages =
74       ( MessageResources )request.getAttribute( Globals.MESSAGES_KEY );
75
76     fileManager.addDirectory( messages.getMessage( "res.rootName" ), f );
77   }
78
79   public FileTree newFileTree() {
80     return new FileTree();
81   }
82
83   public String JavaDoc isFileMoveAuthorized(
84     OperationContext op ) {
85     return null;
86   }
87
88   public String JavaDoc isFileCopyAuthorized(
89     OperationContext op ) {
90     return null;
91   }
92
93   public String JavaDoc isFileDeleteAuthorized(
94     OperationContext op ) {
95     return null;
96   }
97
98   public String JavaDoc isFileEditAuthorized(
99     OperationContext op ) {
100     return null;
101   }
102
103   public String JavaDoc isFileUnzipAuthorized(
104     OperationContext op ) {
105     return null;
106   }
107
108   public String JavaDoc isFileListAuthorized(
109     OperationContext op ) {
110     return null;
111   }
112
113   public String JavaDoc isFileManageAuthorized(
114     OperationContext op ) {
115     return null;
116   }
117
118   public String JavaDoc isFileUploadFormAuthorized(
119     OperationContext op ) {
120     return null;
121   }
122
123   public String JavaDoc isFileUploadAuthorized(
124     OperationContext op ) {
125     return null;
126   }
127
128   public String JavaDoc isFileCreateFormAuthorized(
129     OperationContext op ) {
130     return null;
131   }
132
133   public String JavaDoc isFileCreateAuthorized(
134     OperationContext op ) {
135     return null;
136   }
137
138   // properties ///////////////////////////////////////////////////////////////
139

140   // attributes ///////////////////////////////////////////////////////////////
141
}
142
Popular Tags