Administration Tools

org.topcased.service.updatesite
Class FilesTreatment

java.lang.Object
  extended by org.topcased.service.updatesite.FilesTreatment

public class FilesTreatment
extends java.lang.Object

This class groups some files treatments. They are used in the different WizardPages


Field Summary
static int FEATURE_PROPERTIES
          Define the file type as feature.properties
static int FEATURE_XML
          Define the file type as feature.xml
static int MANIFEST
          Define the file type as MANIFEST.MF
static int PLUGIN_PROPERTIES
          Define the file type as plugin.properties
static int PLUGIN_XML
          Define the file type as plugin.xml
 
Constructor Summary
FilesTreatment()
           
 
Method Summary
static java.lang.String analyzeString(java.lang.String property, java.io.File pathFileProperty)
          Analyze String.
static void autoState(SourceDestination srcDst)
          Gives automaticaly the state of the file taking its source and destination
static boolean copyFileFromFTP(java.lang.String parentPath, java.lang.String pathDestination, org.eclipse.ftp.IDirectoryEntry file, org.eclipse.ftp.internal.FTPClient clientFTP, org.eclipse.core.runtime.IProgressMonitor monitor)
           
static void copyFileToFTP(java.lang.String pathFile, java.lang.String pathDest, org.eclipse.ftp.internal.FTPClient clientFTP)
          Copy the given file into the remote FTP server
static boolean copyPluginFeatureFromFTP(java.lang.String parentPath, java.lang.String pathDestination, org.eclipse.ftp.IDirectoryEntry file, org.eclipse.ftp.internal.FTPClient clientFTP, org.eclipse.core.runtime.IProgressMonitor monitor)
          Copy the given file into the pathDestination, from a FTP server to local destination
static void copyPluginFeatureFromSFTP(SftpFile file, java.lang.String pathDest, SftpClient clientSFTP)
          CreateSiteUpdateSiteWizardTreatment
static java.io.File createTempFileFromJar(java.io.File pathFile, java.lang.String tempName, int fileType)
          Create 'tempName' file XML/properties which is the 'feature.xml'/'plugin.xml'/'feature.properties'/'plugin.properties' from the jarFile(pathFile)
static boolean emptyFile(java.io.File file)
          Empty the given file If the file is a directory, all the file which it contains are emptied
static void emptyFileFTP(org.eclipse.ftp.internal.FTPClient clientFTP, org.eclipse.ftp.internal.FTPDirectoryEntry file, java.lang.String path)
          Empty the given FTP file If the file is a directory, all the file which it contains are emptied
static void emptyFilesFromMap(java.util.Map map)
          Empty all files referenced by the given map Not empty the files which are still installed
static void emptyFilesFTPFromMap(org.eclipse.ftp.internal.FTPClient clientFTP, java.util.Map map, java.lang.String path)
          Empty all files referenced by the given map Not empty the files which are still installed
static void emptyFilesSSHFromMap(SftpClient clientSFTP, java.util.Map map, java.lang.String path)
          Empty all files referenced by the given map Not empty the files which are still installed
static long getFileLength(java.io.File file)
           
static long getFileLengthFTP(org.eclipse.ftp.internal.FTPClient clientFTP, org.eclipse.ftp.IDirectoryEntry file, java.lang.String path)
           
static long getFileLengthSSH(SftpFile file, SftpClient clientSFTP)
           
static java.lang.String getFileWithVersionFromNoVersion(java.lang.String path)
          Search a file with the same name and an other version ( like name_X.Y.Z) and return the path of this file
static boolean isFileExists(java.lang.String path)
          Search if the file exists at the path given in parameter
static boolean isFileExistsWithoutVersion(java.lang.String path)
          Search if the file given exists without any special version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEATURE_XML

public static final int FEATURE_XML
Define the file type as feature.xml

See Also:
Constant Field Values

PLUGIN_XML

public static final int PLUGIN_XML
Define the file type as plugin.xml

See Also:
Constant Field Values

FEATURE_PROPERTIES

public static final int FEATURE_PROPERTIES
Define the file type as feature.properties

See Also:
Constant Field Values

PLUGIN_PROPERTIES

public static final int PLUGIN_PROPERTIES
Define the file type as plugin.properties

See Also:
Constant Field Values

MANIFEST

public static final int MANIFEST
Define the file type as MANIFEST.MF

See Also:
Constant Field Values
Constructor Detail

FilesTreatment

public FilesTreatment()
Method Detail

createTempFileFromJar

public static java.io.File createTempFileFromJar(java.io.File pathFile,
                                                 java.lang.String tempName,
                                                 int fileType)
                                          throws java.io.FileNotFoundException,
                                                 java.io.IOException
Create 'tempName' file XML/properties which is the 'feature.xml'/'plugin.xml'/'feature.properties'/'plugin.properties' from the jarFile(pathFile)

Parameters:
pathFile - : jarFile
tempName - : name of the temporaty 'feature.xml'/'plugin.xml'/'feature.properties'/'plugin.properties'
fileType - : identify the type of file which must be read : FEATURE_XML/PLUGIN_XML/FEATURE_PROPERTIES/PLUGIN_PROPERTIES
Returns:
fileToParse or null if the file do not exist
Throws:
java.io.IOException
java.io.FileNotFoundException

