public class MessagesSourceCrawler extends Object
Constructor and Description |
---|
MessagesSourceCrawler(LogChannelInterface log,
List<String> sourceDirectories,
String singleMessagesFile,
List<SourceCrawlerXMLFolder> xmlFolders) |
Modifier and Type | Method and Description |
---|---|
void |
addKeyOccurrence(KeyOccurrence occ)
Add a key occurrence to the list of occurrences.
|
void |
crawl() |
void |
crawlSourceDirectories() |
protected void |
crawlXmlFolders() |
protected String |
getCompleteLine(BufferedReader reader,
String line,
List<String> splitLinePhrases) |
List<String> |
getFilesToAvoid() |
KeyOccurrence |
getKeyOccurrence(String key,
String selectedMessagesPackage) |
List<KeyOccurrence> |
getKeyOccurrences(String sourceFolder)
Get the unique package-key
|
List<String> |
getMessagesPackagesList(String sourceFolder) |
List<KeyOccurrence> |
getOccurrencesForPackage(String messagesPackage)
Get all the key occurrences for a certain messages package.
|
String[] |
getScanPhrases() |
String |
getSingleMessagesFile() |
List<String> |
getSourceDirectories() |
Map<String,Map<String,List<KeyOccurrence>>> |
getSourcePackageOccurrences() |
protected List<String> |
getSplitLinePhrases(String scanPhrase)
Returns all regex expressions to detect when the given scanPhrase is incomplete (existing over more than one
source line).
|
protected String |
getWhitespacesSanitizeRegex(String str)
Calculates a regex to identify the given text considering all possible
SPLIT_CHARACTERS can be
surrounded by whitespaces. |
void |
lookForOccurrencesInFile(String sourceFolder,
org.apache.commons.vfs2.FileObject javaFile)
Look for occurrences of keys in the specified file.
|
protected void |
lookForOccurrencesInLine(String sourceFolder,
org.apache.commons.vfs2.FileObject javaFile,
String messagesPackage,
int row,
String line)
Look for occurrences of keys in the specified line.
|
void |
setFilesToAvoid(List<String> filesToAvoid) |
void |
setScanPhrases(String[] scanPhrases) |
void |
setSingleMessagesFile(String singleMessagesFile) |
void |
setSourceDirectories(List<String> sourceDirectories) |
void |
setSourcePackageOccurrences(Map<String,Map<String,List<KeyOccurrence>>> sourcePackageOccurrences) |
public MessagesSourceCrawler(LogChannelInterface log, List<String> sourceDirectories, String singleMessagesFile, List<SourceCrawlerXMLFolder> xmlFolders)
sourceDirectories
- The source directories to crawl throughsingleMessagesFile
- the messages file if there is only one, otherwise: nullpublic void addKeyOccurrence(KeyOccurrence occ)
occ
- The key occurrence to addpublic void lookForOccurrencesInFile(String sourceFolder, org.apache.commons.vfs2.FileObject javaFile) throws IOException
sourceFolder
- The folder the java file and messages files live injavaFile
- The java source file to examineIOException
- In case there is a problem accessing the specified source file.protected String getCompleteLine(BufferedReader reader, String line, List<String> splitLinePhrases) throws IOException
IOException
protected void lookForOccurrencesInLine(String sourceFolder, org.apache.commons.vfs2.FileObject javaFile, String messagesPackage, int row, String line)
sourceFolder
- the folder where the file that contains the line to examine existsjavaFile
- the java source file that contains the line to examinemessagesPackage
- the message package usedrow
- the row numberline
- the line to examineprotected List<String> getSplitLinePhrases(String scanPhrase)
Returns all regex expressions to detect when the given scanPhrase is incomplete (existing over more than one source line).
scanPhrase
- the scanPhrase to considergetSplitLinePhrases(String[])
protected String getWhitespacesSanitizeRegex(String str)
Calculates a regex to identify the given text considering all possible SPLIT_CHARACTERS
can be
surrounded by whitespaces.
str
- the text to be usedSPLIT_CHARACTERS
can be surrounded by
whitespacespublic List<String> getMessagesPackagesList(String sourceFolder)
List
of distinct occurrences of the used message package namespublic List<KeyOccurrence> getOccurrencesForPackage(String messagesPackage)
messagesPackage
- the package to hunt forpublic KeyOccurrence getKeyOccurrence(String key, String selectedMessagesPackage)
public List<KeyOccurrence> getKeyOccurrences(String sourceFolder)
sourceFolder
- public List<String> getSourceDirectories()
List
of source directories to crawl throughpublic void setSourceDirectories(List<String> sourceDirectories)
sourceDirectories
- the List
of source directories to crawl throughpublic void setFilesToAvoid(List<String> filesToAvoid)
filesToAvoid
- the List
of files to avoidpublic String getSingleMessagesFile()
public void setSingleMessagesFile(String singleMessagesFile)
singleMessagesFile
- the singleMessagesFile to setpublic String[] getScanPhrases()
public void setScanPhrases(String[] scanPhrases)
scanPhrases
- the scanPhrases to search forpublic Map<String,Map<String,List<KeyOccurrence>>> getSourcePackageOccurrences()
Copyright © 2020 Hitachi Vantara. All rights reserved.