Package com.oracle.coherence.common.base
Class Resources
java.lang.Object
java.util.ResourceBundle
java.util.ListResourceBundle
com.oracle.coherence.common.base.Resources
Implement simple basis for package (and other) resources.
- Version:
- 1.00, 11/17/97
- Author:
- Cameron Purdy
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.ResourceBundle
ResourceBundle.Control
-
Field Summary
Fields inherited from class java.util.ResourceBundle
parent
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic URL
findFileOrResource
(String sName, ClassLoader loader) Return a URL to the specified file or resource, using the specified class loader or acontext ClassLoader
.static URL
findRelativeOrAbsoluteResource
(String sName, ClassLoader loader) Find the URL of the resource with the given name using the specifiedClassLoader
.static URL
findResource
(String sName, ClassLoader loader) Find the URL of the resource with the given name using the specified ClassLoader or the following Classes: The Thread ContextClassLoader
TheClassLoader
used to loadClasses
, which represents the Coherence Class Loader The SystemClassLoader
static URL
getFileURL
(String sName) Obtain a URL for an existing file with the specified name.Get the specified resource text.Get the specified resource string.Methods inherited from class java.util.ListResourceBundle
getContents, getKeys, handleGetObject, handleKeySet
Methods inherited from class java.util.ResourceBundle
clearCache, clearCache, containsKey, getBaseBundleName, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, keySet, setParent
-
Constructor Details
-
Resources
public Resources()
-
-
Method Details
-
getString
Get the specified resource text.- Parameters:
sKey
- the resource keysDefault
- returns this string if the resource cannot be found- Returns:
- the requested string, formatted if specified
-
getString
Get the specified resource string.- Parameters:
sKey
- the resource keyasParam
- an array of arguments to fill in replaceable parameterssDefault
- returns this string if the resource cannot be found- Returns:
- the requested string, formatted if specified
-
findResource
Find the URL of the resource with the given name using the specified ClassLoader or the following Classes:- The Thread Context
ClassLoader
- The
ClassLoader
used to loadClasses
, which represents the Coherence Class Loader - The System
ClassLoader
- Parameters:
sName
- the name of the resourceloader
- theClassLoader
used to locate the resource; if null, or resource is not found, the list ofClassLoader
s described above will be tried- Returns:
- the URL of the resource or null if the resource could not be found and the resource name is not a valid URL specification
- The Thread Context
-
findRelativeOrAbsoluteResource
Find the URL of the resource with the given name using the specifiedClassLoader
. An attempt is made with both a relative URL and an absolute (fully-qualified) URL if required. This method will only search the provided ClassLoader; it is recommended to usefindResource(String, ClassLoader)
for a more exhaustive search.- Parameters:
sName
- the name of the resourceloader
- the ClassLoader used to locate the resource; this method returns null if a null ClassLoader is provided- Returns:
- the URL of the resource or null if the resource could not be found or if a null ClassLoader is provided
- See Also:
-
getFileURL
Obtain a URL for an existing file with the specified name.- Parameters:
sName
- the name of the file- Returns:
- the file URL, or null if file does not exist
-
findFileOrResource
Return a URL to the specified file or resource, using the specified class loader or acontext ClassLoader
. This method attempts to locate a file with the specified name or path. If the file does not exist or cannot be read, this method attempts to locate a resource with the given name, using the specified class loader or context class loader. If a resource with the given name is not found, this method attempts to find the resource using a fully-qualified or relative version of the specified name. As a last attempt, the name will be treated as a URL.- Parameters:
sName
- the name of the file or resourceloader
- the ClassLoader used to locate the resource; if null,Classes.getContextClassLoader()
is used- Returns:
- the URL of the file or resource or null if the resource could not be found and the resource name is not a valid URL specification
-