Remote Copy File API

Discussion in 'Java' started by Prime, Aug 10, 2005.

  1. Prime

    Prime Guest

    Hello,

    My project involves copying files from one Host to another Host located
    on the same network of, currently, Solaris machines.

    Is there a library or API set that performs tasks similar to Unix's
    "rcp host1:<filename> host2:<filename>"

    Something like:

    RemoteFile r = new RemoteFile(host2, path, filename); ??

    I want to do this in Java instead of using Shell Scripts for obvious
    reasons. I've thought of looking into Jakarta by Apache for FTP, but
    we can't get into storing/saving the password for the FTP username.

    Any ideas or recommendations?

    Thank you!
    Prime, Aug 10, 2005
    #1
    1. Advertising

  2. On 10 Aug 2005 11:08:53 -0700, Prime wrote:

    > Hello,


    Hello. Please cross-post in future.
    <http://groups-beta.google.com/support/bin/static.py?page=glossary.html>
    <http://www.physci.org/codes/javafaq.jsp#xpost>

    --
    Andrew Thompson
    physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
    Now Interactive! Joystick Controls Fry's Left Ear.
    Andrew Thompson, Aug 10, 2005
    #2
    1. Advertising

  3. Prime

    Roedy Green Guest

    On 10 Aug 2005 11:08:53 -0700, "Prime" <> wrote or
    quoted :

    >Hello,
    >
    >My project involves copying files from one Host to another Host located
    >on the same network of, currently, Solaris machines.
    >
    >Is there a library or API set that performs tasks similar to Unix's
    >"rcp host1:<filename> host2:<filename>"
    >
    >Something like:
    >
    >RemoteFile r = new RemoteFile(host2, path, filename); ??
    >
    >I want to do this in Java instead of using Shell Scripts for obvious
    >reasons. I've thought of looking into Jakarta by Apache for FTP, but
    >we can't get into storing/saving the password for the FTP username.
    >
    >Any ideas or recommendations?
    >
    >Thank you!


    I have not used Solaris, but in some remote file systems, the remote
    machines look just like additional drives. You access them the same
    way you would local drives or drives on other machines on your local
    lan with some file naming convention. An ordinary file copy will
    work.

    see http://mindprod.com/products.html#FILETRANSFER to do various types
    of file copy in Java.

    If you don't have that, or don't have security clearance to write
    files on the remote machines, you can get stuff via HTTP, but you
    can't very well put it that way. Even getting presumes some HTTP
    server is running on the source machine and is willing to send it to
    you. You need FTP to upload. See http://mindprod.com/jgloss/ftp.html

    And then you will need an account and password to upload the FTP with
    rights to leave the file where you want to.

    Another approach is to use Rsync. See
    http://mindprod.com/jgloss/rsync.html

    I am amazed how i/o to remote machines has not been made seamless once
    you have satisfied the security requirement. It should look just like
    local i/o.

    For other options, see
    http://mindprod.com/jgloss/remotefileaccess.html

    In any case you are the man the middle copying from source to yourself
    then from yourself to target.
    Roedy Green, Aug 11, 2005
    #3
  4. Prime

    Jeff Schwab Guest

    Roedy Green wrote:
    > On 10 Aug 2005 11:08:53 -0700, "Prime" <> wrote or
    > quoted :
    >
    >>My project involves copying files from one Host to another Host located
    >>on the same network of, currently, Solaris machines.
    >>
    >>Is there a library or API set that performs tasks similar to Unix's
    >>"rcp host1:<filename> host2:<filename>"


    > I have not used Solaris, but in some remote file systems, the remote
    > machines look just like additional drives. You access them the same
    > way you would local drives or drives on other machines on your local
    > lan with some file naming convention. An ordinary file copy will
    > work.


    On Solaris (with NFS), the equivalent is to mount the remote filesystem
    on the local machine. Machines on the same local network are often
    configured this way when they're first set up, such that every host's
    files are mounted at /export/<hostname> on other local machines.

    Rcp has largely been superceded by scp. A couple of minutes on Google
    turned up several Java scp clients, but none of them looked both usable
    and free. Here are the docs for one commercially available client that
    seems to match the kind of interface you would like.

    http://www.sshtools.com/content/developer/maverick/docs/com/sshtools/scp/ScpClient.html
    Jeff Schwab, Aug 11, 2005
    #4
  5. Prime wrote:
    > My project involves copying files from one Host to another Host located
    > on the same network of, currently, Solaris machines.
    >
    > Is there a library or API set that performs tasks similar to Unix's
    > "rcp host1:<filename> host2:<filename>"


    If you want rcp, then just use Runtime.exec() to start rcp.

    > I want to do this in Java instead of using Shell Scripts for obvious
    > reasons.


    What reasons should that be? rcp requires super-user rights. The client
    needs to use a source port > 511 and < 1024. You would have to run the
    VM with such rights, just because of some rcp protocol implementation
    inside your Java application.

    BTW: rcp was never formally specified. It is basically rsh (also not
    formally specified), which is in turn basically rlogin (that one you get
    an RFC for ...), but with the server daemon on port 514, instead of 513.

    If you want to implement it, get some rcp C source code and clone it in
    Java.

    /Thomas

    --
    The comp.lang.java.gui FAQ:
    ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
    http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
    Thomas Weidenfeller, Aug 11, 2005
    #5
  6. Prime

    Prime Guest

    First off thank you for all the responses!

    The bulk of my project is about file manipulation, copying/deleting,
    archiving/extracting, obtaining file size, and all this can be done,
    but not to remote hosts, which is why the initial use of shell scripts.


    The reasons I would prefer not to use shell scripts is because down the
    road we are switching from Solaris to a newer version of Red Hat Linux.
    Most likely the commands will still be the same, but using scripts
    does take away from being 100% Platfrom Independant. Also, it puts the
    strain on the Operating Environment to do the work I would like my
    program to do. Lastly, if something went wrong in the beginning of the
    script, (file permissions error, file not found error, anything), my
    program would not know until after the script has run. This forces me
    to do a large amount of error checking afterward that a try-catch block
    would catch immediately.

    Unfortunately, no remote hosts are mounted onto the /export/* folder.

    We have been looking into purchasing an FTP library that would do these
    manipulations, however, some of us have issues with storing the
    password or hardcoding it. It's sort of a conundrum, we want secure,
    remote file functions, but we want to do it by bypassing the password.
    Also, we would probably need client software to run on remote hosts.

    Thanks again for all your help, I will be checking those links, and any
    more information would be greatly appreciated!



    Thomas Weidenfeller wrote:
    > Prime wrote:
    > > My project involves copying files from one Host to another Host located
    > > on the same network of, currently, Solaris machines.
    > >
    > > Is there a library or API set that performs tasks similar to Unix's
    > > "rcp host1:<filename> host2:<filename>"

    >
    > If you want rcp, then just use Runtime.exec() to start rcp.
    >
    > > I want to do this in Java instead of using Shell Scripts for obvious
    > > reasons.

    >
    > What reasons should that be? rcp requires super-user rights. The client
    > needs to use a source port > 511 and < 1024. You would have to run the
    > VM with such rights, just because of some rcp protocol implementation
    > inside your Java application.
    >
    > BTW: rcp was never formally specified. It is basically rsh (also not
    > formally specified), which is in turn basically rlogin (that one you get
    > an RFC for ...), but with the server daemon on port 514, instead of 513.
    >
    > If you want to implement it, get some rcp C source code and clone it in
    > Java.
    >
    > /Thomas
    >
    > --
    > The comp.lang.java.gui FAQ:
    > ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
    > http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
    Prime, Aug 11, 2005
    #6
  7. Prime wrote:
    > Hello,
    >
    > My project involves copying files from one Host to another Host located
    > on the same network of, currently, Solaris machines.
    >
    > Is there a library or API set that performs tasks similar to Unix's
    > "rcp host1:<filename> host2:<filename>"
    >
    > Something like:
    >
    > RemoteFile r = new RemoteFile(host2, path, filename); ??
    >
    > I want to do this in Java instead of using Shell Scripts for obvious
    > reasons. I've thought of looking into Jakarta by Apache for FTP, but
    > we can't get into storing/saving the password for the FTP username.
    >
    > Any ideas or recommendations?
    >
    > Thank you!
    >


    Prime:

    I started a file transfer project a while back. It works but could use
    some updating and feature addition. If you want the source, email me.

    knute...

    email s/nospam/knute/
    Knute Johnson, Aug 11, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    2
    Views:
    1,200
  2. Replies:
    26
    Views:
    2,083
    Roland Pibinger
    Sep 1, 2006
  3. ray
    Replies:
    1
    Views:
    1,298
    Robert Kern
    Jun 4, 2010
  4. Dayton Jones

    Remote.pm (File::Remote) problem

    Dayton Jones, Mar 1, 2006, in forum: Perl Misc
    Replies:
    9
    Views:
    173
    Dayton Jones
    Mar 3, 2006
  5. MaggotChild

    File::Copy::copy With File Handles

    MaggotChild, Oct 18, 2011, in forum: Perl Misc
    Replies:
    2
    Views:
    491
    Ilya Zakharevich
    Oct 22, 2011
Loading...

Share This Page