OpenAPI 1.0

com.aquafold.openapi.net
Interface AQNet


public interface AQNet

This interface provides network capabilities available in aquascript.

An instance of an object implementing this interface is available via aqua.net alias.


Method Summary
 void ftpFrom(String server, Object userid, Object password, AQFileSet fileset, String remotedir)
          Copies file(s) from a FTP server.
 void ftpTo(String server, Object userid, Object password, AQFileSet fileset, String remotedir)
          Copies file(s) to a FTP server.
 void get(String url, String dest)
          Gets a file from a URL source.
 AQFtpFileSystem newFtpFileSystem(String server, Object userid, Object password)
          Constructs an instance of FTP.
 AQHadoopDistributedFileSystem newHadoopDistributedFileSystem(String name)
          Constructs an instance of distributed file system.
 AQWebClient newWebClient()
          Constructs an instance of web client.
 void scpFrom(String file, String todir, String host, Object username, Object password, String keyfile, Object passphrase, Boolean trust, String knownhosts)
          Copies file(s) from a remote machine running an SSH daemon to the local machine.
 void scpTo(String file, AQFileSet fileset, Object todir, String host, Object username, Object password, Object keyfile, Object passphrase, Boolean trust, String knownhosts)
          Copies file(s) from the local machine to a remote machine running an SSH daemon
 void sftpFrom(String file, String todir, String host, Object username, Object password, String keyfile, Object passphrase, Boolean trust, String knownhosts)
          Copies file(s) from a remote machine running an SSH daemon to the local machine.
 void sftpTo(String file, AQFileSet fileset, String todir, String host, Object username, Object password, String keyfile, Object passphrase, Boolean trust, String knownhosts)
          Copies file(s) from the local machine to a remote machine running an SSH daemon
 void sshexec(String command, String commandFile, boolean trust, String host, Object username, String keyfile, String output, Object passphrase, Integer timeout, String knownhosts)
          Executes a command on a remote machine via SSH using key based authentication.
 void sshexec(String command, String commandFile, String host, Object username, Object password, String output, Boolean trust, Integer timeout, String knownhosts)
          Executes a command on a remote machine via SSH using password based authentication.
 

Method Detail

newFtpFileSystem

AQFtpFileSystem newFtpFileSystem(String server,
                                 Object userid,
                                 Object password)
                                 throws Exception
Constructs an instance of FTP.

Parameters:
server - the address of the remote ftp server
userid - the login id to use on the ftp server
password - the login password to use on the ftp server
Throws:
Exception

newHadoopDistributedFileSystem

AQHadoopDistributedFileSystem newHadoopDistributedFileSystem(String name)
                                                             throws Exception
Constructs an instance of distributed file system.

Parameters:
name - the distributed file system name (e.g. "hdfs://:")
Throws:
Exception

newWebClient

AQWebClient newWebClient()
Constructs an instance of web client.


ftpFrom

void ftpFrom(String server,
             Object userid,
             Object password,
             AQFileSet fileset,
             String remotedir)
             throws Exception
Copies file(s) from a FTP server.

Please note that the local directory to which remote files to be saved should be specified in the given fileset parameter either as fileset.setBaseDir(localDirectoryName) or as fileset.setFile(localFilePathname); if fileset.setFile(localFilePathname) is used, the directory contains the specified local file is used as the directory to which remote files are saved.

Parameters:
server - the address of the remote ftp server
userid - the login id to use on the ftp server
password - the login password to use on the ftp server
fileset - The set of files to be copied from the remote ftp server. Either base directory or file must be specified.
remotedir - remote directory on the ftp server from where file(s) to be copied, default is the userid login directory
Throws:
Exception - if failed to copy file(s)

ftpTo

void ftpTo(String server,
           Object userid,
           Object password,
           AQFileSet fileset,
           String remotedir)
           throws Exception
Copies file(s) to a FTP server.

Parameters:
server - the address of the remote ftp server
userid - the login id to use on the ftp server
password - the login password to use on the ftp server
fileset - The set of files to be copied to the remote ftp server. Either base directory or file must be specified.
remotedir - remote directory on the ftp server from where file(s) to be copied, default is the userid login directory
Throws:
Exception - if failed to copy file(s)

scpFrom

void scpFrom(String file,
             String todir,
             String host,
             Object username,
             Object password,
             String keyfile,
             Object passphrase,
             Boolean trust,
             String knownhosts)
             throws Exception
Copies file(s) from a remote machine running an SSH daemon to the local machine.

Parameters:
file - The file(s) to copy from the remote machine.
todir - The directory on the local machine where file(s) to be saved.
host - the hostname or IP address of the remote machine to which you wish to connect; a port number can optionally follow the host, separated by a colon
username - the username on the remote machine to which you are connecting
password - the login password to use on the remote machine, can be omitted if you specify the keyfile parameter
keyfile - location of the file holding the private key, can be omitted if you specify the password parameter
passphrase - passphrase for your private key, defaults to an empty string if keyfile is specified
trust - trusts all unknown hosts if set to true, defaults to false
knownhosts - sets the known hosts file to use to validate the identity of the remote host, this must be a SSH2 format file; defaults to ${user .home}/.ssh/known_hosts
Throws:
Exception - if failed to copy file(s)

scpTo

void scpTo(String file,
           AQFileSet fileset,
           Object todir,
           String host,
           Object username,
           Object password,
           Object keyfile,
           Object passphrase,
           Boolean trust,
           String knownhosts)
           throws Exception
Copies file(s) from the local machine to a remote machine running an SSH daemon

Parameters:
file - The file(s) to copy to the remote machine, either this or fileset should be set.
fileset - The set of files to be copied from the local machine to the remote machine, either this or file should be set.
todir - The directory on the remote machine where file(s) to be saved
host - the hostname or IP address of the remote machine to which you wish to connect; a port number can optionally follow the host, separated by a colon
username - the username on the remote host to which you are connecting
password - the login password to use on the remote machine, can be omitted if you specify the keyfile parameter
keyfile - location of the file holding the private key, can be omitted if you specify the password parameter
passphrase - passphrase for your private key, defaults to an empty string if keyfile is specified
trust - trusts all unknown hosts if set to true, defaults to false
knownhosts - sets the known hosts file to use to validate the identity of the remote host, this must be a SSH2 format file; defaults to ${user .home}/.ssh/known_hosts
Throws:
Exception - if failed to copy file(s)

sftpFrom

void sftpFrom(String file,
              String todir,
              String host,
              Object username,
              Object password,
              String keyfile,
              Object passphrase,
              Boolean trust,
              String knownhosts)
              throws Exception
Copies file(s) from a remote machine running an SSH daemon to the local machine.

Parameters:
file - The file(s) to copy from the remote machine.
todir - The directory on the local machine where file(s) to be saved.
host - the hostname or IP address of the remote machine to which you wish to connect; a port number can optionally follow the host, separated by a colon
username - the username on the remote machine to which you are connecting
password - the login password to use on the remote machine, can be omitted if you specify the keyfile parameter
keyfile - location of the file holding the private key, can be omitted if you specify the password parameter
passphrase - passphrase for your private key, defaults to an empty string if keyfile is specified
trust - trusts all unknown hosts if set to true, defaults to false
knownhosts - sets the known hosts file to use to validate the identity of the remote host, this must be a SSH2 format file; defaults to ${user .home}/.ssh/known_hosts
Throws:
Exception - if failed to copy file(s)

sftpTo

void sftpTo(String file,
            AQFileSet fileset,
            String todir,
            String host,
            Object username,
            Object password,
            String keyfile,
            Object passphrase,
            Boolean trust,
            String knownhosts)
            throws Exception
Copies file(s) from the local machine to a remote machine running an SSH daemon

Parameters:
file - The file(s) to copy to the remote machine, either this or fileset should be set.
fileset - The set of files to be copied from the local machine to the remote machine, either this or file should be set.
todir - The directory on the remote machine where file(s) to be saved
host - the hostname or IP address of the remote machine to which you wish to connect; a port number can optionally follow the host, separated by a colon
username - the username on the remote host to which you are connecting
password - the login password to use on the remote machine, can be omitted if you specify the keyfile parameter
keyfile - location of the file holding the private key, can be omitted if you specify the password parameter
passphrase - passphrase for your private key, defaults to an empty string if keyfile is specified
trust - trusts all unknown hosts if set to true, defaults to false
knownhosts - sets the known hosts file to use to validate the identity of the remote host, this must be a SSH2 format file; defaults to ${user .home}/.ssh/known_hosts
Throws:
Exception - if failed to copy file(s)

sshexec

void sshexec(String command,
             String commandFile,
             String host,
             Object username,
             Object password,
             String output,
             Boolean trust,
             Integer timeout,
             String knownhosts)
             throws Exception
Executes a command on a remote machine via SSH using password based authentication.

Parameters:
command - the command to run on the remote host, either this or commandFile must be set
commandFile - the file that contains the commands to run on the remote host, either this or command must be set
host - the hostname or IP address of the remote host to which you wish to connect
username - the username on the remote host to which you are connecting
password - the login password to use on the remote host
output - name of the file to which to write the output, defaults to an empty string
trust - trusts all unknown hosts if set to true, defaults to false
timeout - stop the command if it doesn't finish within the specified time, in milliseconds; defaults to 0 which means 'wait forever'
knownhosts - sets the known hosts file to use to validate the identity of the remote host, this must be a SSH2 format file; defaults to ${user .home}/.ssh/known_hosts
Throws:
Exception - if failed to execute command remotely

sshexec

void sshexec(String command,
             String commandFile,
             boolean trust,
             String host,
             Object username,
             String keyfile,
             String output,
             Object passphrase,
             Integer timeout,
             String knownhosts)
             throws Exception
Executes a command on a remote machine via SSH using key based authentication.

Parameters:
command - the command to run on the remote host, either this or commandFile must be set
commandFile - the file that contains the commands to run on the remote host, either this or command must be set
trust - trusts all unknown hosts if set to true
host - the hostname or IP address of the remote host to which you wish to connect
username - the username on the remote host to which you are connecting
keyfile - location of the file holding the private key
output - name of the file to which to write the output, defaults to an empty string
passphrase - passphrase for your private key, defaults to an empty string
timeout - stop the command if it doesn't finish within the specified time, in milliseconds; defaults to 0 which means 'wait forever'
knownhosts - sets the known hosts file to use to validate the identity of the remote host, this must be a SSH2 format file; defaults to ${user .home}/.ssh/known_hosts
Throws:
Exception - if failed to execute command remotely

get

void get(String url,
         String dest)
         throws Exception
Gets a file from a URL source.

Parameters:
url - The URL to get; required.
dest - The fully qualified name or name of the file to be saved; required.
Throws:
Exception - If unable to retrieve the URL source, or if unable to write to file specified.

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.