adammurdoch 2002/10/31 02:40:58
Modified: vfs/src/java/org/apache/commons/vfs/provider
AbstractLayeredFileProvider.java
AbstractOriginatingFileProvider.java UriParser.java
vfs/src/java/org/apache/commons/vfs/provider/ftp
FtpFileNameParser.java FtpFileSystemProvider.java
vfs/src/java/org/apache/commons/vfs/provider/local
DefaultLocalFileSystemProvider.java
LocalFileNameParser.java
vfs/src/java/org/apache/commons/vfs/provider/smb
SmbFileNameParser.java SmbFileSystemProvider.java
vfs/src/java/org/apache/commons/vfs/provider/temp
TemporaryFileProvider.java
vfs/src/java/org/apache/commons/vfs/provider/url
UrlFileProvider.java
vfs/src/java/org/apache/commons/vfs/provider/zip
ZipFileNameParser.java ZipFileSystemProvider.java
Added: vfs/src/java/org/apache/commons/vfs/provider GenericUri.java
Uri.java
vfs/src/java/org/apache/commons/vfs/provider/ftp FtpUri.java
vfs/src/java/org/apache/commons/vfs/provider/local
LocalFileUri.java
vfs/src/java/org/apache/commons/vfs/provider/smb SmbUri.java
Removed: vfs/src/java/org/apache/commons/vfs/provider
ParsedLayeredUri.java ParsedUri.java
vfs/src/java/org/apache/commons/vfs/provider/ftp
ParsedFtpUri.java
vfs/src/java/org/apache/commons/vfs/provider/local
ParsedFileUri.java
vfs/src/java/org/apache/commons/vfs/provider/smb
ParsedSmbUri.java
Log:
Tidy up the URI class heirarchy:
- Squished ParsedUri and ParsedLayeredUri into Uri.
- Added GenericUri to represent RCF 2396 'generic' URI.
- Renamed ParsedFtpUri to FtpUri, ParsedSmbUri to SmbUri, ParsedFileUri to
LocalFileUri.
- UriParser now normalises hostnames to lowercase.
Revision Changes Path
1.4 +4 -4
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractLayeredFileProvider.java
Index: AbstractLayeredFileProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractLayeredFileProvider.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractLayeredFileProvider.java 28 Oct 2002 02:05:06 -0000 1.3
+++ AbstractLayeredFileProvider.java 31 Oct 2002 10:40:57 -0000 1.4
@@ -78,12 +78,12 @@
final String uri ) throws FileSystemException
{
// Split the URI up into its parts
- final ParsedLayeredUri parsedUri = parseUri( uri );
+ final Uri parsedUri = parseUri( uri );
// Make the URI canonical
// Resolve the outer file name
- final String fileName = parsedUri.getOuterFileUri();
+ final String fileName = parsedUri.getContainerUri();
final FileObject file = getContext().resolveFile( baseFile, fileName );
// Create the file system
@@ -128,6 +128,6 @@
* Parses an absolute URI.
* @param uri The URI to parse.
*/
- protected abstract ParsedLayeredUri parseUri( String uri )
+ protected abstract Uri parseUri( String uri )
throws FileSystemException;
}
1.7 +7 -8
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java
Index: AbstractOriginatingFileProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/AbstractOriginatingFileProvider.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AbstractOriginatingFileProvider.java 28 Oct 2002 02:05:06 -0000 1.6
+++ AbstractOriginatingFileProvider.java 31 Oct 2002 10:40:57 -0000 1.7
@@ -80,10 +80,10 @@
final String uri ) throws FileSystemException
{
// Parse the URI
- ParsedUri parsedUri;
+ final Uri parsedUri;
try
{
- parsedUri = parseUri( baseFile, uri );
+ parsedUri = parseUri( uri );
}
catch ( FileSystemException exc )
{
@@ -97,11 +97,11 @@
/**
* Locates a file from its parsed URI.
*/
- private FileObject findFile( final ParsedUri parsedUri )
+ private FileObject findFile( final Uri parsedUri )
throws FileSystemException
{
// Check in the cache for the file system
- final String rootUri = parsedUri.getRootUri();
+ final String rootUri = parsedUri.getContainerUri();
FileSystem fs = findFileSystem( rootUri );
if ( fs == null )
{
@@ -121,14 +121,13 @@
* <p>The provider can annotate this object with any additional
* information it requires to create a file system from the URI.
*/
- protected abstract ParsedUri parseUri( final FileObject baseFile,
- final String uri )
+ protected abstract Uri parseUri( final String uri )
throws FileSystemException;
/**
* Creates the filesystem. The file system may implement {@link VfsComponent}.
*/
- protected abstract FileSystem doCreateFileSystem( final ParsedUri uri )
+ protected abstract FileSystem doCreateFileSystem( final Uri uri )
throws FileSystemException;
}
1.8 +15 -14
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/UriParser.java
Index: UriParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/UriParser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- UriParser.java 27 Oct 2002 08:06:37 -0000 1.7
+++ UriParser.java 31 Oct 2002 10:40:57 -0000 1.8
@@ -129,16 +129,16 @@
* implementation assumes a "generic URI", as defined by RFC 2396. See
* {@link #parseGenericUri} for more info.
*/
- public ParsedUri parseUri( final String uriStr ) throws FileSystemException
+ public GenericUri parseUri( final String uriStr ) throws FileSystemException
{
// Parse the URI
- final ParsedUri uri = new ParsedUri();
+ final GenericUri uri = new GenericUri();
parseGenericUri( uriStr, uri );
// Build the root URI
final StringBuffer rootUri = new StringBuffer();
appendRootUri( uri, rootUri );
- uri.setRootUri( rootUri.toString() );
+ uri.setContainerUri( rootUri.toString() );
return uri;
}
@@ -146,7 +146,7 @@
/**
* Assembles a generic URI, appending to the supplied StringBuffer.
*/
- protected void appendRootUri( final ParsedUri uri, final StringBuffer rootUri )
+ protected void appendRootUri( final GenericUri uri, final StringBuffer rootUri )
{
rootUri.append( uri.getScheme() );
rootUri.append( "://" );
@@ -182,7 +182,7 @@
* Used to return the parsed components of the URI.
*/
protected void parseGenericUri( final String uriStr,
- final ParsedUri uri )
+ final GenericUri uri )
throws FileSystemException
{
final StringBuffer name = new StringBuffer();
@@ -200,7 +200,7 @@
rootUri.append( uri.getScheme() );
rootUri.append( "://" );
rootUri.append( uri.getHostName() );
- uri.setRootUri( rootUri.toString() );
+ uri.setContainerUri( rootUri.toString() );
}
/**
@@ -213,17 +213,17 @@
* @param name
* Used to return the remainder of the URI.
*
- * @param parsedUri
+ * @param genericUri
* Used to return the extracted components.
*/
protected void extractToPath( final String uri,
final StringBuffer name,
- final ParsedUri parsedUri )
+ final GenericUri genericUri )
throws FileSystemException
{
// Extract the scheme
final String scheme = extractScheme( uri, name );
- parsedUri.setScheme( scheme );
+ genericUri.setScheme( scheme );
// Expecting "//"
if ( name.length() < 2 || name.charAt( 0 ) != '/' || name.charAt( 1 ) !=
'/' )
@@ -234,15 +234,15 @@
// Extract userinfo
final String userInfo = extractUserInfo( name );
- parsedUri.setUserInfo( userInfo );
+ genericUri.setUserInfo( userInfo );
- // Extract hostname
+ // Extract hostname, and normalise
final String hostName = extractHostName( name );
if ( hostName == null )
{
throw new FileSystemException( "vfs.provider/missing-hostname.error",
uri );
}
- parsedUri.setHostName( hostName );
+ genericUri.setHostName( hostName.toLowerCase() );
// Extract port
final String port = extractPort( name );
@@ -250,7 +250,7 @@
{
throw new FileSystemException( "vfs.provider/missing-port.error", uri );
}
- parsedUri.setPort( port );
+ genericUri.setPort( port );
// Expecting '/' or empty name
if ( name.length() > 0 && name.charAt( 0 ) != '/' )
@@ -765,7 +765,8 @@
}
/**
- * Extracts the scheme from a URI.
+ * Extracts the scheme from a URI. Removes the scheme and ':' delimiter
+ * from the front of the URI.
*
* @param uri
* The URI.
1.1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/GenericUri.java
Index: GenericUri.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.vfs.provider;
/**
* A 'generic' URI, as per RFC 2396. Consists of a scheme, userinfo (typically
* username and password), hostname, port, and path.
*
* @author <a href="mailto:adammurdoch@;apache.org">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/10/31 10:40:57 $
*/
public class GenericUri
extends Uri
{
private String userInfo;
private String hostName;
private String port;
/** Returns the user info part of the URI. */
public String getUserInfo()
{
return userInfo;
}
/** Sets the user info part of the URI. */
public void setUserInfo( final String userInfo )
{
this.userInfo = userInfo;
}
/** Returns the host name part of the URI. */
public String getHostName()
{
return hostName;
}
/** Sets the host name part of the URI. */
public void setHostName( final String hostName )
{
this.hostName = hostName;
}
/** Returns the port part of the URI. */
public String getPort()
{
return port;
}
/** Sets the port part of the URI. */
public void setPort( final String port )
{
this.port = port;
}
}
1.1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/Uri.java
Index: Uri.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.vfs.provider;
/**
* Represents the parts of a parsed URI.
*
* @author <a href="mailto:adammurdoch@;apache.org">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/10/31 10:40:57 $
*/
public class Uri
{
private String scheme;
private String path;
private String containerUri;
/** Returns the scheme. */
public String getScheme()
{
return scheme;
}
/** Sets the scheme. */
public void setScheme( final String scheme )
{
this.scheme = scheme;
}
/** Returns the path part of the URI. */
public String getPath()
{
return path;
}
/** Sets the path part of the URI. */
public void setPath( final String path )
{
this.path = path;
}
/** Returns the root URI, used to identify the file system. */
public String getContainerUri()
{
return containerUri;
}
/** Sets the root URI. */
public void setContainerUri( final String rootPrefix )
{
containerUri = rootPrefix;
}
}
1.5 +4 -7
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java
Index: FtpFileNameParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FtpFileNameParser.java 23 Oct 2002 11:59:41 -0000 1.4
+++ FtpFileNameParser.java 31 Oct 2002 10:40:57 -0000 1.5
@@ -70,18 +70,14 @@
/**
* Parses an absolute URI, splitting it into its components.
*/
- public ParsedFtpUri parseFtpUri( final String uriStr )
+ public FtpUri parseFtpUri( final String uriStr )
throws FileSystemException
{
- final ParsedFtpUri uri = new ParsedFtpUri();
+ final FtpUri uri = new FtpUri();
// FTP URI are generic URI (as per RFC 2396)
parseGenericUri( uriStr, uri );
- // Adjust the hostname to lower-case
- final String hostname = uri.getHostName().toLowerCase();
- uri.setHostName( hostname );
-
// Drop the port if it is 21
final String port = uri.getPort();
if ( port != null && port.equals( "21" ) )
@@ -90,6 +86,7 @@
}
// Split up the userinfo into a username and password
+ // TODO - push this into parser and GenericUri
final String userInfo = uri.getUserInfo();
if ( userInfo != null )
{
@@ -110,7 +107,7 @@
// Now build the root URI
final StringBuffer rootUri = new StringBuffer();
appendRootUri( uri, rootUri );
- uri.setRootUri( rootUri.toString() );
+ uri.setContainerUri( rootUri.toString() );
return uri;
}
1.7 +5 -7
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemProvider.java
Index: FtpFileSystemProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystemProvider.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- FtpFileSystemProvider.java 23 Oct 2002 11:59:41 -0000 1.6
+++ FtpFileSystemProvider.java 31 Oct 2002 10:40:57 -0000 1.7
@@ -56,12 +56,11 @@
package org.apache.commons.vfs.provider.ftp;
import org.apache.commons.vfs.FileName;
-import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystem;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
import org.apache.commons.vfs.provider.DefaultFileName;
-import org.apache.commons.vfs.provider.ParsedUri;
+import org.apache.commons.vfs.provider.Uri;
/**
* A provider for FTP file systems.
@@ -77,8 +76,7 @@
/**
* Parses a URI into its components.
*/
- protected ParsedUri parseUri( final FileObject baseFile,
- final String uri )
+ protected Uri parseUri( final String uri )
throws FileSystemException
{
return parser.parseFtpUri( uri );
@@ -87,13 +85,13 @@
/**
* Creates the filesystem.
*/
- protected FileSystem doCreateFileSystem( final ParsedUri uri )
+ protected FileSystem doCreateFileSystem( final Uri uri )
throws FileSystemException
{
- final ParsedFtpUri ftpUri = (ParsedFtpUri)uri;
+ final FtpUri ftpUri = (FtpUri)uri;
// Build the root name
- final FileName rootName = new DefaultFileName( parser, ftpUri.getRootUri(),
"/" );
+ final FileName rootName = new DefaultFileName( parser,
ftpUri.getContainerUri(), "/" );
// Determine the username and password to use
String username = ftpUri.getUserName();
1.1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/ftp/FtpUri.java
Index: FtpUri.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.vfs.provider.ftp;
import org.apache.commons.vfs.provider.GenericUri;
/**
* An FTP URI. Splits userinfo (see {@link #getUserInfo}) into username and
* password.
*
* @author <a href="mailto:adammurdoch@;apache.org">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/10/31 10:40:57 $
*/
final class FtpUri
extends GenericUri
{
private String userName;
private String password;
public String getUserName()
{
return userName;
}
public void setUserName( final String userName )
{
this.userName = userName;
}
public String getPassword()
{
return password;
}
public void setPassword( final String password )
{
this.password = password;
}
}
1.9 +5 -6
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/local/DefaultLocalFileSystemProvider.java
Index: DefaultLocalFileSystemProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/local/DefaultLocalFileSystemProvider.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultLocalFileSystemProvider.java 23 Oct 2002 11:59:41 -0000 1.8
+++ DefaultLocalFileSystemProvider.java 31 Oct 2002 10:40:57 -0000 1.9
@@ -62,7 +62,7 @@
import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
import org.apache.commons.vfs.provider.DefaultFileName;
import org.apache.commons.vfs.provider.LocalFileProvider;
-import org.apache.commons.vfs.provider.ParsedUri;
+import org.apache.commons.vfs.provider.Uri;
import org.apache.commons.vfs.util.Os;
/**
@@ -126,8 +126,7 @@
* <p>The provider can annotate this object with any additional
* information it requires to create a file system from the URI.
*/
- protected ParsedUri parseUri( final FileObject baseFile,
- final String uri )
+ protected Uri parseUri( final String uri )
throws FileSystemException
{
return parser.parseFileUri( uri );
@@ -136,15 +135,15 @@
/**
* Creates the filesystem.
*/
- protected FileSystem doCreateFileSystem( final ParsedUri uri )
+ protected FileSystem doCreateFileSystem( final Uri uri )
throws FileSystemException
{
// Build the name of the root file.
- final ParsedFileUri fileUri = (ParsedFileUri)uri;
+ final LocalFileUri fileUri = (LocalFileUri)uri;
final String rootFile = fileUri.getRootFile();
// Create the file system
- final DefaultFileName rootName = new DefaultFileName( parser,
fileUri.getRootUri(), "/" );
+ final DefaultFileName rootName = new DefaultFileName( parser,
fileUri.getContainerUri(), "/" );
return new LocalFileSystem( rootName, rootFile );
}
}
1.4 +4 -4
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/local/LocalFileNameParser.java
Index: LocalFileNameParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/local/LocalFileNameParser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- LocalFileNameParser.java 23 Oct 2002 11:59:41 -0000 1.3
+++ LocalFileNameParser.java 31 Oct 2002 10:40:57 -0000 1.4
@@ -57,8 +57,8 @@
import java.io.File;
import org.apache.commons.vfs.FileSystemException;
-import org.apache.commons.vfs.provider.ParsedUri;
import org.apache.commons.vfs.provider.UriParser;
+import org.apache.commons.vfs.provider.Uri;
/**
* A name parser.
@@ -98,11 +98,11 @@
*
* @param uriStr The URI.
*/
- public ParsedUri parseFileUri( final String uriStr )
+ public Uri parseFileUri( final String uriStr )
throws FileSystemException
{
final StringBuffer name = new StringBuffer();
- final ParsedFileUri uri = new ParsedFileUri();
+ final LocalFileUri uri = new LocalFileUri();
// Extract the scheme
final String scheme = extractScheme( uriStr, name );
@@ -125,7 +125,7 @@
rootUri.append( scheme );
rootUri.append( "://" );
rootUri.append( rootFile );
- uri.setRootUri( rootUri.toString() );
+ uri.setContainerUri( rootUri.toString() );
return uri;
}
1.1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/local/LocalFileUri.java
Index: LocalFileUri.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.vfs.provider.local;
import org.apache.commons.vfs.provider.Uri;
/**
* A local file URI.
*
* @author <a href="mailto:adammurdoch@;apache.org">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/10/31 10:40:57 $
*/
final class LocalFileUri
extends Uri
{
private String rootFile;
public String getRootFile()
{
return rootFile;
}
public void setRootFile( final String rootPrefix )
{
rootFile = rootPrefix;
}
}
1.6 +4 -8
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/smb/SmbFileNameParser.java
Index: SmbFileNameParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/smb/SmbFileNameParser.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SmbFileNameParser.java 23 Oct 2002 11:59:41 -0000 1.5
+++ SmbFileNameParser.java 31 Oct 2002 10:40:57 -0000 1.6
@@ -56,8 +56,8 @@
package org.apache.commons.vfs.provider.smb;
import org.apache.commons.vfs.FileSystemException;
-import org.apache.commons.vfs.provider.ParsedUri;
import org.apache.commons.vfs.provider.UriParser;
+import org.apache.commons.vfs.provider.Uri;
/**
* A parser for SMB URI.
@@ -71,19 +71,15 @@
/**
* Parses an absolute URI, splitting it into its components.
*/
- public ParsedUri parseSmbUri( final String uriStr )
+ public Uri parseSmbUri( final String uriStr )
throws FileSystemException
{
- final ParsedSmbUri uri = new ParsedSmbUri();
+ final SmbUri uri = new SmbUri();
final StringBuffer name = new StringBuffer();
// Extract the scheme and authority parts
extractToPath( uriStr, name, uri );
- // Convert the hostname to lowercase
- final String hostname = uri.getHostName().toLowerCase();
- uri.setHostName( hostname );
-
// TODO - drop the default port
// Decode and adjust separators
@@ -109,7 +105,7 @@
appendRootUri( uri, rootUri );
rootUri.append( '/' );
rootUri.append( share );
- uri.setRootUri( rootUri.toString() );
+ uri.setContainerUri( rootUri.toString() );
return uri;
}
1.7 +5 -7
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/smb/SmbFileSystemProvider.java
Index: SmbFileSystemProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/smb/SmbFileSystemProvider.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SmbFileSystemProvider.java 23 Oct 2002 11:59:41 -0000 1.6
+++ SmbFileSystemProvider.java 31 Oct 2002 10:40:57 -0000 1.7
@@ -56,13 +56,12 @@
package org.apache.commons.vfs.provider.smb;
import org.apache.commons.vfs.FileName;
-import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystem;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
import org.apache.commons.vfs.provider.DefaultFileName;
import org.apache.commons.vfs.provider.FileProvider;
-import org.apache.commons.vfs.provider.ParsedUri;
+import org.apache.commons.vfs.provider.Uri;
/**
* A provider for SMB (Samba, Windows share) file systems.
@@ -79,8 +78,7 @@
/**
* Parses a URI into its components.
*/
- protected ParsedUri parseUri( final FileObject baseFile,
- final String uri )
+ protected Uri parseUri( final String uri )
throws FileSystemException
{
return parser.parseSmbUri( uri );
@@ -89,11 +87,11 @@
/**
* Creates the filesystem.
*/
- protected FileSystem doCreateFileSystem( final ParsedUri uri )
+ protected FileSystem doCreateFileSystem( final Uri uri )
throws FileSystemException
{
- final ParsedSmbUri smbUri = (ParsedSmbUri)uri;
- final FileName rootName = new DefaultFileName( parser, smbUri.getRootUri(),
"/" );
+ final SmbUri smbUri = (SmbUri)uri;
+ final FileName rootName = new DefaultFileName( parser,
smbUri.getContainerUri(), "/" );
return new SmbFileSystem( rootName );
}
}
1.1
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/smb/SmbUri.java
Index: SmbUri.java
===================================================================
/* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Commons", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.commons.vfs.provider.smb;
import org.apache.commons.vfs.provider.GenericUri;
/**
* An SMB URI. Adds a share name to the generic URI.
*
* @author <a href="mailto:adammurdoch@;apache.org">Adam Murdoch</a>
* @version $Revision: 1.1 $ $Date: 2002/10/31 10:40:57 $
*/
final class SmbUri
extends GenericUri
{
private String share;
public String getShare()
{
return share;
}
public void setShare( final String share )
{
this.share = share;
}
}
1.2 +7 -7
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/temp/TemporaryFileProvider.java
Index: TemporaryFileProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/temp/TemporaryFileProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TemporaryFileProvider.java 25 Oct 2002 11:07:39 -0000 1.1
+++ TemporaryFileProvider.java 31 Oct 2002 10:40:58 -0000 1.2
@@ -63,7 +63,7 @@
import org.apache.commons.vfs.provider.AbstractFileSystemProvider;
import org.apache.commons.vfs.provider.DefaultFileName;
import org.apache.commons.vfs.provider.FileProvider;
-import org.apache.commons.vfs.provider.ParsedUri;
+import org.apache.commons.vfs.provider.Uri;
import org.apache.commons.vfs.provider.UriParser;
import org.apache.commons.vfs.provider.local.LocalFileSystem;
@@ -96,7 +96,7 @@
throws FileSystemException
{
// Parse the name
- final ParsedUri parsedUri = parseUri( uri );
+ final Uri parsedUri = parseUri( uri );
// Create the temp file system
FileSystem filesystem = findFileSystem( this );
@@ -106,7 +106,7 @@
{
rootFile = getContext().getTemporaryFileStore().allocateFile(
"tempfs" );
}
- final FileName rootName = new DefaultFileName( parser,
parsedUri.getRootUri(), "/" );
+ final FileName rootName = new DefaultFileName( parser,
parsedUri.getContainerUri(), "/" );
filesystem = new LocalFileSystem( rootName, rootFile.getAbsolutePath()
);
addFileSystem( this, filesystem );
}
@@ -116,16 +116,16 @@
}
/** Parses an absolute URI into its parts. */
- private ParsedUri parseUri( final String uri ) throws FileSystemException
+ private Uri parseUri( final String uri ) throws FileSystemException
{
final StringBuffer buffer = new StringBuffer( uri );
- final ParsedUri parsedUri = new ParsedUri();
+ final Uri parsedUri = new Uri();
final String scheme = parser.extractScheme( uri, buffer );
parsedUri.setScheme( scheme );
parser.decode( buffer, 0, buffer.length() );
parser.normalisePath( buffer );
parsedUri.setPath( buffer.toString() );
- parsedUri.setRootUri( scheme + ":" );
+ parsedUri.setContainerUri( scheme + ":" );
return parsedUri;
}
}
1.6 +5 -6
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/url/UrlFileProvider.java
Index: UrlFileProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/url/UrlFileProvider.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UrlFileProvider.java 23 Oct 2002 11:59:42 -0000 1.5
+++ UrlFileProvider.java 31 Oct 2002 10:40:58 -0000 1.6
@@ -55,13 +55,12 @@
*/
package org.apache.commons.vfs.provider.url;
-import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystem;
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
import org.apache.commons.vfs.provider.DefaultFileName;
-import org.apache.commons.vfs.provider.ParsedUri;
import org.apache.commons.vfs.provider.UriParser;
+import org.apache.commons.vfs.provider.Uri;
/**
* A file provider backed by Java's URL API.
@@ -77,7 +76,7 @@
/**
* Parses a URI into its components.
*/
- protected ParsedUri parseUri( FileObject baseFile, String uri )
+ protected Uri parseUri( final String uri )
throws FileSystemException
{
return parser.parseUri( uri );
@@ -86,10 +85,10 @@
/**
* Creates the filesystem.
*/
- protected FileSystem doCreateFileSystem( ParsedUri uri )
+ protected FileSystem doCreateFileSystem( final Uri uri )
throws FileSystemException
{
- final DefaultFileName rootName = new DefaultFileName( parser,
uri.getRootUri(), "/" );
+ final DefaultFileName rootName = new DefaultFileName( parser,
uri.getContainerUri(), "/" );
return new UrlFileSystem( rootName );
}
}
1.6 +4 -4
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileNameParser.java
Index: ZipFileNameParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileNameParser.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ZipFileNameParser.java 23 Oct 2002 11:59:42 -0000 1.5
+++ ZipFileNameParser.java 31 Oct 2002 10:40:58 -0000 1.6
@@ -56,8 +56,8 @@
package org.apache.commons.vfs.provider.zip;
import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.provider.Uri;
import org.apache.commons.vfs.provider.UriParser;
-import org.apache.commons.vfs.provider.ParsedLayeredUri;
/**
* A parser for Zip file names.
@@ -76,11 +76,11 @@
* @param uriStr
* The URI.
*/
- public ParsedLayeredUri parseZipUri( final String uriStr )
+ public Uri parseZipUri( final String uriStr )
throws FileSystemException
{
final StringBuffer name = new StringBuffer();
- final ParsedLayeredUri uri = new ParsedLayeredUri();
+ final Uri uri = new Uri();
// Extract the scheme
final String scheme = extractScheme( uriStr, name );
@@ -88,7 +88,7 @@
// Extract the Zip file name
final String zipName = extractZipName( name );
- uri.setOuterFileUri( zipName );
+ uri.setContainerUri( zipName );
// Decode and normalise the file name
decode( name, 0, name.length() );
1.12 +2 -2
jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileSystemProvider.java
Index: ZipFileSystemProvider.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/zip/ZipFileSystemProvider.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ZipFileSystemProvider.java 28 Oct 2002 02:05:06 -0000 1.11
+++ ZipFileSystemProvider.java 31 Oct 2002 10:40:58 -0000 1.12
@@ -61,7 +61,7 @@
import org.apache.commons.vfs.provider.AbstractLayeredFileProvider;
import org.apache.commons.vfs.provider.DefaultFileName;
import org.apache.commons.vfs.provider.FileProvider;
-import org.apache.commons.vfs.provider.ParsedLayeredUri;
+import org.apache.commons.vfs.provider.Uri;
/**
* A file system provider for Zip files. Provides read-only file systems.
@@ -79,7 +79,7 @@
* Parses an absolute URI.
* @param uri The URI to parse.
*/
- protected ParsedLayeredUri parseUri( final String uri )
+ protected Uri parseUri( final String uri )
throws FileSystemException
{
return parser.parseZipUri( uri );
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@;jakarta.apache.org>