Package com.sun.identity.tools.manifest
Class FilesDigester
- java.lang.Object
-
- com.sun.identity.tools.manifest.FilesDigester
-
- All Implemented Interfaces:
ManifestConstants
public class FilesDigester extends Object implements ManifestConstants
-
-
Field Summary
Fields Modifier and Type Field Description protected LinkedListexcludePatternprotected LinkedListincludePatternprotected booleanrecursiveprotected charwildCard-
Fields inherited from interface com.sun.identity.tools.manifest.ManifestConstants
ALL_SUFFIX, BUFFER_SIZE, DEFAULT_DIGEST_HANDLEJAR, DEFAULT_DIGEST_HANDLEWAR, DEFAULT_IDENTIFIER_ENTRY, DEFAULT_MANIFEST_FILE_NAME, DEFAULT_MANIFEST_PATTERN, DEFAULT_OVERWRITE, DEFAULT_RECURSIVE, DEFAULT_VERBOSE, DEFAULT_WILD_CARD, DEFAULT_WILDCARD_CHAR, DELETE_SUFFIX, DEST_FILE_PATH, DIGEST_ALG, DIGEST_HANDLEJAR, DIGEST_HANDLEWAR, DRYRUN_OPTION, EQUAL, EXCLUDE_PATTERN, FILE_SEPARATOR, HEADER_FILE_PATH, IDENTIFIER_ENTRY, IDENTIFIER_SEPARATOR, INCLUDE_PATTERN, JAR_FILE_EXT, LATEST_WAR_FILE, MANIFEST_CREATE_FILE, MANIFEST_FILE_NAME, MANIFEST_NAME, MANIFEST_PATTERN, OVERWRITE, PATTERN_SEPARATOR, PROPERTIES_FILE, RECURSIVE, SHA1, SRC_FILE_PATH, VERBOSE_OPTION, VERSION_FILE, WAR_FILE_EXT, WILDCARD_CHAR
-
-
Constructor Summary
Constructors Constructor Description FilesDigester(LinkedList includePattern, LinkedList excludePattern, char wildCard, boolean recursive)FileDigester constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappendResult(Properties result, String path, byte[] digestedbyte)This function append the result to the StringBuffer.voiddigest(String hashAlg, File file, Properties digestResult, String ignoredPath, boolean intoJar, boolean intoWar)This function calculate the hash value of a file.protected byte[]digestJarFile(String hashAlg, InputStream in)This function calculate the hash value of a jar file.protected voiddigestWarFile(String hashAlg, Properties digestResult, JarFile wfile, boolean intoJar)This function calculate the hash value of a war file.
-
-
-
Field Detail
-
includePattern
protected LinkedList includePattern
-
excludePattern
protected LinkedList excludePattern
-
wildCard
protected char wildCard
-
recursive
protected boolean recursive
-
-
Constructor Detail
-
FilesDigester
public FilesDigester(LinkedList includePattern, LinkedList excludePattern, char wildCard, boolean recursive)
FileDigester constructor- Parameters:
includePattern- A list of patterns of file name should be included.excludePattern- A list of patterns of file name should be excluded.wildCard- The wildcard character which is used in the pattern.
-
-
Method Detail
-
digestWarFile
protected void digestWarFile(String hashAlg, Properties digestResult, JarFile wfile, boolean intoJar)
This function calculate the hash value of a war file. This function will calculate the manifest according to the decompressed files contained in the war file.- Parameters:
hashAlg- The algorithm to be used for calculating the hash.digestResult- The Properties to store the results.wfile- The war file to be processed.intoJar- The flat to indicate whether to handle jar file by using its decompressed contents.
-
digestJarFile
protected byte[] digestJarFile(String hashAlg, InputStream in)
This function calculate the hash value of a jar file. This function handles the jar file as a concatenation of the decompressed files it contains.- Parameters:
hashAlg- The algorithm to be used for calculating the hash.in- The InputStream of the jar file to be processed.
-
digest
public void digest(String hashAlg, File file, Properties digestResult, String ignoredPath, boolean intoJar, boolean intoWar)
This function calculate the hash value of a file.- Parameters:
hashAlg- The algorithm to be used for calculating the hash.file- The file to be processed.digestResult- The Properties to store the results.ignoredPath- The parent's path to ignore when printing the manifest entries.intoJar- The flag to indicate whether to specially handle jar file.intoWar- The flag to indicate whether to specially handle war file.
-
appendResult
protected void appendResult(Properties result, String path, byte[] digestedbyte)
This function append the result to the StringBuffer.- Parameters:
result- The properties to store the results.path- The path of the entry.digestedbyte- The byte array which contains the digested result.
-
-