com.alarexgroup.m2mplf.clients
Class FTPClient

java.lang.Object
  extended by com.alarexgroup.m2mplf.clients.FTPClient
public class FTPClient
extends java.lang.Object

Constructor Summary
FTPClient(java.lang.String url, int port, java.lang.String connectionProfile)
          Creates FTP instance - ready to use.
 
Method Summary
 boolean append(java.lang.String name, byte[] data)
          Appends file's data on FTP server.
 void close()
          Finishes work with FTP
 boolean delete(java.lang.String name)
          Ereases data on FTP server
 boolean loginFTP(java.lang.String user, java.lang.String passw)
          Login to FTP server by name and password.
 boolean logout()
          FTP server logout
 byte[] retrieve(java.lang.String name)
          Retrieves file form FTP server.
 boolean retrieve(java.lang.String ftpFileName, java.lang.String fileName)
          Retrieves file form FTP server and stores it into flash memory.
 boolean setFileType(java.lang.String type)
          Kind of relaid file.
 boolean store(java.lang.String name, byte[] data)
          File store - on FTP server.
 boolean store(java.lang.String name, java.lang.String filename)
          Stores file from flash module's memory to FTP server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FTPClient

public FTPClient(java.lang.String url,
                 int port,
                 java.lang.String connectionProfile)
Creates FTP instance - ready to use.

Parameters:
url - FTP server address. This address musn't have prefix FTP://, can have only server address or IP address.
port - - port number, mostly 21 - in the case of standard setting.
connectionProfile - - GPRS connection profile
Method Detail

close

public void close()
Finishes work with FTP

loginFTP

public boolean loginFTP(java.lang.String user,
                        java.lang.String passw)
Login to FTP server by name and password. FTPClient doesn't support anonymous login.

Parameters:
user -
passw -
Returns:
True - login was successful. False - unsuccessful login. Next information in log. file.

setFileType

public boolean setFileType(java.lang.String type)
Kind of relaid file. Before store or retrieve command is possible to set kind of relaid file

Parameters:
type - A - ascii I - binary
Returns:
True - successful command False -failed command

logout

public boolean logout()
FTP server logout

Returns:
True successful logout

store

public boolean store(java.lang.String name,
                     byte[] data)
File store - on FTP server.

Parameters:
name - Name of file to store. This name can include the path, i.e. subfolder1/subfolder2/fileName
data - Content of file to store
Returns:
True - Successfully stored False - It is not possible to store data , details in log. file.

append

public boolean append(java.lang.String name,
                      byte[] data)
Appends file's data on FTP server.

Parameters:
name - Name of file to append. This name can include the path, i.e. subfolder1/subfolder2/fileName
data - Content of file to append.
Returns:
True - Successfully appended False - It is not possible to append data, details in log. file.

store

public boolean store(java.lang.String name,
                     java.lang.String filename)
Stores file from flash module's memory to FTP server.

Parameters:
name - path and name of file to store on FTP server
filename - path and name of file - in flash memory's module i.e. a:/myFile.txt
Returns:
True - Successfully stored False - It is not possible to store data , details in log. file.

retrieve

public byte[] retrieve(java.lang.String name)
Retrieves file form FTP server.

Parameters:
name - file name - path can be included
Returns:
True - Successfully retrieved False - It is not possible to retrieve data , details in log. file.

retrieve

public boolean retrieve(java.lang.String ftpFileName,
                        java.lang.String fileName)
Retrieves file form FTP server and stores it into flash memory.

Parameters:
ftpFileName - path and file name - on FTP server
fileName - path and name of file in flash memory's module
Returns:
True - Successfully stored False - It is not possible to store data , details in log. file.

delete

public boolean delete(java.lang.String name)
Ereases data on FTP server

Parameters:
name - of file to be erase
Returns:
True Successful erasing