Re: [vfs] FileSystemException: Could not load VFS configuration

2015-03-26 Thread Helge Waastad
Hi,
and thanks for answering.

I figured it out.

It was a classloader issue.
so by setting classloader on STandardFilesystemMAnager I got it working.

br hw


on., 25.03.2015 kl. 22.17 +0100, skrev Bernd Eckenfels:

 Am Wed, 25 Mar 2015 17:48:03 +0100
 schrieb Helge Waastad he...@waastad.org:
 
  If I bundle the commons-vfs2 (2.1-SNAPSHOT/2.0) with the rar I get
  then exception:
  FileSystemException: Could not load VFS configuration from
  jar:file:/home/helge/Skrivebord/jca-parent/acme-war/target/apache-tomee/apps/acme-ra-1.0-SNAPSHOT/commons-vfs2-2.1-SNAPSHOT.jar!/org/apache/commons/vfs2/impl/providers.xml
 
 Is this JAR and with the resource existing or not?
 
  If I add vfs2-commons to tomee/lib and provided in my rar, then its
  working OK.
  
  Is this how it's supposed to work?
 
 The default configuration mechanism resolves providers.xml via the
 classloader of the StandardFileSystemManager class. It retrieves the
 URL for that resource and loads it.
 
 You might want to overwrite the init() method or somple create the
 DefaultFileSystemManager and configure it yourself.
 
 (I am not entirely sure why it does not work in your scenario).
 
 Gruss
 Bernd
 
 -
 To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
 For additional commands, e-mail: user-h...@commons.apache.org
 




Resend: [vfs] vsf2.2.0: non-ascii chars in file name are not handled by createFolder()

2015-03-26 Thread Geoff Watters


Is anyone else able to use non-ascii chars in filenames when using VFS 
2.2.0?


As indicated below, the created file has a ? in the resultant name 
rather than the original non-ascii character.


Thanks


On 16/03/2015 11:07, Geoff Watters wrote:

All

I am using*commons-vfs2-2.0.jar* and am running into problems when 
file names contain non-ascii characters. According to 
https://issues.apache.org/jira/browse/VFS-305 this has been 
fixed/shipped in 2.0. In my environment I am able to create such file 
names when using ftp on the command-line (Red Hat Enterprise Linux 
Server release 5.8 (Tikanga)).


When I execute the following sample code, I get the output shown below.

public class FtpTest {
public static void main(String[] args) throws FileSystemException
{
String host=hhh;
String user = uuu;
String password = ppp;
String destDir = /tmp;
FileSystemOptions opts = new FileSystemOptions();
FtpFileSystemConfigBuilder.getInstance().setControlEncoding(opts, 
UTF-8);


DefaultFileSystemManager manager = new 
DefaultFileSystemManager();

manager.addProvider(ftp, new FtpFileProvider());
manager.init();

String root=ftp://+user+:+password+@+host+destDir;
// Specify a number of directories that should be created 
under destDir

String[] lRoots = new String[4];
lRoots[0]= root+/ftpDebug;
lRoots[1]= root+/ftp\u7684Debug;  // insert a non-ascii char
lRoots[2]= root+/ftp\u7685Debug;  // insert a different 
non-ascii char
lRoots[3]= root+/ftp\u7684Debug;  // insert the same 
non-ascii char


// Verify the ControlEncoding
System.out.println(ControlEncoding is 
+FtpFileSystemConfigBuilder.getInstance().getControlEncoding(opts));


int dirCount=0;
for (String lRoot: lRoots) {
System.out.println(dirCount+) Process directory 
[+lRoot+]);

FileObject newDir = manager.resolveFile(lRoot, opts);
if (!newDir.exists()) {
try {
System.out.println(dirCount+) +lRoot+ ::Dir 
Does Not Exist so Create It );

newDir.createFolder();
if (newDir.exists())
System.out.println(dirCount+) +lRoot+ 
::Creation Successful );

else
System.out.println(dirCount+) +lRoot+ 
::Creation Fails );

}
catch (Exception ex) {
System.out.println(dirCount+) +lRoot +  raised 
+ex);

}
}
else
System.out.println(dirCount+) +lRoot+ ::Dir Already 
Exists );

dirCount++;
}
}
}

The output from running the above is:-

ControlEncoding is UTF-8
0) Process directory [ftp://uuu:ppp@hhh/tmp/ftpDebug]
0) ftp://uuu:ppp@hhh/tmp/ftpDebug ::Dir Does Not Exist so Create It
0) ftp://uuu:ppp@hhh/tmp/ftpDebug ::Creation Successful
1) Process directory [ftp://uuu:ppp@hhh/tmp/ftpªDebug]
1) ftp://uuu:ppp@hhh/tmp/ftpªDebug ::Dir Does Not Exist so Create It
1) ftp://uuu:ppp@hhh/tmp/ftpªDebug ::Creation Successful
2) Process directory [ftp://uuu:ppp@hhh/tmp/ftp%Gçš…%@Debug]
2) ftp://uuu:ppp@hhh/tmp/ftp%Gçš…%@Debug ::Dir Does Not Exist so 
Create It
2) ftp://uuu:ppp@hhh/tmp/ftp%Gçš…%@Debug raised 
org.apache.commons.vfs2.FileSystemException: Could not create 
folder ftp://uuu:***@hhh/tmp/ftp%Gçš…%@Debug.

3) Process directory [ftp://uuu:ppp@hhh/tmp/ftpªDebug]
3) ftp://uuu:ppp@hhh/tmp/ftpªDebug ::Dir Does Not Exist so Create It
3) ftp://uuu:ppp@hhh/tmp/ftpªDebug raised 
org.apache.commons.vfs2.FileSystemException: Could not create folder 
ftp://uuu:***@hhh/tmp/ftpªDebug;.


After step 1) I see a directory called*/tmp/ftp?Debug*.
I think this is causing the subsequent creation problem in step 2) and 
step 3).
When a directory such as *ftp\u7684Debug* does exist, then 
*exists*() returns the correct result of true, but *createFolder*() 
creates a directory with name *ftp?Debug*.


Thanks in advance
Geoff






-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: [vfs] announcing an Azure Blob Storage Provider

2015-03-26 Thread Bernd Eckenfels
Am Thu, 26 Mar 2015 11:26:26 +0100
schrieb Benedikt Ritter brit...@apache.org:

 We could add a section with 3rd party providers to our website...

There is a related projects in the Wiki:

https://wiki.apache.org/commons/VFS

I have added vfs-azure.

Gruss
Bernd

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org