public abstract class ResourceBundleManager
extends java.lang.Object
getResourceBundleManager()method. ResourceBundleWrapper
instances are obtained via the getBundle() of the ResourceBundleManagerRT
or ResourceBundleManagerDT subclasses, and should be released using releaseBundle(ResourceBundleWrapper)
when they are no longer used.
* ResourceBundleManager provides a cache of resource bundles that can be tuned
via the following system properties:
- resource-bundle-cache-initial-size (default 100)
- resource-bundle-cache-max-size (default 100)
- resource-bundle-cache-load-factor (default 0.75f)
- resource-bundle-cache-expire-time (default 43200000 ie, 12 hours)
resource-bundle-cache-initial-size defines the size the cache will
be initially created to hold
resource-bundle-cache-max-size defines the maximum number of resource bundles the
cache will hold
resource-bundle-cache-load-factor defines the load factor used in deciding when to
increase the size of the cache
resource-bundle-cache-expire-time defines the number of milliseconds a bundle can be in
the cache before it is considered expired. Expired bundles will be removed from the
cache when a new entry is added to the cache.
Design-time implementations of the (@link ResourceBundleWrapper} must extend
oracle.ide.resourcebundle.NodeResourceBundle so
that the ResourceBundleManager can properly interract with the implementation.
NodeResourceBundle contains methods that only the design-time ResourceBundleManagerDT
implementation will use, such as delete() and Node methods such as save()
Run-time implementations of the ResourceBundleWrapper must extend
<@link ResourceBundleWrapperRT}.| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,ResourceBundleWrapper> |
_bundleMap |
protected static java.util.List<ResourceBundleType> |
_bundleTypesList |
protected static ChainedBundleFactory |
_chainedBundleFactory |
protected ResourceBundleKeyGenerator |
_keyGenerator |
static java.lang.String |
NULL_VALUE_RESOURCE_ID |
static java.lang.String |
SYSTEM_BUNDLE_ID |
| Modifier | Constructor and Description |
|---|---|
protected |
ResourceBundleManager()
This should only be called by subclasses
|
protected |
ResourceBundleManager(ResourceBundleCacheConfig config) |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
deleteBundle(ResourceBundleWrapper bundle)
Deletes the given bundle.
|
static AppBundleInfoFactory |
getAppBundleInfoFactory()
Gets the AppBundleInfoFactory
|
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,AppBundleInfoRT> |
getAppBundleInfoMap() |
static ChainedBundleFactory |
getChainedBundleFactory()
Gets the ChainedBundleFactory if one has been registered
|
ResourceBundleKeyGenerator |
getDefaultResourceKeyGenerator()
Gets the default ResourceKeyGenerator for the system.
|
static ResourceBundleManager |
getResourceBundleManager() |
java.util.List<ResourceBundleType> |
getResourceBundleTypes()
Retrieves the list of
ResourceBundleTypes that have been registered |
abstract boolean |
mergeBundles(ResourceBundleWrapper newBundle,
ResourceBundleWrapper oldBundle)
Merges the contents of
oldBundle into newBundle |
void |
registerResourceBundleType(ResourceBundleType bundleType)
Registers a new ResourceBundleType with the system.
|
abstract boolean |
releaseBundle(ResourceBundleWrapper bundle)
Releases the ResourceBundleWrapper and all associated resources, once
released the old resource bundle should not be used anymore, or it will
throw an
IllegalStateException. |
static void |
setAppBundleInfoFactory(AppBundleInfoFactory factory)
Sets the AppBundleInfoFactory
|
static void |
setChainedBundleFactory(ChainedBundleFactory factory)
Sets the ChainedBundleFactory
|
void |
setDefaultResourceKeyGenerator(ResourceBundleKeyGenerator generator)
Sets the default ResourceKeyGenerator for the system.
|
static void |
setResourceBundleManager(ResourceBundleManager bundleManager)
Publishes the specified ResourceBundleManager as the active instance in the IDE.
|
abstract boolean |
splitBundle(ResourceBundleWrapper newBundle,
ResourceBundleWrapper oldBundle,
java.util.Set<java.lang.String> keysToMove)
Splits a ResourceBundleWrapper into two.
|
protected final java.util.Map<java.lang.String,ResourceBundleWrapper> _bundleMap
protected static final java.util.List<ResourceBundleType> _bundleTypesList
protected ResourceBundleKeyGenerator _keyGenerator
protected static ChainedBundleFactory _chainedBundleFactory
public static final java.lang.String SYSTEM_BUNDLE_ID
public static final java.lang.String NULL_VALUE_RESOURCE_ID
protected ResourceBundleManager()
protected ResourceBundleManager(ResourceBundleCacheConfig config)
public abstract boolean deleteBundle(ResourceBundleWrapper bundle)
bundle - Deletes the given resource bundle.true on success.java.lang.NullPointerException - if bundle is nullpublic abstract boolean mergeBundles(ResourceBundleWrapper newBundle, ResourceBundleWrapper oldBundle)
oldBundle into newBundlenewBundle - The new resource bundle.oldBundle - The old resource bundle, whose contents are merged into
the new bundle.true on success.java.lang.NullPointerException - if newBundle or oldBundle
is nullpublic abstract boolean splitBundle(ResourceBundleWrapper newBundle, ResourceBundleWrapper oldBundle, java.util.Set<java.lang.String> keysToMove)
keysToMove will be removed from oldBundle and added to
newBundlenewBundle - The new bundle contains the keys in keysTomoveoldBundle - The original (old) resource bundlekeysToMove - The set of keys to movetrue on success.java.lang.NullPointerException - if newBundle,oldBundle,
or keysToMove is nulljava.lang.IllegalArgumentException - if keysToMove is an empty Set.public abstract boolean releaseBundle(ResourceBundleWrapper bundle)
IllegalStateException.bundle - The resource bundle to release.true on success.java.lang.NullPointerException - if bundle is nullpublic void setDefaultResourceKeyGenerator(ResourceBundleKeyGenerator generator)
generator - The default ResourceKeyGenerator for the system.java.lang.NullPointerException - if generator is nullpublic ResourceBundleKeyGenerator getDefaultResourceKeyGenerator()
public static ResourceBundleManager getResourceBundleManager()
protected java.util.concurrent.ConcurrentHashMap<java.lang.String,AppBundleInfoRT> getAppBundleInfoMap()
public static void setResourceBundleManager(ResourceBundleManager bundleManager)
public void registerResourceBundleType(ResourceBundleType bundleType)
ResourceBundleWrapper
class with the same id as an
existing type, the new type will override the previous type registration.
bundleType - the resource bundle type to add to the systemjava.lang.NullPointerException - if bundleType is
nullpublic java.util.List<ResourceBundleType> getResourceBundleTypes()
ResourceBundleTypes that have been registeredpublic static ChainedBundleFactory getChainedBundleFactory()
public static void setChainedBundleFactory(ChainedBundleFactory factory)
factory - the ChainedBundleFactory to use when creating chained bundlespublic static AppBundleInfoFactory getAppBundleInfoFactory()
public static void setAppBundleInfoFactory(AppBundleInfoFactory factory)
factory - the AppBundleInfoFactory to use when creating an AppBundleInfo