× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I was able to get Apache Commons VFS working by changing the CHGFTPA
so that the default naming is IFS style. But, this solution was
unacceptable to the sys admins, as it affects everyone on the box.
But I was unable to get VFS to work any other way. So I opened a issue
in the Apache VFS bug tracking system. The url to the issue is
https://issues.apache.org/jira/browse/VFS-224

I have a lower-level Java API for FTP that I usually use, but I was
hoping to use VFS instead because it also supports SFTP , HTTP, HTTPS,
WebDAV, telnet, SSH,local File systems, and in memory files. Ideally I
would like to use one API to cover all these protocols, or at least
both FTP and SFTP.

-Sarah

On Wed, Oct 15, 2008 at 10:18 AM, Sarah Poger Gladstone
<sarah@xxxxxxxxxxxxxx> wrote:
Bill - I tried my code with setUserDirIsRoot set to true, and also
tried false. Neither worked. I looked into subclassing
FtpFileSystemConfigBuilder, but it is only a transfer object used to
store config settings. It does not connect to the FTP server or do any
communication. Any other suggestions?


Thanks,
Sarah



On Tue, Oct 14, 2008 at 4:18 PM, Blalock, Bill <Bill.Blalock@xxxxxxxx> wrote:
Hey Sarah:

I got curious and checked out the Apache VFS site.

You might try changing
FtpFileSystemConfigBuilder.getInstance().
setUserDirIsRoot(fileSystemOptions, true);
To "false".

According to the javadocs this method
> use user directory as root (do not change to fs root)

I think "true" is telling the FTP server to put the file in the CURLIB.

"false" might tell the FTP server to put the file relative to the root.
That might cause a CD and force NAMEFMT to change (as Tamas suggests).

The real solution would be to subclass FtpFileSystemConfigBuilder for
the i5 FTP server ;)

Let us know if that works please.

Bill Blalock

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Tamas Perlaky
Sent: Tuesday, October 14, 2008 3:23 PM
To: Java Programming on and around the iSeries / AS400
Subject: Re: Using Apache VFS to FTP to the AS/400 IFS

Hi Sarah,

Since you're not using FTP directly (i.e. with VFS as an intermediate
layer) your only option may be to change the system default to *PATH
naming (NAMEFMT 1) via the CHGFTPA command. Of course this may break
other things which expect *SYS naming (NAMEFMT 0) so be sure to check
with any appropriate parties first.

If you were using a different FTP client you might be able to use an
FTP site command to issue a literal SITE NAMEFMT 1 to the FTP server
to effect this switch. This may somehow be possible with VFS but I'm
not familiar with it at all so I can't make a recommendation there.
Another trick would be to force the first command of your FTP session
to be a CD such that the directory specified starts with a slash (e.g.
"CD /home/aplsup"), in which case the leading slash would trigger an
implicit switch to *PATH naming for that session...

If you're looking for an FTP client library I can recommend jScape's
(commercial license) which I quite like. I've also used /n software's
(also commercial), which I quite dislike.

t.

On 14-Oct-08, at 1:36 PM, Sarah Poger Gladstone wrote:

I have been using the Apache VFS API's to upload to Unix FTP servers
successfully. But I am unable to upload to the IFS on my AS/400. I
can upload to QGPL, but not the IFS.

Below is an excerpt from my Java code:

FileSystemManager mgr;
try {
mgr = VFS.getManager();

FileSystemOptions fileSystemOptions;
FileSystemOptions opts = new
FileSystemOptions();
fileSystemOptions = opts;
FtpFileSystemConfigBuilder
.getInstance().setUserDirIsRoot(fileSystemOptions,
true);

String strLocalFile =
"C:\\sgladstone\\edfiles\\mydata.txt";
FileObject foLocalFile =
mgr.resolveFile(strLocalFile);
String rUrlStr =
"ftp://myusername:mypassword@myas400/home/aplsup/sarahtest.txt"; ;
FileObject foRemoteFile = mgr.resolveFile(
rUrlStr, opts);


FileSelector fS = Selectors.SELECT_SELF ;
foRemoteFile.copyFrom(foLocalFile, fS);


When I run this code, it throws the exception:

Caused by: org.apache.commons.vfs.FileSystemException: Could not
create FTP directory "ftp://myusername:mypassword@myas400/home";


I think this issue is caused by the AS/400 trying to use System
naming, instead of using NAMEFMT=1.

Any ideas of how to get the VFS APIs to get the AS/400 to switch to
NAMEFMT =1 ?

Thanks,
Sarah
--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.

--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.

_____________

The information contained in this message is proprietary and/or confidential. If you are not the
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose,
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition,
please be aware that any message addressed to our domain is subject to archiving and review by
persons other than the intended recipient. Thank you.
_____________
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.