|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.bibalex.daf.handlers.filehandler.FileHandler org.bibalex.daf.handlers.filehandler.FileHandlerFTPImpl
public class FileHandlerFTPImpl
Extends FileHandler to provide FTP file handling.
Field Summary | |
---|---|
private FTPFileHandler |
handler
A LocalFileHandler to create files and folders. |
Fields inherited from class org.bibalex.daf.handlers.filehandler.FileHandler |
---|
pathSeparator |
Constructor Summary | |
---|---|
FileHandlerFTPImpl(java.lang.String hostname,
java.lang.String username,
java.lang.String password,
int poolSize)
Creates a new instance of FileHandlerFTPImp. |
Method Summary | |
---|---|
static void |
AddObserver(java.util.Observer observer)
Static method allowing assigning some observers to the FTPFileHandler before object's initialization. |
boolean |
createFolder(java.lang.String parentFolder,
java.lang.String folderName)
Creates the given folder within the specified path at the server. |
boolean |
createPath(java.lang.String path)
Creates the complete path. |
boolean |
deleteFolder(java.lang.String path,
boolean recursive)
Deletes the folder and its subfolders from the server. |
boolean |
downloadFile(java.lang.String sourcePath,
java.lang.String fileName,
java.lang.String destinationPath,
java.lang.String newName)
Downloads the file from source to destination. |
boolean |
downloadFiles(java.lang.String source,
java.lang.String extention,
java.lang.String destination)
Downloads the files with the given extention from source, server, to destination, local file system. |
boolean |
downloadFolder(java.lang.String parentSource,
java.lang.String folderName,
java.lang.String parentDestination,
java.lang.String newName)
Downloads a folder from source, server, to destination, local file system. |
void |
finalize()
|
boolean |
folderExists(java.lang.String folderPath)
Determines whether the given folder exists or not. |
java.io.File[] |
getFiles(java.lang.String parentFolder)
Gets the files within the given folder at the server. |
java.io.File[] |
getFiles(java.lang.String parentFolder,
java.lang.String extention)
Gets the files with a specific extention within the given folder at the server. |
int |
getFilesCount(java.lang.String parentFolder)
Gets the count of files within the given folder at the server. |
int |
getFilesCount(java.lang.String parentFolder,
java.lang.String extention)
Gets the count of files with a specific extention within the given folder at the server. |
int |
getFilesCountRecursively(java.lang.String parentFolder)
Gets the total number of files within the folder. Note: The folder is visited recursively. |
long |
getFileSize(java.lang.String filePath)
Gets the size of the file in bytes. |
java.lang.String[] |
getFilesNames(java.lang.String parentFolder)
Gets the names of files within the given folder at the server. |
java.lang.String[] |
getFilesNames(java.lang.String parentFolder,
java.lang.String extention)
Gets the names of files with a specific extention within the given folder at the server. |
java.io.File[] |
getFilesRecursively(java.lang.String parentFolder)
Gets the files within the given folder at the server recursively. |
long |
getFolderSize(java.lang.String folderPath)
Gets the size of the folder, recursively, in bytes. |
java.lang.String[] |
getSubFolders(java.lang.String parentFolder)
Gets a list of subfolders within the given folder from the server. |
static void |
RemoveObservers()
Static method responsible for removing all the previously assigned observers. |
boolean |
rename(java.lang.String oldName,
java.lang.String newName)
This method is used to rename files or folders on an FTP Host. |
boolean |
uploadFile(java.lang.String sourcePath,
java.lang.String fileName,
java.lang.String destinationPath,
java.lang.String newName)
Downloads the file from source to destination. |
boolean |
uploadFiles(java.lang.String source,
java.lang.String extention,
java.lang.String destination)
Uploads the files with the given extention from source, local file system, to destination, server. |
boolean |
uploadFolder(java.lang.String parentSource,
java.lang.String folderName,
java.lang.String parentDestination,
java.lang.String newName)
Uploads a folder from source, local file system, to destination, server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private FTPFileHandler handler
Constructor Detail |
---|
public FileHandlerFTPImpl(java.lang.String hostname, java.lang.String username, java.lang.String password, int poolSize) throws java.lang.Exception
hostname
- The host name, i.e. the ftp server name.username
- The user name to log on to the server.password
- The password.poolSize
- The number of threads used to transfer files.
java.lang.Exception
- If the underlying FTPFileHandler couldn't be instantiated.Method Detail |
---|
public static void AddObserver(java.util.Observer observer)
observer
- the observer to be (pre-)added.public static void RemoveObservers()
public boolean createFolder(java.lang.String parentFolder, java.lang.String folderName)
createFolder
in class FileHandler
parentFolder
- The parnet folder at which the folder will be created.folderName
- the name of the folder.
public boolean downloadFolder(java.lang.String parentSource, java.lang.String folderName, java.lang.String parentDestination, java.lang.String newName)
downloadFolder
in class FileHandler
parentSource
- The source parent folder.folderName
- The name of the folder to copy.parentDestination
- The destination parent folder.newName
- The new name of the folder after copying.
public boolean uploadFolder(java.lang.String parentSource, java.lang.String folderName, java.lang.String parentDestination, java.lang.String newName)
uploadFolder
in class FileHandler
parentSource
- The source parent folder.folderName
- The name of the folder to copy.parentDestination
- The destination parent folder.newName
- The new name of the folder after copying.
public boolean downloadFiles(java.lang.String source, java.lang.String extention, java.lang.String destination)
downloadFiles
in class FileHandler
source
- The source folder that contain the files.extention
- The extension of the files to be copied.;destination
- The destination folder to which the files will be copied.
public boolean downloadFile(java.lang.String sourcePath, java.lang.String fileName, java.lang.String destinationPath, java.lang.String newName)
downloadFile
in class FileHandler
sourcePath
- The source folder taht contain the file.fileName
- The name of the file to download.destinationPath
- The destination folder to which the files will be copied.newName
- The new name of the file.
public boolean uploadFiles(java.lang.String source, java.lang.String extention, java.lang.String destination)
uploadFiles
in class FileHandler
source
- The source folder that contain the files.extention
- The extension of the files to be copied.;destination
- The destination folder to which the files will be copied.
public boolean uploadFile(java.lang.String sourcePath, java.lang.String fileName, java.lang.String destinationPath, java.lang.String newName)
uploadFile
in class FileHandler
sourcePath
- The source folder taht contain the file.fileName
- The name of the file to download.destinationPath
- The destination folder to which the files will be copied.newName
- The new name of the file.
public boolean deleteFolder(java.lang.String path, boolean recursive)
deleteFolder
in class FileHandler
path
- The path of the folder.recursive
- Whether to delete subfiles and subfolders or not. This parameter is not used.
public java.lang.String[] getSubFolders(java.lang.String parentFolder)
getSubFolders
in class FileHandler
parentFolder
- The folder to get its subfolders.
public java.io.File[] getFiles(java.lang.String parentFolder)
getFiles
in class FileHandler
parentFolder
- The folder to get the files within it.
public java.io.File[] getFilesRecursively(java.lang.String parentFolder)
getFilesRecursively
in class FileHandler
parentFolder
- The folder to get the files within it.
public java.io.File[] getFiles(java.lang.String parentFolder, java.lang.String extention)
getFiles
in class FileHandler
parentFolder
- The folder to get the files within it.extention
- The extention of the files to get.
public java.lang.String[] getFilesNames(java.lang.String parentFolder)
getFilesNames
in class FileHandler
parentFolder
- The folder to get the names of files within it.
public java.lang.String[] getFilesNames(java.lang.String parentFolder, java.lang.String extention)
getFilesNames
in class FileHandler
parentFolder
- The folder to get the names of files within it.extention
- The extention of the files to get.
public int getFilesCount(java.lang.String parentFolder)
getFilesCount
in class FileHandler
parentFolder
- The folder to get the count of files within it.
public int getFilesCount(java.lang.String parentFolder, java.lang.String extention)
getFilesCount
in class FileHandler
parentFolder
- The folder to get the count of files within it.extention
- The extention of the files to count.
public int getFilesCountRecursively(java.lang.String parentFolder)
getFilesCountRecursively
in class FileHandler
parentFolder
- The path of the folder to count its files.
public long getFolderSize(java.lang.String folderPath)
getFolderSize
in class FileHandler
folderPath
- The full path of the folder; that is folder path + folder name.
public long getFileSize(java.lang.String filePath)
getFileSize
in class FileHandler
filePath
- The full path of the file; that is folder path + file name + extension.
public boolean folderExists(java.lang.String folderPath)
folderExists
in class FileHandler
folderPath
- The path to the folder.
public boolean createPath(java.lang.String path)
createPath
in class FileHandler
path
- The path to create.
public void finalize()
finalize
in class java.lang.Object
Object.finalize()
public boolean rename(java.lang.String oldName, java.lang.String newName)
oldName
- the old name to replace.newName
- the new Name to use.
true
if the rename was successfull, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |