public class Signature
extends java.lang.Object
implements java.lang.Comparable
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
REVISION |
| Constructor and Description |
|---|
Signature()
Creates a new empty Signature
|
Signature(Signature signature)
Creates a new Signature
|
Signature(java.lang.String name,
java.lang.String urid,
java.lang.String type,
java.util.Date date)
Creates a new Signature
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Signature signature)
Put all the map entry of a given signature to this signature
|
int |
compareTo(java.lang.Object obj) |
static java.util.TreeSet<SignatureDiffEntry> |
diff(java.io.File baseFile,
java.io.File sourceFile)
Perform a diff between 2 signatures files
|
static java.util.TreeSet<SignatureDiffEntry> |
diff(Signature base,
Signature source)
Perform a diff between 2 signatures
|
static java.util.TreeSet<SignatureDiff3Entry> |
diff3(java.io.File baseFile,
java.io.File sourceFile,
java.io.File targetFile)
Perform a diff between 3 signatures files
|
static java.util.TreeSet<SignatureDiff3Entry> |
diff3(Signature base,
Signature source,
Signature target)
Perform a diff3 between 3 signatures
|
static boolean |
diff3SetIsConflict(java.util.Set<SignatureDiff3Entry> diff3Set)
Tests whether the given diff3Set contains at least one conflict.
|
static Signature |
generate(java.io.File dirToSign,
java.lang.String name,
java.lang.String urid,
java.lang.String type,
java.lang.String regexp)
Generates a new Signature from a given directory
|
java.util.Date |
getDate()
Get the value of date.
|
java.io.File |
getFile()
Get the value of file.
|
static java.lang.String |
getLineDelimiterIgnoredFileExtensions()
Retrieve the file extensions used to know which files must have
their line delimiters ignored during signing.
|
java.util.TreeMap<java.lang.String,java.lang.String> |
getMap()
Get the value of map.
|
java.lang.String |
getName()
Get the value of name.
|
java.lang.String |
getType()
Get the value of type.
|
java.lang.String |
getUrid()
Get the value of urid.
|
static boolean |
ignoreLineDelimiter(java.io.File file)
Check if line delimiter of specified file should be ignored during creation
of its signature.
|
boolean |
isTypeBase() |
boolean |
isTypeSource() |
boolean |
isTypeTarget() |
static Signature |
read(java.io.File file)
Read a signature file and return a map
|
static Signature |
read(java.io.File file,
boolean readMap) |
void |
setDate(java.util.Date v)
Set the value of date.
|
void |
setFile(java.io.File v)
Set the value of file.
|
static void |
setLineDelimiterIgnoredFileExtensions(java.lang.String extensions)
Change the current file extensions used to know which files must have
their line delimiters ignored during signing.
|
void |
setMap(java.util.TreeMap<java.lang.String,java.lang.String> v)
Set the value of map.
|
void |
setName(java.lang.String v)
Set the value of name.
|
void |
setType(java.lang.String v)
Set the value of type.
|
void |
setUrid(java.lang.String v)
Set the value of urid.
|
static java.lang.String |
signFile(java.io.File file)
Sign a File and return the signature.
Line delimiter the specified file will be ignored depending on the value returned by ignoreLineDelimiter(File). |
static java.lang.String |
signFile(java.io.File file,
boolean ignoreLineDelimiter)
Sign a File and return the signature.
|
static void |
signFiles(java.util.Map<java.lang.String,java.lang.String> map,
java.io.File file,
int prefixLength)
Fill a Map with key = the relative file and Value, the signed value
|
static void |
signFiles(java.util.Map<java.lang.String,java.lang.String> map,
java.io.File file,
int prefixLength,
java.lang.String regexp)
Fill a Map with key = the relative file and Value, the signed value
|
java.lang.String |
toString() |
void |
write(java.io.File file)
Write the signature map into a file
|
void |
write(java.io.OutputStream out)
Write the signature map into a stream
|
public static final java.lang.String REVISION
public Signature()
public Signature(java.lang.String name,
java.lang.String urid,
java.lang.String type,
java.util.Date date)
name - the name of the webappurid - the urid of the webapptype - the type of signaturedate - the date of signaturepublic Signature(Signature signature)
signature - the signature to clonepublic static Signature generate(java.io.File dirToSign, java.lang.String name, java.lang.String urid, java.lang.String type, java.lang.String regexp) throws org.apache.oro.text.regex.MalformedPatternException
dirToSign - the directory to signname - the name of the webappurid - the urid of the webapptype - the type of signatureregexp - files matching this Perl5 regexp will be excludedorg.apache.oro.text.regex.MalformedPatternException - if the specified regexp could not be compiledpublic static Signature read(java.io.File file)
file - the file where to read signaturepublic static Signature read(java.io.File file, boolean readMap)
public void write(java.io.File file)
throws java.io.IOException
file - the file where to write signaturejava.io.IOException - if an output stream to the specified file could not be createdpublic void write(java.io.OutputStream out)
out - the OutputStreampublic static java.util.TreeSet<SignatureDiffEntry> diff(Signature base, Signature source)
base - the base (i.e. common) signaturessource - the signature to get the file frompublic static java.util.TreeSet<SignatureDiffEntry> diff(java.io.File baseFile, java.io.File sourceFile)
baseFile - the file for the base (i.e. common) signaturessourceFile - the file for the signature to get the file frompublic static java.util.TreeSet<SignatureDiff3Entry> diff3(Signature base, Signature source, Signature target)
base - the base (i.e. common) signaturessource - the signature to get the file fromtarget - the signature to merge withpublic static java.util.TreeSet<SignatureDiff3Entry> diff3(java.io.File baseFile, java.io.File sourceFile, java.io.File targetFile)
baseFile - the file for the base (i.e. common) signaturessourceFile - the file for the signature to get the file fromtargetFile - the file for the signature to merge withpublic static boolean diff3SetIsConflict(java.util.Set<SignatureDiff3Entry> diff3Set)
diff3Set - the diff3Set to testpublic static void signFiles(java.util.Map<java.lang.String,java.lang.String> map,
java.io.File file,
int prefixLength)
map - where to put all the File / Signaturefile - the first file to introspectprefixLength - the length of the prefix to removepublic static void signFiles(java.util.Map<java.lang.String,java.lang.String> map,
java.io.File file,
int prefixLength,
java.lang.String regexp)
throws org.apache.oro.text.regex.MalformedPatternException
map - where to put all the File / Signaturefile - the first file to introspectprefixLength - the length of the prefix to removeregexp - files matching this Perl5 regexp will be excludedorg.apache.oro.text.regex.MalformedPatternException - if the specified regexp could not be compiledpublic static void setLineDelimiterIgnoredFileExtensions(java.lang.String extensions)
extensions - a space/coma seperated string of extension, e.g "jsp xml txt html"public static java.lang.String getLineDelimiterIgnoredFileExtensions()
public static boolean ignoreLineDelimiter(java.io.File file)
file - the file to signpublic static java.lang.String signFile(java.io.File file)
ignoreLineDelimiter(File).file - the file to signpublic static java.lang.String signFile(java.io.File file,
boolean ignoreLineDelimiter)
file - the file to signignoreLineDelimiter - true to ignore line delimiter during signature,
false to sign file as is.
Signing is a bit longer when ignoring line delimiter.public void add(Signature signature)
signature - the signaturepublic boolean isTypeBase()
public boolean isTypeSource()
public boolean isTypeTarget()
public java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(java.lang.Object obj)
compareTo in interface java.lang.Comparablepublic java.lang.String getName()
public void setName(java.lang.String v)
v - Value to assign to name.public java.lang.String getUrid()
public void setUrid(java.lang.String v)
v - Value to assign to urid.public java.util.Date getDate()
public void setDate(java.util.Date v)
v - Value to assign to date.public java.io.File getFile()
public void setFile(java.io.File v)
v - Value to assign to file.public java.lang.String getType()
public void setType(java.lang.String v)
v - Value to assign to type.public java.util.TreeMap<java.lang.String,java.lang.String> getMap()
public void setMap(java.util.TreeMap<java.lang.String,java.lang.String> v)
v - Value to assign to map.Copyright © 2001-2017 Jalios SA. All Rights Reserved.