Hi Filip
I am in the process of getting TrueZip uploaded to Maven2
(http://jira.codehaus.org/browse/MAVENUPLOAD-1693) and also finishing up
http://issues.apache.org/jira/browse/VFS-106 as per the comments.
However when I try to create a Zip archive on an FTP site, there is
still a problem where the TzFileObject class keeps a TrueZip File
instance - which is not exactly whats really being used. Can you suggest
how I can overcome this? I have attached a patch of my changes for your
review
thanks
asankha
Filip Defoort wrote:
Thorbjørn Ravn Andersen wrote:
Filip Defoort skrev den 27-08-2007 18:01:
Good luck doing that cross platform in java :)
Well, I didn't mean mount as in actually mount a file system, just
unzip and maintain an uncompressed directory tree of the portions of
the zip file that are in use in java.io.tmpdir. Right now truezip is
updating the zip file itself for every single operation, and that's
where it's losing all performance. So, it's not _that_ hard ;-).
So you are basically suggesting some kind of cache layer with delayed
write operations?
Yes, indeed. Have the system unpack the parts of the zip that are
actively used and only do an actual write on a FileSystem.close() (or
perhaps on a flush). Without this type of layer, the performance will
be pretty poor.. (as it is with the mockup of the zip filesystem based
on truezip).
Perhaps a generic approach for that might be suitable?
Indeed. I've been meaning to look into this but haven't had time.
- Filip
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Index: core/src/test/java/org/apache/commons/vfs/provider/truezip/test/NestedTrueZipTestCase.java
===================================================================
--- core/src/test/java/org/apache/commons/vfs/provider/truezip/test/NestedTrueZipTestCase.java (revision 0)
+++ core/src/test/java/org/apache/commons/vfs/provider/truezip/test/NestedTrueZipTestCase.java (revision 0)
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.vfs.provider.truezip.test;
+
+import junit.framework.Test;
+import org.apache.commons.AbstractVfsTestCase;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.impl.DefaultFileSystemManager;
+import org.apache.commons.vfs.provider.truezip.TzFileProvider;
+import org.apache.commons.vfs.test.AbstractProviderTestConfig;
+import org.apache.commons.vfs.test.ProviderTestConfig;
+import org.apache.commons.vfs.test.ProviderTestSuite;
+
+/**
+ * Tests for the Zip file system, using a zip file nested inside another zip file.
+ *
+ */
+public class NestedTrueZipTestCase
+ extends AbstractProviderTestConfig
+ implements ProviderTestConfig {
+ /**
+ * Creates the test suite for nested zip files.
+ */
+ public static Test suite() throws Exception {
+ return new ProviderTestSuite(new NestedTrueZipTestCase());
+ }
+
+ /**
+ * Prepares the file system manager.
+ */
+ public void prepare(final DefaultFileSystemManager manager)
+ throws Exception {
+ manager.addProvider("zip", new TzFileProvider());
+ manager.addExtensionMap("zip", "zip");
+ manager.addMimeTypeMap("application/zip", "zip");
+ }
+
+ /**
+ * Returns the base folder for tests.
+ */
+ public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
+ // Locate the base Zip file
+ final String zipFilePath = AbstractVfsTestCase.getTestResource("nested.zip").getAbsolutePath();
+ String uri = "zip:" + zipFilePath + "!/test.zip";
+ final FileObject zipFile = manager.resolveFile(uri);
+
+ // Now build the nested file system
+ final FileObject nestedFS = manager.createFileSystem(zipFile);
+ return nestedFS.resolveFile("/");
+ }
+}
Index: core/src/test/java/org/apache/commons/vfs/provider/truezip/test/TrueZipProviderTestCase.java
===================================================================
--- core/src/test/java/org/apache/commons/vfs/provider/truezip/test/TrueZipProviderTestCase.java (revision 0)
+++ core/src/test/java/org/apache/commons/vfs/provider/truezip/test/TrueZipProviderTestCase.java (revision 0)
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.vfs.provider.truezip.test;
+
+import org.apache.commons.vfs.test.AbstractProviderTestConfig;
+import org.apache.commons.vfs.test.ProviderTestConfig;
+import org.apache.commons.vfs.test.ProviderTestSuite;
+import org.apache.commons.vfs.provider.zip.test.ZipProviderTestCase;
+import org.apache.commons.vfs.provider.zip.ZipFileProvider;
+import org.apache.commons.vfs.provider.truezip.TzFileProvider;
+import org.apache.commons.vfs.impl.DefaultFileSystemManager;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.AbstractVfsTestCase;
+import junit.framework.Test;
+
+import java.io.File;
+
+/**
+ * Tests for the Zip file system.
+ *
+ */
+public class TrueZipProviderTestCase
+ extends AbstractProviderTestConfig
+ implements ProviderTestConfig {
+ /**
+ * Creates the test suite for the zip file system.
+ */
+ public static Test suite() throws Exception
+ {
+ return new ProviderTestSuite(new TrueZipProviderTestCase());
+ }
+
+ /**
+ * Prepares the file system manager.
+ */
+ public void prepare(final DefaultFileSystemManager manager) throws Exception
+ {
+ manager.addProvider("zip", new TzFileProvider());
+ manager.addExtensionMap("zip", "zip");
+ manager.addMimeTypeMap("application/zip", "zip");
+ }
+
+ /**
+ * Returns the base folder for read tests.
+ */
+ public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception
+ {
+ final File zipFile = AbstractVfsTestCase.getTestResource("test.zip");
+ final String uri = "zip:" + zipFile.getAbsolutePath() + "!/";
+ return manager.resolveFile(uri);
+ }
+}
Index: core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java (revision 549412)
+++ core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileProvider.java (working copy)
@@ -25,10 +25,12 @@
import org.apache.commons.vfs.UserAuthenticationData;
import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
import org.apache.commons.vfs.provider.GenericFileName;
+import org.apache.commons.vfs.provider.URLFileName;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.StringTokenizer;
/**
* A provider for FTP file systems.
@@ -74,9 +76,27 @@
throws FileSystemException
{
// Create the file system
- final GenericFileName rootName = (GenericFileName) name;
+ final URLFileName rootName = (URLFileName) name;
- FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, fileSystemOptions);
+ String queryString = rootName.getQueryString();
+ FileSystemOptions opts = fileSystemOptions;
+ if (opts == null) {
+ opts = new FileSystemOptions();
+ }
+
+ if (queryString != null) {
+ FtpFileSystemConfigBuilder cfgBuilder = FtpFileSystemConfigBuilder.getInstance();
+
+ StringTokenizer st = new StringTokenizer(queryString, "?&!=");
+ while (st.hasMoreTokens()) {
+ if ("passive".equalsIgnoreCase(st.nextToken()) &&
+ st.hasMoreTokens() && "true".equalsIgnoreCase(st.nextToken())) {
+ cfgBuilder.setPassiveMode(opts, true);
+ }
+ }
+ }
+
+ FTPClientWrapper ftpClient = new FTPClientWrapper(rootName, opts);
/*
FTPClient ftpClient = FtpClientFactory.createConnection(rootName.getHostName(),
rootName.getPort(),
Index: core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java (revision 549412)
+++ core/src/main/java/org/apache/commons/vfs/provider/ftp/FtpFileNameParser.java (working copy)
@@ -16,8 +16,10 @@
*/
package org.apache.commons.vfs.provider.ftp;
-import org.apache.commons.vfs.provider.FileNameParser;
-import org.apache.commons.vfs.provider.HostFileNameParser;
+import org.apache.commons.vfs.provider.*;
+import org.apache.commons.vfs.FileName;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileType;
/**
* Implementation for ftp. set default port to 21
@@ -35,4 +37,35 @@
{
return INSTANCE;
}
+
+ public FileName parseUri(final VfsComponentContext context, FileName base, final String filename) throws FileSystemException {
+ // FTP URI are generic URI (as per RFC 2396)
+ final StringBuffer name = new StringBuffer();
+
+ // Extract the scheme and authority parts
+ final Authority auth = extractToPath(filename, name);
+
+ // Extract the queryString
+ String queryString = UriParser.extractQueryString(name);
+ if (queryString == null && base instanceof URLFileName) {
+ queryString = ((URLFileName) base).getQueryString();
+ }
+
+ // Decode and normalise the file name
+ UriParser.canonicalizePath(name, 0, name.length(), this);
+ UriParser.fixSeparators(name);
+ FileType fileType = UriParser.normalisePath(name);
+ final String path = name.toString();
+
+ return new URLFileName(
+ auth.scheme,
+ auth.hostName,
+ auth.port,
+ getDefaultPort(),
+ auth.userName,
+ auth.password,
+ path,
+ fileType,
+ queryString);
+ }
}
Index: core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileSystem.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileSystem.java (revision 0)
+++ core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileSystem.java (revision 0)
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.vfs.provider.truezip;
+
+import java.io.FilePermission;
+import java.util.Collection;
+
+import org.apache.commons.vfs.FileName;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSelector;
+import org.apache.commons.vfs.FileSystem;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemOptions;
+import org.apache.commons.vfs.provider.AbstractFileSystem;
+
+import de.schlichtherle.io.ArchiveException;
+import de.schlichtherle.io.File;
+
+/**
+ * A Truezip (https://truezip.dev.java.net/) file system.
+ */
+public class TzFileSystem extends AbstractFileSystem implements FileSystem {
+
+ public TzFileSystem(final FileName rootName,
+ final String rootFile,
+ final FileSystemOptions opts) {
+ super(rootName, null, opts);
+ }
+
+ protected TzFileSystem(final FileName rootName,
+ final FileObject file,
+ final FileSystemOptions fileSystemOptions) throws FileSystemException {
+ super(rootName, file, fileSystemOptions);
+ }
+
+ /**
+ * Creates a file object.
+ */
+ protected FileObject createFile(final FileName name) throws FileSystemException {
+ // Create the file
+ return new TzFileObject(this, name);
+ }
+
+ /**
+ * Returns the capabilities of this file system.
+ */
+ protected void addCapabilities(final Collection caps) {
+ caps.addAll(TzFileProvider.capabilities);
+ }
+
+ /**
+ * Creates a temporary local copy of a file and its descendents.
+ */
+ protected java.io.File doReplicateFile(final FileObject fileObject,
+ final FileSelector selector) throws Exception {
+
+ final TzFileObject localFile = (TzFileObject) fileObject;
+ final File file = localFile.getLocalFile();
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ final FilePermission requiredPerm = new FilePermission(file.getAbsolutePath(), "read");
+ sm.checkPermission(requiredPerm);
+ }
+ return file;
+ }
+
+ protected void doCloseCommunicationLink() {
+
+ try {
+ File.umount();
+ } catch (ArchiveException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Index: core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileObject.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileObject.java (revision 0)
+++ core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileObject.java (revision 0)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.vfs.provider.truezip;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.commons.vfs.*;
+import org.apache.commons.vfs.provider.AbstractFileObject;
+import org.apache.commons.vfs.provider.UriParser;
+import org.apache.commons.vfs.provider.LayeredFileName;
+import org.apache.commons.vfs.provider.local.LocalFileName;
+import org.apache.commons.vfs.util.RandomAccessMode;
+
+import de.schlichtherle.io.ArchiveDetector;
+import de.schlichtherle.io.File;
+import de.schlichtherle.io.FileInputStream;
+import de.schlichtherle.io.FileOutputStream;
+
+/**
+ * A file object implementation which uses Truezip (https://truezip.dev.java.net/)
+ */
+public class TzFileObject extends AbstractFileObject implements FileObject {
+
+ private File file;
+
+ /**
+ * Creates a non-root file.
+ */
+ protected TzFileObject(final TzFileSystem fileSystem, final FileName name) throws FileSystemException {
+ super(name, fileSystem);
+ }
+
+ /**
+ * Returns the local file that this file object represents.
+ */
+ protected File getLocalFile() {
+ return file;
+ }
+
+ /**
+ * Attaches this file object to its file resource.
+ */
+ protected void doAttach() throws Exception {
+ if (file == null) {
+ LayeredFileName layeredFileName = (LayeredFileName) getName();
+ String fileName = layeredFileName.getOuterName().getPathDecoded()
+ + getName().getPathDecoded();
+ file = new File(fileName, ArchiveDetector.ALL);
+ }
+ }
+
+ /**
+ * Returns the file's type.
+ */
+ protected FileType doGetType() throws Exception {
+
+ if (!file.exists() && file.length() < 1) {
+ return FileType.IMAGINARY;
+ }
+ if (file.isDirectory()) {
+ return FileType.FOLDER;
+ }
+ return FileType.FILE;
+ }
+
+ /**
+ * Returns the children of the file.
+ */
+ protected String[] doListChildren()
+ throws Exception {
+ return UriParser.encode(file.list());
+ }
+
+ /**
+ * Deletes this file, and all children.
+ */
+ protected void doDelete() throws Exception {
+ if (!file.deleteAll()) {
+ throw new FileSystemException("vfs.provider.truezip/delete-file.error", file);
+ }
+ }
+
+ /**
+ * rename this file
+ */
+ protected void doRename(FileObject newfile) throws Exception {
+ if (!file.renameTo(((TzFileObject) newfile).getLocalFile())) {
+ throw new FileSystemException("vfs.provider.truezip/rename-file.error",
+ new String[]{file.toString(), newfile.toString()});
+ }
+ }
+
+ /**
+ * Creates this folder.
+ */
+ protected void doCreateFolder() throws Exception {
+ if (!file.mkdirs()) {
+ throw new FileSystemException("vfs.provider.truezip/create-folder.error", file);
+ }
+ }
+
+ /**
+ * Determines if this file can be written to.
+ */
+ protected boolean doIsWriteable() throws FileSystemException {
+ return file.canWrite();
+ }
+
+ /**
+ * Determines if this file is hidden.
+ */
+ protected boolean doIsHidden() {
+ return file.isHidden();
+ }
+
+ /**
+ * Determines if this file can be read.
+ */
+ protected boolean doIsReadable() throws FileSystemException {
+ return file.canRead();
+ }
+
+ /**
+ * Gets the last modified time of this file.
+ */
+ protected long doGetLastModifiedTime() throws FileSystemException {
+ return file.lastModified();
+ }
+
+ /**
+ * Sets the last modified time of this file.
+ */
+ protected void doSetLastModifiedTime(final long modtime)
+ throws FileSystemException {
+ file.setLastModified(modtime);
+ }
+
+ /**
+ * Creates an input stream to read the content from.
+ */
+ protected InputStream doGetInputStream()
+ throws Exception {
+ return new FileInputStream(file);
+ }
+
+ /**
+ * Creates an output stream to write the file content to.
+ */
+ protected OutputStream doGetOutputStream(boolean bAppend) throws Exception {
+
+ return new FileOutputStream(file, bAppend);
+ }
+
+ /**
+ * Returns the size of the file content (in bytes).
+ */
+ protected long doGetContentSize()
+ throws Exception {
+ return file.length();
+ }
+
+ protected RandomAccessContent doGetRandomAccessContent(final RandomAccessMode mode) throws Exception {
+ throw new IOException("Not implemented"); //return new LocalFileRandomAccessContent(file, mode);
+ }
+}
\ No newline at end of file
Index: core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileProvider.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileProvider.java (revision 0)
+++ core/src/main/java/org/apache/commons/vfs/provider/truezip/TzFileProvider.java (revision 0)
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.commons.vfs.provider.truezip;
+
+import org.apache.commons.vfs.*;
+import org.apache.commons.vfs.provider.AbstractLayeredFileProvider;
+import org.apache.commons.vfs.provider.LayeredFileName;
+import org.apache.commons.vfs.provider.local.LocalFileName;
+import org.apache.commons.vfs.provider.local.LocalFileNameParser;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * A file system provider, which uses Truezip (https://truezip.dev.java.net/)
+ */
+public class TzFileProvider extends AbstractLayeredFileProvider {
+
+ public final static Collection capabilities =
+ Collections.unmodifiableCollection(Arrays.asList(new Capability[]{
+ Capability.CREATE,
+ Capability.DELETE,
+ Capability.RENAME,
+ Capability.GET_TYPE,
+ Capability.GET_LAST_MODIFIED,
+ Capability.SET_LAST_MODIFIED_FILE,
+ Capability.SET_LAST_MODIFIED_FOLDER,
+ Capability.LIST_CHILDREN,
+ Capability.READ_CONTENT,
+ Capability.URI,
+ Capability.WRITE_CONTENT,
+ Capability.APPEND_CONTENT,
+ //Capability.RANDOM_ACCESS_READ,
+ //Capability.RANDOM_ACCESS_WRITE
+ }));
+
+ public TzFileProvider() {
+ super();
+ }
+
+ /**
+ * Creates a layered file system. This method is called if the file system
+ * is not cached.
+ *
+ * @param scheme The URI scheme.
+ * @param file The file to create the file system on top of.
+ * @return The file system.
+ */
+ protected FileSystem doCreateFileSystem(final String scheme,
+ final FileObject file,
+ final FileSystemOptions fileSystemOptions)
+ throws FileSystemException {
+
+ final FileName name =
+ new LayeredFileName(scheme, file.getName(), FileName.ROOT_PATH, FileType.FOLDER);
+ return new TzFileSystem(name, file, fileSystemOptions);
+ }
+
+ /**
+ * Determines if a name is an absolute file name.
+ */
+ public boolean isAbsoluteLocalName(final String name) {
+ return ((LocalFileNameParser) getFileNameParser()).isAbsoluteName(name);
+ }
+
+ /**
+ * Creates the filesystem.
+ */
+ protected FileSystem doCreateFileSystem(final FileName name,
+ final FileSystemOptions fileSystemOptions)
+ throws FileSystemException {
+
+ // Create the file system
+ final LocalFileName rootName = (LocalFileName) name;
+ return new TzFileSystem(rootName, rootName.getRootFile(), fileSystemOptions);
+ }
+
+ public Collection getCapabilities() {
+ return capabilities;
+ }
+}
Index: core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java
===================================================================
--- core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java (revision 549412)
+++ core/src/main/java/org/apache/commons/vfs/provider/AbstractFileName.java (working copy)
@@ -52,15 +52,21 @@
this.rootUri = null;
this.scheme = scheme;
this.type = type;
- if (absPath != null && absPath.length() > 0)
+ String actualPath = absPath;
+ int pos = absPath.indexOf("?");
+ if (pos != -1) {
+ actualPath = absPath.substring(0, pos);
+ }
+
+ if (actualPath != null && actualPath.length() > 0)
{
- if (absPath.length() > 1 && absPath.endsWith("/"))
+ if (actualPath.length() > 1 && actualPath.endsWith("/"))
{
- this.absPath = absPath.substring(0, absPath.length() - 1);
+ this.absPath = actualPath.substring(0, actualPath.length() - 1);
}
else
{
- this.absPath = absPath;
+ this.absPath = actualPath;
}
}
else
Index: core/src/main/java/org/apache/commons/vfs/impl/providers.xml
===================================================================
--- core/src/main/java/org/apache/commons/vfs/impl/providers.xml (revision 549412)
+++ core/src/main/java/org/apache/commons/vfs/impl/providers.xml (working copy)
@@ -20,12 +20,12 @@
<provider class-name="org.apache.commons.vfs.provider.local.DefaultLocalFileProvider">
<scheme name="file"/>
</provider>
- <provider class-name="org.apache.commons.vfs.provider.zip.ZipFileProvider">
+ <provider class-name="org.apache.commons.vfs.provider.truezip.TzFileProvider">
<scheme name="zip"/>
</provider>
- <provider class-name="org.apache.commons.vfs.provider.tar.TarFileProvider">
+ <provider class-name="org.apache.commons.vfs.provider.truezip.TzFileProvider">
<scheme name="tar"/>
- <if-available class-name="org.apache.commons.vfs.provider.tar.TarInputStream"/>
+ <!--<if-available class-name="org.apache.commons.vfs.provider.tar.TarInputStream"/>-->
</provider>
<provider class-name="org.apache.commons.vfs.provider.bzip2.Bzip2FileProvider">
@@ -36,7 +36,7 @@
<scheme name="gz"/>
</provider>
- <provider class-name="org.apache.commons.vfs.provider.jar.JarFileProvider">
+ <provider class-name="org.apache.commons.vfs.provider.truezip.TzFileProvider">
<scheme name="jar"/>
<scheme name="sar"/>
<scheme name="ear"/>
Index: core/src/main/java/org/apache/commons/vfs/Resources.properties
===================================================================
--- core/src/main/java/org/apache/commons/vfs/Resources.properties (revision 549412)
+++ core/src/main/java/org/apache/commons/vfs/Resources.properties (working copy)
@@ -263,6 +263,11 @@
vfs.provider.sftp/known-hosts.error=Error during processing known-hosts file "{0}".
vfs.provider.sftp/StrictHostKeyChecking-arg.error=Illegal argument "{0}" hostKeyChecking can only be "ask", "yes" or "no"
+#TrueZip provider
+vfs.provider.truezip/delete-file.error=Could not delete "{0}".
+vfs.provider.truezip/rename-file.error=Could not rename file "{0}" to "{1}".
+vfs.provider.truezip/create-folder.error=Could not create directory "{0}".
+
# Ant tasks
vfs.tasks/sync.no-destination.error=No destination file or directory specified.
vfs.tasks/sync.too-many-destinations.error=Cannot specify both a destination file and a destination directory.
Index: core/pom.xml
===================================================================
--- core/pom.xml (revision 549412)
+++ core/pom.xml (working copy)
@@ -66,7 +66,13 @@
<version>1.4.1</version>
<optional>true</optional>
</dependency>
- <!--TODO:Revert to [compress] if/when released
+ <dependency>
+ <groupId>de.schlichtherle.io</groupId>
+ <artifactId>truezip</artifactId>
+ <version>6.6</version>
+ <optional>true</optional>
+ </dependency>
+ <!--TODO:Revert to [compress] if/when released
<dependency>
<groupId>commons-compress</groupId>
<artifactId>commons-compress</artifactId>
@@ -192,7 +198,7 @@
<systemProperties>
<property>
<name>test.basedir</name>
- <value>target/test-classes/test-data</value>
+ <value>target/classes/test-data</value>
</property>
<property>
<name>test.basedir.res</name>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]