KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sslexplorer > networkplaces > DefaultArchiveMount


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;
21
22 import java.io.IOException JavaDoc;
23
24 import org.apache.commons.vfs.FileObject;
25
26 import com.sslexplorer.policyframework.LaunchSession;
27 import com.sslexplorer.security.PasswordCredentials;
28 import com.sslexplorer.vfs.VFSStore;
29 import com.sslexplorer.vfs.utils.URI;
30 import com.sslexplorer.vfs.webdav.DAVUtilities;
31
32 /**
33  * Implementation of a {@link AbstractNetworkPlaceMount} that provides mounts
34  * to archive files (Zip, Jar, tar etc)
35  *
36  * @author Brett Smith <a HREF="mailto: brett@3sp.com">&lt;brett@3sp.com&gt;</a>
37  */

38 public class DefaultArchiveMount extends AbstractNetworkPlaceMount {
39
40     /**
41      * Constructor.
42      *
43      * @param launchSession launch session
44      * @param store store
45      */

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

54     public FileObject createVFSFileObject(String JavaDoc path, PasswordCredentials credentials) throws IOException JavaDoc {
55         URI uri = getRootVFSURI();
56         String JavaDoc uriPath = uri.getPath();
57         if(!uriPath.contains("!")) {
58             uriPath = DAVUtilities.stripTrailingSlash(uriPath) + "!/./";
59         }
60         uriPath = uriPath.replace('\\', '/');
61         if(uriPath.matches("^[a-zA-Z]?\\:/")) {
62             
63         }
64         String JavaDoc newPath = DAVUtilities.concatenatePaths(uriPath, path);
65         uri.setPath(newPath);
66         FileObject root = getStore().getRepository().getFileSystemManager().resolveFile(uri.toString());
67         return root;
68     }
69 }
Popular Tags