KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > networkplaces > store > file > FileMount


1 /*
2  * SSL-Explorer
3  *
4  * Copyright (C) 2003-2006 3SP LTD. All Rights Reserved
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */

19             
20 package com.sslexplorer.networkplaces.store.file;
21
22 import java.io.File JavaDoc;
23 import java.io.IOException JavaDoc;
24
25 import org.apache.commons.vfs.FileObject;
26
27 import com.sslexplorer.networkplaces.AbstractNetworkPlaceMount;
28 import com.sslexplorer.policyframework.LaunchSession;
29 import com.sslexplorer.security.PasswordCredentials;
30 import com.sslexplorer.vfs.VFSStore;
31 import com.sslexplorer.vfs.utils.URI;
32 import com.sslexplorer.vfs.webdav.DAVUtilities;
33
34 /**
35  * Implementation of a {@link AbstractNetworkPlaceMount} that provides mounts
36  * to the local file system.
37  *
38  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
39  */

40 public class FileMount extends AbstractNetworkPlaceMount {
41
42     /**
43      * Constructor.
44      *
45      * @param launchSession launch session
46      * @param store store
47      */

48     public FileMount(LaunchSession launchSession, VFSStore store) {
49         super(launchSession, store);
50     }
51
52     /* (non-Javadoc)
53      * @see com.sslexplorer.networkplaces.AbstractNetworkPlaceMount#createVFSFileObject(java.lang.String, com.sslexplorer.security.PasswordCredentials)
54      */

55     public FileObject createVFSFileObject(String JavaDoc path, PasswordCredentials credentials) throws IOException JavaDoc {
56         URI uri = getRootVFSURI();
57         uri.setPath(DAVUtilities.concatenatePaths(uri.getPath(), path));
58         if(uri.getPath().startsWith("./")) {
59             FileObject root = getStore().getRepository().getFileSystemManager().resolveFile(new File JavaDoc(System.getProperty("user.dir")), uri.getPath().substring(2));
60             return root;
61         }
62         else {
63             FileObject root = getStore().getRepository().getFileSystemManager().resolveFile(uri.toString());
64             return root;
65         }
66     }
67 }
Popular Tags