autoState

public static void autoState(SourceDestination srcDst)
Gives automaticaly the state of the file taking its source and destination

Parameters:
srcDst - the SourceDestination of the file

isFileExists

public static boolean isFileExists(java.lang.String path)
Search if the file exists at the path given in parameter

Parameters:
path - of the file (directory or jar file)
Returns:
boolean true if the file exists at the path, false otherwise

analyzeString

public static java.lang.String analyzeString(java.lang.String property,
                                             java.io.File pathFileProperty)
                                      throws java.io.IOException
Analyze String. If the String begin with '%', the string returned is the corresponding value define in pathFileProperty else it is the String itself

Parameters:
property -
pathFileProperty -
Returns:
String
Throws:
java.io.IOException

isFileExistsWithoutVersion

public static boolean isFileExistsWithoutVersion(java.lang.String path)
Search if the file given exists without any special version

Parameters:
path - of the file
Returns:
true if the file exists, false otherwise

getFileWithVersionFromNoVersion

public static java.lang.String getFileWithVersionFromNoVersion(java.lang.String path)
Search a file with the same name and an other version ( like name_X.Y.Z) and return the path of this file

Parameters:
path - of the file with or without version (name or name_X.Y.Z)
Returns:
the new path of a file with a version or null if any file exists

copyFileFromFTP

public static boolean copyFileFromFTP(java.lang.String parentPath,
                                      java.lang.String pathDestination,
                                      org.eclipse.ftp.IDirectoryEntry file,
                                      org.eclipse.ftp.internal.FTPClient clientFTP,
                                      org.eclipse.core.runtime.IProgressMonitor monitor)
Parameters:
parentPath -
pathDestination -
file -
clientFTP -
monitor -
Returns:

copyPluginFeatureFromFTP

public static boolean copyPluginFeatureFromFTP(java.lang.String parentPath,
                                               java.lang.String pathDestination,
                                               org.eclipse.ftp.IDirectoryEntry file,
                                               org.eclipse.ftp.internal.FTPClient clientFTP,
                                               org.eclipse.core.runtime.IProgressMonitor monitor)
                                        throws org.eclipse.ftp.FtpException,
                                               java.io.IOException
Copy the given file into the pathDestination, from a FTP server to local destination

Parameters:
parentPath - of the file
pathDestination - the destination path
file - the specified file
clientFTP - to remote FTP server
monitor - the progress monitor or null
Returns:
Throws:
org.eclipse.ftp.FtpException
java.io.IOException

emptyFile

public static boolean emptyFile(java.io.File file)
Empty the given file If the file is a directory, all the file which it contains are emptied

Parameters:
file - the specified file

emptyFileFTP

public static void emptyFileFTP(org.eclipse.ftp.internal.FTPClient clientFTP,
                                org.eclipse.ftp.internal.FTPDirectoryEntry file,
                                java.lang.String path)
Empty the given FTP file If the file is a directory, all the file which it contains are emptied

Parameters:
clientFTP -
file -
path -

copyFileToFTP

public static void copyFileToFTP(java.lang.String pathFile,
                                 java.lang.String pathDest,
                                 org.eclipse.ftp.internal.FTPClient clientFTP)
                          throws org.eclipse.ftp.FtpException
Copy the given file into the remote FTP server

Parameters:
pathFile - the file path to copy
pathDest - the destination of the file
clientFTP - the client of the FTP server
Throws:
org.eclipse.ftp.FtpException

copyPluginFeatureFromSFTP

public static void copyPluginFeatureFromSFTP(SftpFile file,
                                             java.lang.String pathDest,
                                             SftpClient clientSFTP)
                                      throws java.io.IOException
CreateSiteUpdateSiteWizardTreatment

Parameters:
file -
pathDest -
clientSFTP -
Throws:
java.io.IOException

emptyFilesFromMap

public static void emptyFilesFromMap(java.util.Map map)
Empty all files referenced by the given map Not empty the files which are still installed

Parameters:
map - containing SourceDestination with the stat attribut initialized

emptyFilesFTPFromMap

public static void emptyFilesFTPFromMap(org.eclipse.ftp.internal.FTPClient clientFTP,
                                        java.util.Map map,
                                        java.lang.String path)
Empty all files referenced by the given map Not empty the files which are still installed

Parameters:
map - containing SourceDestination with the stat attribut initialized

emptyFilesSSHFromMap

public static void emptyFilesSSHFromMap(SftpClient clientSFTP,
                                        java.util.Map map,
                                        java.lang.String path)
Empty all files referenced by the given map Not empty the files which are still installed

Parameters:
map - containing SourceDestination with the stat attribut initialized

getFileLength

public static long getFileLength(java.io.File file)

getFileLengthFTP

public static long getFileLengthFTP(org.eclipse.ftp.internal.FTPClient clientFTP,
                                    org.eclipse.ftp.IDirectoryEntry file,
                                    java.lang.String path)

getFileLengthSSH

public static long getFileLengthSSH(SftpFile file,
                                    SftpClient clientSFTP)

Administration Tools

Copyright (c) 2005 TOPCASED Contributors 2005 - 2007. All rights reserved.