Package com.jalios.io
Class Signature
java.lang.Object
com.jalios.io.Signature
- All Implemented Interfaces:
Comparable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidPut all the map entry of a given signature to this signatureintstatic TreeSet<SignatureDiffEntry> Perform a diff between 2 signaturesstatic TreeSet<SignatureDiffEntry> Perform a diff between 2 signatures filesstatic TreeSet<SignatureDiff3Entry> Perform a diff3 between 3 signaturesstatic TreeSet<SignatureDiff3Entry> Perform a diff between 3 signatures filesstatic booleandiff3SetIsConflict(Set<SignatureDiff3Entry> diff3Set) Tests whether the given diff3Set contains at least one conflict.static SignatureGenerates a new Signature from a given directorygetDate()Get the value of date.getFile()Get the value of file.static StringRetrieve the file extensions used to know which files must have their line delimiters ignored during signing.getMap()Get the value of map.getName()Get the value of name.getType()Get the value of type.getUrid()Get the value of urid.static booleanignoreLineDelimiter(File file) Check if line delimiter of specified file should be ignored during creation of its signature.booleanbooleanbooleanstatic SignatureRead a signature file and return a mapstatic SignaturevoidSet the value of date.voidSet the value of file.static voidsetLineDelimiterIgnoredFileExtensions(String extensions) Change the current file extensions used to know which files must have their line delimiters ignored during signing.voidSet the value of map.voidSet the value of name.voidSet the value of type.voidSet the value of urid.static StringSign a File and return the signature.
Line delimiter the specified file will be ignored depending on the value returned byignoreLineDelimiter(File).static StringSign a File and return the signature.static voidFill a Map with key = the relative file and Value, the signed valuestatic voidFill a Map with key = the relative file and Value, the signed valuetoString()voidWrite the signature map into a filevoidwrite(OutputStream out) Write the signature map into a stream
-
Constructor Details
-
Signature
public Signature()Creates a new empty Signature -
Signature
Creates a new Signature- Parameters:
name- the name of the webappurid- the urid of the webapptype- the type of signaturedate- the date of signature
-
Signature
Creates a new Signature- Parameters:
signature- the signature to clone
-
-
Method Details
-
generate
public static Signature generate(File dirToSign, String name, String urid, String type, String regexp) throws org.apache.oro.text.regex.MalformedPatternException Generates a new Signature from a given directory- Parameters:
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 excluded- Returns:
- the Signature of the specified directory
- Throws:
org.apache.oro.text.regex.MalformedPatternException- if the specified regexp could not be compiled
-
read
Read a signature file and return a map- Parameters:
file- the file where to read signature- Returns:
- a map(file,signature)
- Since:
- jcms-4.0.2
-
read
-
write
Write the signature map into a file- Parameters:
file- the file where to write signature- Throws:
IOException- if an output stream to the specified file could not be created- Since:
- jcms-4.0.2
-
write
Write the signature map into a stream- Parameters:
out- the OutputStream- Since:
- jcms-4.0.2
-
diff
Perform a diff between 2 signatures- Parameters:
base- the base (i.e. common) signaturessource- the signature to get the file from- Returns:
- TreeSet of SignatureDiffEntry
- Since:
- jcms-4.0.2
-
diff
Perform a diff between 2 signatures files- Parameters:
baseFile- the file for the base (i.e. common) signaturessourceFile- the file for the signature to get the file from- Returns:
- TreeSet of SignatureDiffEntry
- Since:
- jcms-4.0.2
-
diff3
public static TreeSet<SignatureDiff3Entry> diff3(Signature base, Signature source, Signature target) Perform a diff3 between 3 signatures- Parameters:
base- the base (i.e. common) signaturessource- the signature to get the file fromtarget- the signature to merge with- Returns:
- TreeSet of SignatureDiff3Entry
- Since:
- jcms-4.0.2
-
diff3
Perform a diff between 3 signatures files- Parameters:
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 with- Returns:
- TreeSet of SignatureDiff3Entry
- Since:
- jcms-4.0.2
-
diff3SetIsConflict
Tests whether the given diff3Set contains at least one conflict. I.E. diffEntry.isConflict().- Parameters:
diff3Set- the diff3Set to test- Returns:
- true if there is at least one conflict.
- Since:
- jcms-4.0.2
-
signFiles
Fill a Map with key = the relative file and Value, the signed value- Parameters:
map- where to put all the File / Signaturefile- the first file to introspectprefixLength- the length of the prefix to remove
-
signFiles
public static void signFiles(Map<String, String> map, File file, int prefixLength, String regexp) throws org.apache.oro.text.regex.MalformedPatternExceptionFill a Map with key = the relative file and Value, the signed value- Parameters:
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 excluded- Throws:
org.apache.oro.text.regex.MalformedPatternException- if the specified regexp could not be compiled
-
setLineDelimiterIgnoredFileExtensions
Change the current file extensions used to know which files must have their line delimiters ignored during signing.- Parameters:
extensions- a space/coma seperated string of extension, e.g "jsp xml txt html"
-
getLineDelimiterIgnoredFileExtensions
Retrieve the file extensions used to know which files must have their line delimiters ignored during signing.- Returns:
- extensions space seperated string of extension, e.g "jsp xml txt html"
-
ignoreLineDelimiter
Check if line delimiter of specified file should be ignored during creation of its signature.- Parameters:
file- the file to sign- Returns:
- true if line delimiter must be ignored, false otherwise.
-
signFile
Sign a File and return the signature.
Line delimiter the specified file will be ignored depending on the value returned byignoreLineDelimiter(File).- Parameters:
file- the file to sign- Returns:
- the signature of the file
-
signFile
Sign a File and return the signature.- Parameters:
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.- Returns:
- the signature of the file
-
add
Put all the map entry of a given signature to this signature- Parameters:
signature- the signature- Since:
- jcms-4.0.2
-
isTypeBase
public boolean isTypeBase() -
isTypeSource
public boolean isTypeSource() -
isTypeTarget
public boolean isTypeTarget() -
toString
-
compareTo
- Specified by:
compareToin interfaceComparable
-
getName
Get the value of name.- Returns:
- Value of name.
-
setName
Set the value of name.- Parameters:
v- Value to assign to name.
-
getUrid
Get the value of urid.- Returns:
- Value of urid.
-
setUrid
Set the value of urid.- Parameters:
v- Value to assign to urid.
-
getDate
Get the value of date.- Returns:
- Value of date.
-
setDate
Set the value of date.- Parameters:
v- Value to assign to date.
-
getFile
Get the value of file.- Returns:
- Value of file.
-
setFile
Set the value of file.- Parameters:
v- Value to assign to file.
-
getType
Get the value of type.- Returns:
- Value of type.
-
setType
Set the value of type.- Parameters:
v- Value to assign to type.
-
getMap
Get the value of map.- Returns:
- Value of map.
-
setMap
Set the value of map.- Parameters:
v- Value to assign to map.
-