org.pentaho.di.ui.i18n
Class MessagesStore

java.lang.Object
  extended by org.pentaho.di.core.changed.ChangedFlag
      extended by org.pentaho.di.ui.i18n.MessagesStore
All Implemented Interfaces:
ChangedFlagInterface

public class MessagesStore
extends ChangedFlag

This class contains a messages store: for a certain Locale and for a certain messages package, it keeps all the keys and values. This class can read and write messages files...

Author:
matt

Constructor Summary
MessagesStore(String locale, String messagesPackage, Map<String,List<KeyOccurrence>> packageOccurrences)
          Create a new messages store
 
Method Summary
 String getFilename()
           
 String getLoadFilename(List<String> directories)
          Find a suitable filename for the specified locale and messages package.
 String getLocale()
           
 Map<String,String> getMessagesMap()
           
 String getMessagesPackage()
           
 Map<String,List<KeyOccurrence>> getPackageOccurrences()
           
 String getSaveFilename(String directory)
          Find a suitable filename to save this information in the specified locale and messages package.
 String getSourceDirectory(List<String> directories)
           
 void read(List<String> directories)
           
 void setFilename(String filename)
           
 void setLocale(String locale)
           
 void setMessagesMap(Map<String,String> messsagesMap)
           
 void setMessagesPackage(String messagesPackage)
           
 void setPackageOccurrences(Map<String,List<KeyOccurrence>> packageOccurrences)
           
 void write()
           
 void write(String filename)
           
 
Methods inherited from class org.pentaho.di.core.changed.ChangedFlag
addObserver, clearChanged, deleteObserver, hasChanged, notifyObservers, setChanged, setChanged
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagesStore

public MessagesStore(String locale,
                     String messagesPackage,
                     Map<String,List<KeyOccurrence>> packageOccurrences)
Create a new messages store

Parameters:
locale -
messagesPackage -
packageOccurrences -
Method Detail

read

public void read(List<String> directories)
          throws KettleException
Throws:
KettleException

write

public void write()
           throws KettleException
Throws:
KettleException

write

public void write(String filename)
           throws KettleException
Throws:
KettleException

getLoadFilename

public String getLoadFilename(List<String> directories)
                       throws FileNotFoundException
Find a suitable filename for the specified locale and messages package. It tries to find the file in the specified directories in the order that they are specified.

Parameters:
directories - the source directories to try and map the messages files against.
Returns:
the filename that was found.
Throws:
FileNotFoundException

getSourceDirectory

public String getSourceDirectory(List<String> directories)

getSaveFilename

public String getSaveFilename(String directory)
Find a suitable filename to save this information in the specified locale and messages package. It needs a source directory to save the package in

Parameters:
directory - the source directory to save the messages file in.
Returns:
the filename that was generated.

getLocale

public String getLocale()
Returns:
the locale

setLocale

public void setLocale(String locale)
Parameters:
locale - the locale to set

getMessagesPackage

public String getMessagesPackage()
Returns:
the messagesPackage

setMessagesPackage

public void setMessagesPackage(String messagesPackage)
Parameters:
messagesPackage - the messagesPackage to set

getMessagesMap

public Map<String,String> getMessagesMap()
Returns:
the map

setMessagesMap

public void setMessagesMap(Map<String,String> messsagesMap)
Parameters:
messsagesMap - the map to set

getFilename

public String getFilename()

setFilename

public void setFilename(String filename)

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