|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.plugin.PluginHelper
public class PluginHelper
Une classe pour mutualiser toutes les méthodes utiles pour un plugin.
| Field Summary | |
|---|---|
protected static double[] |
memoryFactors
|
protected static java.lang.String[] |
memoryUnites
|
static java.lang.String |
SNAPSHOT_SUFFIX
|
protected static double[] |
timeFactors
|
protected static java.lang.String[] |
timeUnites
|
| Constructor Summary | |
|---|---|
PluginHelper()
|
|
| Method Summary | ||
|---|---|---|
static boolean |
addResourceDir(java.io.File dir,
org.apache.maven.project.MavenProject project,
java.util.List<?> resources,
java.lang.String... includes)
Add the directory as a resource in the given resource list. |
|
static boolean |
addResourceDir(java.io.File dir,
org.apache.maven.project.MavenProject project,
java.lang.String... includes)
Add the directory as a resource of the given project. |
|
static boolean |
addResourceDir(java.lang.String newresourceDir,
org.apache.maven.project.MavenProject project)
Deprecated. since 1.1.1, prefer use the addResourceDir(java.io.File, org.apache.maven.project.MavenProject, String...) |
|
static boolean |
addResourceDir(java.lang.String newresourceDir,
org.apache.maven.project.MavenProject project,
java.util.List<?> resources)
Deprecated. since 1.1.1, prefer use the addResourceDir(java.io.File, org.apache.maven.project.MavenProject, java.util.List, String...) |
|
static boolean |
addTestResourceDir(java.io.File dir,
org.apache.maven.project.MavenProject project,
java.lang.String... includes)
Add thedirectory as a test resource of the given project. |
|
static boolean |
addTestResourceDir(java.lang.String newresourceDir,
org.apache.maven.project.MavenProject project)
Deprecated. since 1.1.1, prefer use the addTestResourceDir(java.io.File, org.apache.maven.project.MavenProject, String...) |
|
static java.lang.String |
convert(long value,
double[] factors,
java.lang.String[] unites)
|
|
static java.lang.String |
convertMemory(long value)
|
|
static java.lang.String |
convertTime(long value)
|
|
static java.lang.String |
convertTime(long value,
long value2)
|
|
static void |
copy(java.io.File source,
java.io.File target)
Permet de copier le fichier source vers le fichier cible. |
|
static void |
copyFiles(java.io.File src,
java.io.File dst,
java.lang.String[] includes,
java.lang.String[] excludes,
boolean overwrite)
|
|
static void |
copyFiles(PluginIOContext p,
java.lang.String[] includes,
java.lang.String[] excludes,
boolean overwrite)
|
|
static boolean |
createDirectoryIfNecessary(java.io.File dir)
Cretae the directory (and his parents) if necessary. |
|
static void |
createNewFile(java.io.File file)
Create the given file. |
|
static void |
deleteFile(java.io.File file)
Delete the given file. |
|
static void |
expandFile(java.io.File src,
java.io.File dst,
java.lang.String[] includes,
boolean overwrite)
|
|
static void |
expandFiles(PluginIOContext p,
java.lang.String[] includes,
java.lang.String[] excludes,
java.lang.String[] zipIncludes,
boolean overwrite)
|
|
static java.util.SortedSet<java.lang.String> |
getEmptyKeys(java.util.Map<?,?> map)
Obtenir les clefs de toutes les valeurs nulles ou vide a partir d'un dictionnaire donne. |
|
static java.io.File |
getFile(java.io.File base,
java.lang.String... paths)
|
|
static java.util.List<java.io.File> |
getIncludedFiles(java.io.File dir,
java.lang.String[] includes,
java.lang.String[] excludes)
|
|
static java.lang.String[] |
getLines(java.io.File src)
|
|
static java.io.File[] |
getLinesAsFiles(java.io.File src)
|
|
static java.lang.String |
getRelativePath(java.io.File base,
java.io.File file)
|
|
static java.lang.String |
prefixLines(java.lang.String prefix,
java.lang.String prefixForEmpty,
java.lang.String content)
Prefix the lines of the given content with a given prefix. |
|
static java.lang.String |
readAsString(java.io.File file,
java.lang.String encoding)
Permet de lire un fichier et de retourner sont contenu sous forme d'une chaine de carateres |
|
static java.lang.String |
readAsString(java.io.Reader reader)
Permet de lire un fichier et de retourner sont contenu sous forme d'une chaine de carateres |
|
static java.lang.String |
removeSnapshotSuffix(java.lang.String versionId)
|
|
static void |
renameFile(java.io.File file,
java.io.File destination)
Rename the given file to a new destination. |
|
static java.lang.String[] |
splitAndTrim(java.lang.String txt,
java.lang.String separator)
Split the given text using the separator and trim
each part of result. |
|
static
|
toGenericList(java.util.List<?> list,
java.lang.Class<O> type)
Permet de convertir une liste non typee, en une liste typee. |
|
static void |
writeString(java.io.File file,
java.lang.String content,
java.lang.String encoding)
Sauvegarde un contenu dans un fichier. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SNAPSHOT_SUFFIX
protected static final double[] timeFactors
protected static final java.lang.String[] timeUnites
protected static final double[] memoryFactors
protected static final java.lang.String[] memoryUnites
| Constructor Detail |
|---|
public PluginHelper()
| Method Detail |
|---|
public static java.lang.String removeSnapshotSuffix(java.lang.String versionId)
public static <O> java.util.List<O> toGenericList(java.util.List<?> list,
java.lang.Class<O> type)
throws java.lang.IllegalArgumentException
O - le type des objets de la listelist - la liste a convertirtype - le type des elements de la liste
java.lang.IllegalArgumentException - si un element de la liste en entree n'est
pas en adequation avec le type voulue.public static java.lang.String convertMemory(long value)
public static java.lang.String convertTime(long value)
public static java.lang.String convertTime(long value,
long value2)
public static java.lang.String convert(long value,
double[] factors,
java.lang.String[] unites)
public static java.lang.String[] splitAndTrim(java.lang.String txt,
java.lang.String separator)
text using the separator and trim
each part of result.
txt - text to splitseparator - the split separator
public static java.lang.String prefixLines(java.lang.String prefix,
java.lang.String prefixForEmpty,
java.lang.String content)
throws java.io.IOException
prefix - prefix to add on each line of textprefixForEmpty - prefix to add for empty linescontent - the text to treate
java.io.IOException - if any reading problempublic static java.util.SortedSet<java.lang.String> getEmptyKeys(java.util.Map<?,?> map)
map - le dictionner a parcourir
public static boolean addResourceDir(java.io.File dir,
org.apache.maven.project.MavenProject project,
java.lang.String... includes)
dir - the directory to addproject - the project to updateincludes - the includes of the resource
true if the resources was added (not already existing)
public static boolean addTestResourceDir(java.io.File dir,
org.apache.maven.project.MavenProject project,
java.lang.String... includes)
dir - the directory to addproject - the project to updateincludes - the includes of the resource
true if the resources was added (not already existing)
public static boolean addResourceDir(java.io.File dir,
org.apache.maven.project.MavenProject project,
java.util.List<?> resources,
java.lang.String... includes)
dir - the directory to addproject - the project involvedresources - the list of existing resourcesincludes - includes of the new resources
true if the resource was added (not already existing)
@Deprecated
public static boolean addResourceDir(java.lang.String newresourceDir,
org.apache.maven.project.MavenProject project)
addResourceDir(java.io.File, org.apache.maven.project.MavenProject, String...)
newresourceDir - the new resource directory to addproject - the maven project to modifiy
true if resources was added
@Deprecated
public static boolean addTestResourceDir(java.lang.String newresourceDir,
org.apache.maven.project.MavenProject project)
addTestResourceDir(java.io.File, org.apache.maven.project.MavenProject, String...)
newresourceDir - the new resource directory to addproject - the maven project to modifiy
true if resources was added
@Deprecated
public static boolean addResourceDir(java.lang.String newresourceDir,
org.apache.maven.project.MavenProject project,
java.util.List<?> resources)
addResourceDir(java.io.File, org.apache.maven.project.MavenProject, java.util.List, String...)
newresourceDir - the new resource directory to addproject - the maven project to modifiyresources - the known resources for the maven project
true if resources was added
public static boolean createDirectoryIfNecessary(java.io.File dir)
throws java.io.IOException
dir - the directory to create if not exisiting
true if directory was created, false if was no need to create it
java.io.IOException - if could not create directory
public static void createNewFile(java.io.File file)
throws java.io.IOException
file - the file to create
java.io.IOException - if could not create the file
public static void deleteFile(java.io.File file)
throws java.io.IOException
file - the file to delete
java.io.IOException - if could not delete the file
public static void renameFile(java.io.File file,
java.io.File destination)
throws java.io.IOException
file - the file to renamedestination - the destination file
java.io.IOException - if could not rename the file
public static void copy(java.io.File source,
java.io.File target)
throws java.io.IOException
source - le fichier sourcetarget - le fichier cible
java.io.IOException - Erreur de copie
public static java.lang.String readAsString(java.io.File file,
java.lang.String encoding)
throws java.io.IOException
file - le fichier a lireencoding - encoding to read file
java.io.IOException - if IO pb
public static java.lang.String readAsString(java.io.Reader reader)
throws java.io.IOException
reader - la source alire
java.io.IOException - if IO pb
public static void writeString(java.io.File file,
java.lang.String content,
java.lang.String encoding)
throws java.io.IOException
file - le fichier a ecrirecontent - le contenu du fichierencoding - l'encoding d'ecriture
java.io.IOException - if IO pb
public static java.util.List<java.io.File> getIncludedFiles(java.io.File dir,
java.lang.String[] includes,
java.lang.String[] excludes)
public static void copyFiles(java.io.File src,
java.io.File dst,
java.lang.String[] includes,
java.lang.String[] excludes,
boolean overwrite)
throws java.io.IOException
java.io.IOException
public static void copyFiles(PluginIOContext p,
java.lang.String[] includes,
java.lang.String[] excludes,
boolean overwrite)
throws java.io.IOException
java.io.IOException
public static void expandFiles(PluginIOContext p,
java.lang.String[] includes,
java.lang.String[] excludes,
java.lang.String[] zipIncludes,
boolean overwrite)
throws java.io.IOException
java.io.IOException
public static java.io.File getFile(java.io.File base,
java.lang.String... paths)
public static java.lang.String getRelativePath(java.io.File base,
java.io.File file)
public static void expandFile(java.io.File src,
java.io.File dst,
java.lang.String[] includes,
boolean overwrite)
throws java.io.IOException
java.io.IOException
public static java.lang.String[] getLines(java.io.File src)
throws java.io.IOException
src - the source file to read
java.io.IOException - if any pb while reading file
public static java.io.File[] getLinesAsFiles(java.io.File src)
throws java.io.IOException
src - the source file to read
java.io.IOException - if any pb while reading file
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||