KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > filesys > smb > server > repo > ContentContext


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.filesys.smb.server.repo;
18
19 import org.alfresco.filesys.server.filesys.*;
20 import org.alfresco.filesys.smb.server.repo.pseudo.PseudoFile;
21 import org.alfresco.service.cmr.repository.*;
22
23 /**
24  * Content Filesystem Context Class
25  *
26  * <p>Contains per filesystem context.
27  *
28  * @author GKSpencer
29  */

30 public class ContentContext extends DiskDeviceContext
31 {
32     // Store and root path
33

34     private String JavaDoc m_storeName;
35     private String JavaDoc m_rootPath;
36     
37     // Root node
38

39     private NodeRef m_rootNodeRef;
40     
41     // File state table
42

43     private FileStateTable m_stateTable;
44     
45     // Drag and drop pseudo file
46

47     private PseudoFile m_dragAndDropApp;
48     
49     // URL pseudo file web path prefix (server/port/webapp) and link file name
50

51     private String JavaDoc m_urlPathPrefix;
52     private String JavaDoc m_urlFileName;
53     
54     /**
55      * Class constructor
56      *
57      * @param storeName String
58      * @param rootPath String
59      * @param rootNodeRef NodeRef
60      */

61     public ContentContext(String JavaDoc storeName, String JavaDoc rootPath, NodeRef rootNodeRef)
62     {
63         super(rootNodeRef.toString());
64         
65         m_storeName = storeName;
66         m_rootPath = rootPath;
67         
68         m_rootNodeRef = rootNodeRef;
69         
70         // Create the file state table
71

72         m_stateTable = new FileStateTable();
73     }
74     
75     /**
76      * Return the filesystem type, either FileSystem.TypeFAT or FileSystem.TypeNTFS.
77      *
78      * @return String
79      */

80     public String JavaDoc getFilesystemType()
81     {
82         return FileSystem.TypeNTFS;
83     }
84     
85     /**
86      * Return the store name
87      *
88      * @return String
89      */

90     public final String JavaDoc getStoreName()
91     {
92         return m_storeName;
93     }
94     
95     /**
96      * Return the root path
97      *
98      * @return String
99      */

100     public final String JavaDoc getRootPath()
101     {
102         return m_rootPath;
103     }
104     
105     /**
106      * Return the root node
107      *
108      * @return NodeRef
109      */

110     public final NodeRef getRootNode()
111     {
112         return m_rootNodeRef;
113     }
114
115     /**
116      * Determine if the file state table is enabled
117      *
118      * @return boolean
119      */

120     public final boolean hasStateTable()
121     {
122         return m_stateTable != null ? true : false;
123     }
124     
125     /**
126      * Return the file state table
127      *
128      * @return FileStateTable
129      */

130     public final FileStateTable getStateTable()
131     {
132         return m_stateTable;
133     }
134     
135     /**
136      * Enable/disable the file state table
137      *
138      * @param ena boolean
139      */

140     public final void enableStateTable(boolean ena)
141     {
142         if ( ena == false)
143             m_stateTable = null;
144         else if ( m_stateTable == null)
145             m_stateTable = new FileStateTable();
146     }
147     
148     /**
149      * Determine if the drag and drop pseudo file has been configured
150      *
151      * @return boolean
152      */

153     public final boolean hasDragAndDropApp()
154     {
155         return m_dragAndDropApp != null ? true : false;
156     }
157     
158     /**
159      * Return the drag and drop pseudo file
160      *
161      * @return PseudoFile
162      */

163     public final PseudoFile getDragAndDropApp()
164     {
165         return m_dragAndDropApp;
166     }
167
168     /**
169      * Determine if the URL pseudo file is enabled
170      *
171      * @return boolean
172      */

173     public final boolean hasURLFile()
174     {
175         if ( m_urlPathPrefix != null && m_urlFileName != null)
176             return true;
177         return false;
178     }
179     
180     /**
181      * Return the URL pseudo file path prefix
182      *
183      * @return String
184      */

185     public final String JavaDoc getURLPrefix()
186     {
187         return m_urlPathPrefix;
188     }
189     
190     /**
191      * Return the URL pseudo file name
192      *
193      * @return String
194      */

195     public final String JavaDoc getURLFileName()
196     {
197         return m_urlFileName;
198     }
199     
200     /**
201      * Set the drag and drop application details
202      *
203      * @param dragDropApp PseudoFile
204      */

205     public final void setDragAndDropApp(PseudoFile dragDropApp)
206     {
207         m_dragAndDropApp = dragDropApp;
208     }
209     
210     /**
211      * Set the URL path prefix
212      *
213      * @param urlPrefix String
214      */

215     public final void setURLPrefix(String JavaDoc urlPrefix)
216     {
217         m_urlPathPrefix = urlPrefix;
218     }
219     
220     /**
221      * Set the URL pseudo file name
222      *
223      * @param urlFileName String
224      */

225     public final void setURLFileName(String JavaDoc urlFileName)
226     {
227         m_urlFileName = urlFileName;
228     }
229 }
230
Popular Tags