org.pentaho.di.ui.i18n
Class MessagesSourceCrawler

java.lang.Object
  extended by org.pentaho.di.ui.i18n.MessagesSourceCrawler

public class MessagesSourceCrawler
extends Object

This class takes care of crawling through the source code

Author:
matt

Constructor Summary
MessagesSourceCrawler(LogChannelInterface log, List<String> sourceDirectories, String singleMessagesFile, List<SourceCrawlerXMLFolder> xmlFolders)
           
 
Method Summary
 void addKeyOccurrence(KeyOccurrence occ)
          Add a key occurrence to the list of occurrences.
 void crawl()
           
 List<String> getFilesToAvoid()
           
 KeyOccurrence getKeyOccurrence(String key, String selectedMessagesPackage)
           
 List<String> getMessagesPackagesList()
           
 List<KeyOccurrence> getOccurrences()
           
 List<KeyOccurrence> getOccurrencesForPackage(String messagesPackage)
          Get all the key occurrences for a certain messsages package.
 Map<String,List<KeyOccurrence>> getPackageOccurrences()
           
 String[] getScanPhrases()
           
 String getSingleMessagesFile()
           
 List<String> getSourceDirectories()
           
 void lookForOccurrencesInFile(org.apache.commons.vfs.FileObject fileObject)
          Look for additional occurrences of keys in the specified file.
static void main(String[] args)
           
 void setFilesToAvoid(List<String> filesToAvoid)
           
 void setOccurrences(List<KeyOccurrence> occurrences)
           
 void setPackageOccurrences(Map<String,List<KeyOccurrence>> packageOccurrences)
           
 void setScanPhrases(String[] scanPhrases)
           
 void setSingleMessagesFile(String singleMessagesFile)
           
 void setSourceDirectories(List<String> sourceDirectories)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagesSourceCrawler

public MessagesSourceCrawler(LogChannelInterface log,
                             List<String> sourceDirectories,
                             String singleMessagesFile,
                             List<SourceCrawlerXMLFolder> xmlFolders)
Parameters:
sourceDirectories - The source directories to crawl through
singleMessagesFile - the messages file if there is only one, otherwise: null
Method Detail

getSourceDirectories

public List<String> getSourceDirectories()
Returns:
The source directories to crawl through

setSourceDirectories

public void setSourceDirectories(List<String> sourceDirectories)
Parameters:
sourceDirectories - The source directories to crawl through

getOccurrences

public List<KeyOccurrence> getOccurrences()
Returns:
the occurrences

setOccurrences

public void setOccurrences(List<KeyOccurrence> occurrences)
Parameters:
occurrences - the occurrences to set

getFilesToAvoid

public List<String> getFilesToAvoid()
Returns:
the files to avoid

setFilesToAvoid

public void setFilesToAvoid(List<String> filesToAvoid)
Parameters:
filesToAvoid - the files to avoid

addKeyOccurrence

public void addKeyOccurrence(KeyOccurrence occ)
Add a key occurrence to the list of occurrences. The list is kept sorted on key and message package. If the key already exists, we increment the number of occurrences.

Parameters:
occ - The key occurrence to add

crawl

public void crawl()
           throws Exception
Throws:
Exception

lookForOccurrencesInFile

public void lookForOccurrencesInFile(org.apache.commons.vfs.FileObject fileObject)
                              throws IOException
Look for additional occurrences of keys in the specified file.

Parameters:
fileObject - The java source file to examine
Throws:
IOException - In case there is a problem accessing the specified source file.

getMessagesPackagesList

public List<String> getMessagesPackagesList()
Returns:
A sorted list of distinct occurrences of the used message package names

getOccurrencesForPackage

public List<KeyOccurrence> getOccurrencesForPackage(String messagesPackage)
Get all the key occurrences for a certain messsages package.

Parameters:
messagesPackage - the package to hunt for
Returns:
all the key occurrences for a certain messages package.

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

getKeyOccurrence

public KeyOccurrence getKeyOccurrence(String key,
                                      String selectedMessagesPackage)

getSingleMessagesFile

public String getSingleMessagesFile()
Returns:
the singleMessagesFile

setSingleMessagesFile

public void setSingleMessagesFile(String singleMessagesFile)
Parameters:
singleMessagesFile - the singleMessagesFile to set

getScanPhrases

public String[] getScanPhrases()
Returns:
the scanPhrases

setScanPhrases

public void setScanPhrases(String[] scanPhrases)
Parameters:
scanPhrases - the scanPhrases to set

getPackageOccurrences

public Map<String,List<KeyOccurrence>> getPackageOccurrences()
Returns:
the packageOccurrences

setPackageOccurrences

public void setPackageOccurrences(Map<String,List<KeyOccurrence>> packageOccurrences)
Parameters:
packageOccurrences - the packageOccurrences to set