Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

oracle.javatools.resourcebundle
Class ResourceBundleWrapperRT

java.lang.Object
  extended by oracle.javatools.resourcebundle.ResourceBundleWrapperRT
All Implemented Interfaces:
ResourceBundleWrapper, SearchSupport
Direct Known Subclasses:
ResourceBundleAdapter

public abstract class ResourceBundleWrapperRT
extends java.lang.Object
implements ResourceBundleWrapper, SearchSupport

The ResourceBundleWrapperRT provides some of the base implementation of a ResourceBundleWrapper for run-time. Any implementation of a resource bundle wrapper for run-time must extend this class for proper functioning in the run-time version of the ResourceBundleManager


Nested Class Summary
protected static class ResourceBundleWrapperRT.DefaultSearchContext
           
protected static class ResourceBundleWrapperRT.SearchType
          Deprecated. See class, SearchSupport for new RT search capabilities. The ordinals are now frozen because of the mapping in DefaultSearchContext.
 
Nested classes/interfaces inherited from interface oracle.javatools.resourcebundle.ResourceBundleWrapper
ResourceBundleWrapper.KeyInfo
 
Field Summary
protected  ResourceBundleWrapperRT _parent
           
 
Constructor Summary
ResourceBundleWrapperRT()
           
 
Method Summary
 java.lang.String addEntry(java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
          Adds a new entry (value, and optional metadata) into the resource bundle and returns an automatically generated resource bundle key.
 boolean addEntry(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
          Adds a new entry (key, value, and optional metadata) into the resource bundle.
 ResourceBundleOperationResult addEntryNoDialog(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
          Adds a new entry (key, value, and optional metadata) into the resource bundle.
 void addResourceBundleListener(ResourceBundleListener listener)
          Registers a listenerto receive ResourceBundleEvents when the contents of the resource bundle change.
 boolean deleteEntry(java.lang.String key)
          Deletes the resource bundle entry identified by key.
protected  java.util.Set<java.lang.String> findKeys(ResourceBundleWrapperRT.SearchType searchType, java.lang.Object searchTerm)
          Returns a set of keys that satisfy the search using the overload, but with hard-coded param, ignoreCase='false' to preserve legacy behavior.
protected  java.util.Set<java.lang.String> findKeys(java.lang.String searchTypeMeth, java.lang.Object searchTerm, boolean ignoreCase)
          This is the single pinch-point method that most override classes can extend to support their own policies and enhancements to the find operations.
 java.util.Set<java.lang.String> findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata)
           
 java.util.Set<java.lang.String> findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata, boolean ignoreCase)
          Gets a Set of keys which exactly match the specified metadata.
 java.util.Set<java.lang.String> findKeysByText(java.lang.String text)
           
 java.util.Set<java.lang.String> findKeysByText(java.lang.String text, boolean ignoreCase)
          Finds the Set of keys containing an exact match for text
 java.util.Set<java.lang.String> findKeysLikeKey(java.lang.String key)
           
 java.util.Set<java.lang.String> findKeysLikeKey(java.lang.String key, boolean ignoreCase)
          Finds the Set of keys identifying entries whose key contains the substring key.
 java.util.Set<java.lang.String> findKeysLikeMetaData(java.util.Map<java.lang.String,java.lang.String> metadata, boolean ignoreCase)
          Gets a Set of keys which is a contains match for the specified metadata.
 java.util.Set<java.lang.String> findKeysLikeText(java.lang.String text)
           
 java.util.Set<java.lang.String> findKeysLikeText(java.lang.String text, boolean ignoreCase)
          Finds the Set of keys identifying entries whose translated text contains the substring text.
 java.lang.String getBundleId()
          Gets the bundleId associated with this instance of ResourceBundleWrapper
 java.util.Map<java.lang.String,java.lang.String> getChainedKeyValueMap()
          Gets the key-value map for the bundle chained with any parent bundles For example, if the bundle is for BundleA_en_US the parent chain will include BundleA_en and Bundle
 ResourceBundleKeyGenerator getKeyGenerator()
          Gets the key generator to use for making an automatic key name
abstract  java.util.Map<java.lang.String,java.lang.String> getKeyValueMap()
          Gets the map of key-values for this bundle.
protected  java.util.Map<java.lang.String,java.lang.String> getMetadataFromParentChain(java.lang.String key)
           
protected  ResourceBundleWrapperRT getParent()
           
 java.util.List<ResourceBundleWrapperRT> getParentChain()
           
protected  java.util.List<java.lang.String> getParentList()
           
 java.lang.String getString(java.lang.String key)
          Gets the translated text (value) identified by key
protected abstract  void parse(java.net.URL url)
           
 boolean refreshBundleIfNeeded(java.lang.Exception ex)
           
 void removeResourceBundleListener(ResourceBundleListener listener)
          Removes a listenerthat received ResourceBundleEvents.
 void setBundleId(java.lang.String bundleId)
          Sets the bundleId associated with this instance of ResourceBundleWrapper
 void setKeyGenerator(ResourceBundleKeyGenerator generator)
          Sets the key generator to use when using an automatic key name from ResourceBundleWrapper.addEntry(String,Map).
 void setParentList(java.util.List<java.lang.String> parentList)
           
 void setURL(java.net.URL url)
           
 java.lang.String toString()
           
 boolean updateEntry(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
          Updates the specified key to have the specified text and metadata.
 ResourceBundleOperationResult updateEntryNoDialog(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
          Updates the specified key to have the specified text and metadata while not showing any dialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.javatools.resourcebundle.ResourceBundleWrapper
getMetadata, keySet
 

Field Detail

_parent

protected ResourceBundleWrapperRT _parent
Constructor Detail

ResourceBundleWrapperRT

public ResourceBundleWrapperRT()
Method Detail

setURL

public void setURL(java.net.URL url)

setBundleId

public void setBundleId(java.lang.String bundleId)
Description copied from interface: ResourceBundleWrapper
Sets the bundleId associated with this instance of ResourceBundleWrapper

Specified by:
setBundleId in interface ResourceBundleWrapper
Parameters:
bundleId - the id of the bundle

getBundleId

public java.lang.String getBundleId()
Description copied from interface: ResourceBundleWrapper
Gets the bundleId associated with this instance of ResourceBundleWrapper

Specified by:
getBundleId in interface ResourceBundleWrapper
Returns:
the bundleId

parse

protected abstract void parse(java.net.URL url)

getKeyValueMap

public abstract java.util.Map<java.lang.String,java.lang.String> getKeyValueMap()
Gets the map of key-values for this bundle. This map will not include keys from related bundles in the language hierarchy. For that call getChainedKeyValueMap() instead. For example, if bundleA is requested in the Locale.US then the related bundles would be bundleA_en_US, bundleA_en, bundleA

Returns:
map of key/values

findKeysLikeKey

public java.util.Set<java.lang.String> findKeysLikeKey(java.lang.String key,
                                                       boolean ignoreCase)
Description copied from interface: SearchSupport
Finds the Set of keys identifying entries whose key contains the substring key. No wildcards are expected or allowed.

Specified by:
findKeysLikeKey in interface SearchSupport
Parameters:
key - The substring key to match
ignoreCase - True to request case insensitivity
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned.

findKeysByText

public java.util.Set<java.lang.String> findKeysByText(java.lang.String text,
                                                      boolean ignoreCase)
Description copied from interface: SearchSupport
Finds the Set of keys containing an exact match for text

Specified by:
findKeysByText in interface SearchSupport
Parameters:
text - The exact text to match
ignoreCase - True to request case insensitivity
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned

findKeysLikeText

public java.util.Set<java.lang.String> findKeysLikeText(java.lang.String text,
                                                        boolean ignoreCase)
Description copied from interface: SearchSupport
Finds the Set of keys identifying entries whose translated text contains the substring text. No wildcards are expected or allowed.

Specified by:
findKeysLikeText in interface SearchSupport
Parameters:
text - The substring text to match
ignoreCase - True to request case insensitivity
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned.

findKeysByMetaData

public java.util.Set<java.lang.String> findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata,
                                                          boolean ignoreCase)
Description copied from interface: SearchSupport
Gets a Set of keys which exactly match the specified metadata. Metadata Search Rules
KeyValueResult
KeyValueResult

Specified by:
findKeysByMetaData in interface SearchSupport
Parameters:
metadata - The metadata search criteria.
ignoreCase - True to request case insensitivity
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned.

findKeysLikeMetaData

public java.util.Set<java.lang.String> findKeysLikeMetaData(java.util.Map<java.lang.String,java.lang.String> metadata,
                                                            boolean ignoreCase)
Description copied from interface: SearchSupport
Gets a Set of keys which is a contains match for the specified metadata. Metadata Search Rules
KeyValueResult
KeyValueResult

Specified by:
findKeysLikeMetaData in interface SearchSupport
Parameters:
metadata - The metadata search criteria.
ignoreCase - True to request case insensitivity
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned.

findKeysLikeKey

public java.util.Set<java.lang.String> findKeysLikeKey(java.lang.String key)
Specified by:
findKeysLikeKey in interface ResourceBundleWrapper
Parameters:
key - The substring key to match
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned.
See Also:
SearchSupport::findKeysLikeKey(String,boolean) Finds the {@link Set} of keys identifying entries whose key contains the substring {@code key}. No wildcards are expected or allowed.


findKeysByText

public java.util.Set<java.lang.String> findKeysByText(java.lang.String text)
Specified by:
findKeysByText in interface ResourceBundleWrapper
Parameters:
text - The exact text to match
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned
See Also:
SearchSupport::findKeysByText(String, boolean) Finds the {@link Set} of keys containing an exact match for {@code text}

findKeysLikeText

public java.util.Set<java.lang.String> findKeysLikeText(java.lang.String text)
Specified by:
findKeysLikeText in interface ResourceBundleWrapper
Parameters:
text - The substring text to match
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned.
See Also:
SearchSupport::findKeysLikeText(String, boolean) Finds the {@link Set} of keys identifying entries whose translated text contains the substring {@code text}. No wildcards are expected or allowed.


findKeysByMetaData

public java.util.Set<java.lang.String> findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata)
Specified by:
findKeysByMetaData in interface ResourceBundleWrapper
Parameters:
metadata - The metadata search criteria.
Returns:
The Set of keys containing a match. If no keys match, then an empty Set is returned.
See Also:
SearchSupport::findKeysByMetaData(Map, boolean), SearchSupport::findKeysLikeMetaData(Map, boolean) Gets a Set of keys which contain the specified metadata. Metadata Search Rules
KeyValueResult
KeyValueResult

findKeys

protected java.util.Set<java.lang.String> findKeys(java.lang.String searchTypeMeth,
                                                   java.lang.Object searchTerm,
                                                   boolean ignoreCase)
This is the single pinch-point method that most override classes can extend to support their own policies and enhancements to the find operations. They will then call super.findKeys to let this impl do the heavy-lifting, or (less likely) pass in their own SearchContext impl for their custom work...

Parameters:
searchTypeMeth - type of search to perform
searchTerm - term being searched for
ignoreCase - whether to _ignoreCase of searchTerm for matches
Returns:
result set of matching keys

findKeys

protected java.util.Set<java.lang.String> findKeys(ResourceBundleWrapperRT.SearchType searchType,
                                                   java.lang.Object searchTerm)
Returns a set of keys that satisfy the search using the overload, but with hard-coded param, ignoreCase='false' to preserve legacy behavior.

Parameters:
searchType - one of the valid search types
searchTerm - a text string or a map of strings if a metadata search
Returns:
a set of keys that satisfy the search or null if none found

setKeyGenerator

public void setKeyGenerator(ResourceBundleKeyGenerator generator)
Description copied from interface: ResourceBundleWrapper
Sets the key generator to use when using an automatic key name from ResourceBundleWrapper.addEntry(String,Map).

Specified by:
setKeyGenerator in interface ResourceBundleWrapper
Parameters:
generator - The ResourceBundleKeyGenerator to use. if generator is null, then the default key generator will be used.

getKeyGenerator

public ResourceBundleKeyGenerator getKeyGenerator()
Description copied from interface: ResourceBundleWrapper
Gets the key generator to use for making an automatic key name

Specified by:
getKeyGenerator in interface ResourceBundleWrapper
Returns:
the {@link ResourceBundleKeyGenerator) to use. May return null

setParentList

public void setParentList(java.util.List<java.lang.String> parentList)

getString

public java.lang.String getString(java.lang.String key)
Description copied from interface: ResourceBundleWrapper
Gets the translated text (value) identified by key

Specified by:
getString in interface ResourceBundleWrapper
Parameters:
key - The key in the resource bundle
Returns:
The translated text.

getMetadataFromParentChain

protected java.util.Map<java.lang.String,java.lang.String> getMetadataFromParentChain(java.lang.String key)

getChainedKeyValueMap

public java.util.Map<java.lang.String,java.lang.String> getChainedKeyValueMap()
Gets the key-value map for the bundle chained with any parent bundles For example, if the bundle is for BundleA_en_US the parent chain will include BundleA_en and Bundle

Returns:
a map of the keys and values

getParent

protected ResourceBundleWrapperRT getParent()

getParentChain

public java.util.List<ResourceBundleWrapperRT> getParentChain()

getParentList

protected java.util.List<java.lang.String> getParentList()

addEntry

public boolean addEntry(java.lang.String key,
                        java.lang.String text,
                        java.util.Map<java.lang.String,java.lang.String> metadata)
Description copied from interface: ResourceBundleWrapper
Adds a new entry (key, value, and optional metadata) into the resource bundle. May show a dialog if the key is being written into an "override" bundle and the warning dialog's "Don't show me this next time" checkbox has not been previously checked.

Specified by:
addEntry in interface ResourceBundleWrapper
Parameters:
key - The key name to use in the resource bundle.
text - The text to be translated.
metadata - Any associated metadata about the translation string This parameter may be null
Returns:
true on success

addEntryNoDialog

public ResourceBundleOperationResult addEntryNoDialog(java.lang.String key,
                                                      java.lang.String text,
                                                      java.util.Map<java.lang.String,java.lang.String> metadata)
Description copied from interface: ResourceBundleWrapper
Adds a new entry (key, value, and optional metadata) into the resource bundle. May show a dialog if the key is being written into an "override" bundle and the warning dialog's "Don't show me this next time" checkbox has not been previously checked.

Specified by:
addEntryNoDialog in interface ResourceBundleWrapper
Parameters:
key - The key name to use in the resource bundle.
text - The text to be translated.
metadata - Any associated metadata about the translation string This parameter may be null
Returns:
a result object that contains an indicator of whether the operation succeeded and may contain a string of any warning or error message

addEntry

public java.lang.String addEntry(java.lang.String text,
                                 java.util.Map<java.lang.String,java.lang.String> metadata)
Description copied from interface: ResourceBundleWrapper
Adds a new entry (value, and optional metadata) into the resource bundle and returns an automatically generated resource bundle key.

Specified by:
addEntry in interface ResourceBundleWrapper
Parameters:
text - The text to be translated.
metadata - Any associated metadata about the translation string. This parameter may be null
Returns:
the automatically generated key name

deleteEntry

public boolean deleteEntry(java.lang.String key)
Description copied from interface: ResourceBundleWrapper
Deletes the resource bundle entry identified by key. If key does not exist, then a value of false is returned.

Specified by:
deleteEntry in interface ResourceBundleWrapper
Parameters:
key - The key to delete
Returns:
true If the key is found and deleted success.

updateEntry

public boolean updateEntry(java.lang.String key,
                           java.lang.String text,
                           java.util.Map<java.lang.String,java.lang.String> metadata)
Description copied from interface: ResourceBundleWrapper
Updates the specified key to have the specified text and metadata. Shows a dialog to warn the user that a key is being updated (the dialog may be suppressed if it's "Don't show this again" checkbox has been checked.

Specified by:
updateEntry in interface ResourceBundleWrapper
Parameters:
key - The key to update
text - The new text for the given key
metadata - Any metadata to change. Existing metadata is merged with the new metadata, unless there is a key with a null value, then the existing metadata for that key is removed. If metadata is null then the existing metadata will be unchanged.
Returns:
true on success

updateEntryNoDialog

public ResourceBundleOperationResult updateEntryNoDialog(java.lang.String key,
                                                         java.lang.String text,
                                                         java.util.Map<java.lang.String,java.lang.String> metadata)
Description copied from interface: ResourceBundleWrapper
Updates the specified key to have the specified text and metadata while not showing any dialog

Specified by:
updateEntryNoDialog in interface ResourceBundleWrapper
Parameters:
key - The key to update
text - The new text for the given key
metadata - Any metadata to change. Existing metadata is merged with the new metadata, unless there is a key with a null value, then the existing metadata for that key is removed. If metadata is null then the existing metadata will be unchanged.
Returns:
a result object that contains an indicator of whether the operation succeeded and may contain a string of any warning or error message

addResourceBundleListener

public void addResourceBundleListener(ResourceBundleListener listener)
Description copied from interface: ResourceBundleWrapper
Registers a listenerto receive ResourceBundleEvents when the contents of the resource bundle change.

Specified by:
addResourceBundleListener in interface ResourceBundleWrapper
Parameters:
listener - the ResourceBundleListenerto register
See Also:
ResourceBundleListener, ResourceBundleEvent

removeResourceBundleListener

public void removeResourceBundleListener(ResourceBundleListener listener)
Description copied from interface: ResourceBundleWrapper
Removes a listenerthat received ResourceBundleEvents.

Specified by:
removeResourceBundleListener in interface ResourceBundleWrapper
Parameters:
listener - the ResourceBundleListenerto remove
See Also:
ResourceBundleListener, ResourceBundleEvent

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

refreshBundleIfNeeded

public boolean refreshBundleIfNeeded(java.lang.Exception ex)

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

Copyright © 1997, 2013, Oracle. All rights reserved.