|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.io.Signature
public class Signature
Field Summary | |
---|---|
static String |
REVISION
|
Constructor Summary | |
---|---|
Signature()
Creates a new empty Signature |
|
Signature(Signature signature)
Creates a new Signature |
|
Signature(String name,
String urid,
String type,
Date date)
Creates a new Signature |
Method Summary | |
---|---|
void |
add(Signature signature)
Put all the map entry of a given signature to this signature |
int |
compareTo(Object obj)
|
static TreeSet<SignatureDiffEntry> |
diff(File baseFile,
File sourceFile)
Perform a diff between 2 signatures files |
static TreeSet<SignatureDiffEntry> |
diff(Signature base,
Signature source)
Perform a diff between 2 signatures |
static TreeSet<SignatureDiff3Entry> |
diff3(File baseFile,
File sourceFile,
File targetFile)
Perform a diff between 3 signatures files |
static TreeSet<SignatureDiff3Entry> |
diff3(Signature base,
Signature source,
Signature target)
Perform a diff3 between 3 signatures |
static boolean |
diff3SetIsConflict(Set<SignatureDiff3Entry> diff3Set)
Tests whether the given diff3Set contains at least one conflict. |
static Signature |
generate(File dirToSign,
String name,
String urid,
String type,
String regexp)
Generates a new Signature from a given directory |
Date |
getDate()
Get the value of date. |
File |
getFile()
Get the value of file. |
static String |
getLineDelimiterIgnoredFileExtensions()
Retrieve the file extensions used to know which files must have their line delimiters ignored during signing. |
TreeMap<String,String> |
getMap()
Get the value of map. |
String |
getName()
Get the value of name. |
String |
getType()
Get the value of type. |
String |
getUrid()
Get the value of urid. |
static boolean |
ignoreLineDelimiter(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(File file)
Read a signature file and return a map |
static Signature |
read(File file,
boolean readMap)
|
void |
setDate(Date v)
Set the value of date. |
void |
setFile(File v)
Set the value of file. |
static void |
setLineDelimiterIgnoredFileExtensions(String extensions)
Change the current file extensions used to know which files must have their line delimiters ignored during signing. |
void |
setMap(TreeMap<String,String> v)
Set the value of map. |
void |
setName(String v)
Set the value of name. |
void |
setType(String v)
Set the value of type. |
void |
setUrid(String v)
Set the value of urid. |
static String |
signFile(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 String |
signFile(File file,
boolean ignoreLineDelimiter)
Sign a File and return the signature. |
static void |
signFiles(Map<String,String> map,
File file,
int prefixLength)
Fill a Map with key = the relative file and Value, the signed value |
static void |
signFiles(Map<String,String> map,
File file,
int prefixLength,
String regexp)
Fill a Map with key = the relative file and Value, the signed value |
String |
toString()
|
void |
write(File file)
Write the signature map into a file |
void |
write(OutputStream out)
Write the signature map into a stream |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public Signature()
public Signature(String name, String urid, String type, 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 cloneMethod Detail |
---|
public static Signature generate(File dirToSign, String name, String urid, String type, 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 excluded
org.apache.oro.text.regex.MalformedPatternException
- if the specified regexp could not be compiledpublic static Signature read(File file)
file
- the file where to read signature
public static Signature read(File file, boolean readMap)
public void write(File file) throws IOException
file
- the file where to write signature
IOException
- if an output stream to the specified file could not be createdpublic void write(OutputStream out)
out
- the OutputStreampublic static TreeSet<SignatureDiffEntry> diff(Signature base, Signature source)
base
- the base (i.e. common) signaturessource
- the signature to get the file from
public static TreeSet<SignatureDiffEntry> diff(File baseFile, File sourceFile)
baseFile
- the file for the base (i.e. common) signaturessourceFile
- the file for the signature to get the file from
public static 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 with
public static TreeSet<SignatureDiff3Entry> diff3(File baseFile, File sourceFile, 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 with
public static boolean diff3SetIsConflict(Set<SignatureDiff3Entry> diff3Set)
diff3Set
- the diff3Set to test
public static void signFiles(Map<String,String> map, 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(Map<String,String> map, File file, int prefixLength, 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 excluded
org.apache.oro.text.regex.MalformedPatternException
- if the specified regexp could not be compiledpublic static void setLineDelimiterIgnoredFileExtensions(String extensions)
extensions
- a space/coma seperated string of extension, e.g "jsp xml txt html"public static String getLineDelimiterIgnoredFileExtensions()
public static boolean ignoreLineDelimiter(File file)
file
- the file to sign
public static String signFile(File file)
ignoreLineDelimiter(File)
.
file
- the file to sign
public static String signFile(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 String toString()
toString
in class Object
public int compareTo(Object obj)
compareTo
in interface Comparable
public String getName()
public void setName(String v)
v
- Value to assign to name.public String getUrid()
public void setUrid(String v)
v
- Value to assign to urid.public Date getDate()
public void setDate(Date v)
v
- Value to assign to date.public File getFile()
public void setFile(File v)
v
- Value to assign to file.public String getType()
public void setType(String v)
v
- Value to assign to type.public TreeMap<String,String> getMap()
public void setMap(TreeMap<String,String> v)
v
- Value to assign to map.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |