| java.lang.Object com.ibm.rbm.RBManager
RBManager | public class RBManager (Code) | | A utility class to aid in the process of updating the Natural Language Support of Tempus Fugit.
This class scans the directory containing NLS files and checks the various languages found there
for completeness, duplication of entry, and status of translation. The class can be instantiated
through a constructor, or it can be run from the command line. For additional information on the
command line results, see the main method.
author: Jared Jackson See Also: com.ibm.rbm.RBManager |
Constructor Summary | |
public | RBManager(String baseClassName) This constructor creates an entirely blank RBManager and base Bundle. | public | RBManager(File mainFile) This is the standard constructor for RBManager. |
Method Summary | |
public boolean | createGroup(String groupName, String groupComment) Attempts to create a new group in each of the language files. | public boolean | createItem(String name, String value, String groupName, String comment, Hashtable lookups) Attempts to create a new item in each of the language files. | public boolean | createResource(String title, String comment, String manager, String encoding, String language, String country, String variant, boolean copyValues) Attempts to create a new resource file with the given encoding. | public void | deleteGroup(String groupName) Removes a group and all of the items within that group from the various
Resource Bundles known to the system. | public void | deleteItem(String itemName) Remove resource items of the given name from each of the resource bundles that the system
knows about. | public boolean | editItem(BundleItem item, String name, String value, String groupName, String comment, Hashtable lookups) Given a BundleItem and some properties to change for that item, this method first checks to make sure the passed
item is valid and if it is, the properties of that item are changed to reflect those passed in as parameters to this
method. | public void | eraseFile(String encoding) Erases permanently one of the resource files. | public String | getBaseClass() Returns the base class name or null if it does not exist. | public File | getBaseFile() Returns the name of the file that is the base class file for the resource bundle. | public Bundle | getBundle(String locale) | public Vector | getBundles() | public String | getDuplicatesListing() | public Vector | getDuplicatesListingVector() | public String | getGroupListing() A useful debugging method that lists the various BundleGroup names in a String. | public Vector | getGroupListingVector() Returns a vector collection of all of the BundleGroup items founds int the bundle. | public String | getLanguageListing() | public Vector | getLanguageListingVector() | public int | getNumberDuplicates() | public int | getNumberGroups() Returns the number of BundleGroups in the bundle. | public int | getNumberLanguages() | public int | getNumberTotalTranslations() | public String | getUser() | public boolean | hasResource(String encoding) Looks through the resources contained in the bundle for a resource of the given encoding. | public void | hideResource(String encoding) Calling this method removes a resource from the resource bundle. | public static void | main(String args) | public void | setBaseClass(String baseClassName) | public void | setFileDirectory(File directory) Sets the directory in the file system in which this resource bundle is to be
saved and retrieved. | public void | setUser(String user) | public String | toSring() Returns the base class name if known, or "Unknown Base Class" otherwise. | public String | toString() | public void | writeToFile() | public void | writeToFile(String encoding) Writes only one of the resource files to the file system. |
RBManager | public RBManager(String baseClassName)(Code) | | This constructor creates an entirely blank RBManager and base Bundle. Only the base class name is defined.
All other properties need to be defined.
|
RBManager | public RBManager(File mainFile) throws FileNotFoundException, IOException(Code) | | This is the standard constructor for RBManager. It is constructed from the root of a resource bundle.
In the current implementation, each file is parsed separately starting with the base class file (root).
In this implementation, the lookup keys are represented to the user as they appear in the files. The
translation values however are translated according to the basic rules defined in java.util.Properties.
Thus in the key, the user may see '\"' when in the value it would have been converted to '"'. This
translation is reversed when saving the resource bundle.
Parameters: mainFile - The base class file of the resource bundle to be read |
createGroup | public boolean createGroup(String groupName, String groupComment)(Code) | | Attempts to create a new group in each of the language files. The method first checks the base Resource Bundle
to make sure that the group name does not all ready exist. If it does exist the group is not created.
Parameters: groupName - The unique group name to be created Parameters: groupComment - An optional comment to be added to the group, can be null An error response. If the creation was successful true is returned, if there was an error false is returned. |
createItem | public boolean createItem(String name, String value, String groupName, String comment, Hashtable lookups)(Code) | | Attempts to create a new item in each of the language files. The method first checks the base Resource Bundle
to make sure that the item name does not all ready exist. If it does exist the item is not created.
Parameters: name - The unique key of the item Parameters: value - The translation of the item for the base class Parameters: groupName - The group name, should all ready exist in the base class Parameters: comment - An optional comment to be added to the item, can be null An error response. If the creation was successful true is returned, if there was an error false is returned. |
createResource | public boolean createResource(String title, String comment, String manager, String encoding, String language, String country, String variant, boolean copyValues)(Code) | | Attempts to create a new resource file with the given encoding. The method first checks the base Resource Bundle
to make sure that encoding does not all ready exist. If it does exist the resource file is not created.
Parameters: title - An optional, quick title for the file, can be null Parameters: comment - An optional comment to be added to the resource, can be null Parameters: manager - The name of the person responsible for this resource, can be null Parameters: encoding - The proper encoding for the resource. Must be of form 'language', 'language_country', or 'language_country_variant' Parameters: language - A more formal name for the language (e.g. 'English', 'Deutsch', etc.), can be null Parameters: country - A more formal name for the country described by the resource, can be null Parameters: variant - A more formal name for the variant described by the resource, can be null Parameters: copyValues - An indication of wether or not to populate the resource with the items in the base class An error response. If the creation was successful true is returned, if there was an error false is returned. |
deleteGroup | public void deleteGroup(String groupName)(Code) | | Removes a group and all of the items within that group from the various
Resource Bundles known to the system. This method removes the group from
the protected vector of groups, then removes all items in that group from
the protected vector of untranslated items, and the protected hashtable of
all items.
|
deleteItem | public void deleteItem(String itemName)(Code) | | Remove resource items of the given name from each of the resource bundles that the system
knows about. This works by first removing the item from the protected vector of translated
items, if it is there, and then removing it from the the hashtable of all items, and then
removing it from its respective group.
|
editItem | public boolean editItem(BundleItem item, String name, String value, String groupName, String comment, Hashtable lookups)(Code) | | Given a BundleItem and some properties to change for that item, this method first checks to make sure the passed
item is valid and if it is, the properties of that item are changed to reflect those passed in as parameters to this
method.
true if the BundleItem was valid and updateable, false if otherwise (in this case no changes were made). |
eraseFile | public void eraseFile(String encoding) throws IOException(Code) | | Erases permanently one of the resource files. Be careful about calling this method there is nothing you can do
once a file is erased.
|
getBaseClass | public String getBaseClass()(Code) | | Returns the base class name or null if it does not exist.
|
getBaseFile | public File getBaseFile()(Code) | | Returns the name of the file that is the base class file for the resource bundle.
|
getBundle | public Bundle getBundle(String locale)(Code) | | Return a bundle from a locale
The requested resource bundle |
getBundles | public Vector getBundles()(Code) | | A Vector of NLSbundles, one for each language
|
getDuplicatesListing | public String getDuplicatesListing()(Code) | | Returns a single string with a comma delimited listing of all duplicate entries found in the NLS resources
|
getDuplicatesListingVector | public Vector getDuplicatesListingVector()(Code) | | Returns a Vector collection of duplicate BundleItems found in the bundle
|
getGroupListing | public String getGroupListing()(Code) | | A useful debugging method that lists the various BundleGroup names in a String.
|
getGroupListingVector | public Vector getGroupListingVector()(Code) | | Returns a vector collection of all of the BundleGroup items founds int the bundle.
|
getLanguageListing | public String getLanguageListing()(Code) | | Returns a single string comprised of a comma delimited listing of all languages the system seems to support
|
getLanguageListingVector | public Vector getLanguageListingVector()(Code) | | Returns a vector of strings comprising a list of all languages in the system
|
getNumberDuplicates | public int getNumberDuplicates()(Code) | | Returns the number of duplicate NLS entries
|
getNumberGroups | public int getNumberGroups()(Code) | | Returns the number of BundleGroups in the bundle.
|
getNumberLanguages | public int getNumberLanguages()(Code) | | Returns the total number of languages that the system seems to support
|
getNumberTotalTranslations | public int getNumberTotalTranslations()(Code) | | Returns the number of translations contained across all language files
|
getUser | public String getUser()(Code) | | Returns the name of the user currently using the editor
|
hasResource | public boolean hasResource(String encoding)(Code) | | Looks through the resources contained in the bundle for a resource of the given encoding. Note that this
search is case sensitive.
True if the encoding exists as one of the resource files, false otherwise |
hideResource | public void hideResource(String encoding)(Code) | | Calling this method removes a resource from the resource bundle. This method does not permanently
erase the file containing the resources at this encoding, however any changes or saves that take
place once this file has been removed will not be reflected in this hidden file. To restore the resource,
the bundle will have to be recreated. (This last point may change)
|
setBaseClass | public void setBaseClass(String baseClassName)(Code) | | Sets the name of the base class associated with this resource bundle
|
setFileDirectory | public void setFileDirectory(File directory)(Code) | | Sets the directory in the file system in which this resource bundle is to be
saved and retrieved.
|
setUser | public void setUser(String user)(Code) | | Sets the name of the user currently using the editor
|
toSring | public String toSring()(Code) | | Returns the base class name if known, or "Unknown Base Class" otherwise.
|
writeToFile | public void writeToFile() throws IOException(Code) | | Write the contents of the file to the output stream
|
writeToFile | public void writeToFile(String encoding) throws IOException(Code) | | Writes only one of the resource files to the file system. This file is specified by the encoding parameter
|
|
|