|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.prefs.registry.PrefsRegistry
This class is responsible for managing the Preferences Registry. The Preference
Registry consists of two parts. The first is the Registry of Localized
Preference data such as Perference Names, Descriptions and so forth. The
second part is the Preference Meta-Data such as information on the type of
Preference, The UI Renderer etc. Most methods will require a Fully Qualified
keyname as an argument. A Fully Qualified Preference keyname is of the form:
/wt/prefs/delegates/DelegateOrder
The prefRegisty[_XX_YY].class files (where optionally the XX is the language and YY is the country, such as prefRegistry_en_US.class) will exist for each of the supported locales in Windchill, and contain the Preference Localized Data for all Preferences shipped with the Windchill product. The custRegistry is the customized registry. Windchill provides an empty custRegistry.rbInfo file which may be customized by the customizers to meet the locale requirements of a customer. Any key may exist in both the customized registry and the preference registry, however the customized value will be retrieved first if it exists and will supercede the Windchill registry entry. This is useful if a customer wishes to expand/decrease the information provided for a preference, or rename a preference from the client side. See the registry rbInfo files for details on the correct format to use for the key/names if creating entries in the rbInfo files. Instructions on the compiling rbInfo files should be located in the Windchill Customizers Guide.
Along with Preference Registry rbInfo files, there are a pair of properties
files which are used to store non-localized data which may be required for
the use of certain preferences. This may include information such as a
class name to invoke for the given preference, a Preference Type etc. These files
are located in the wt/prefs/registry under the codebase folder and are called:
Like the registry files, these files will load the Preference properties
first followed by the customization properties second overriding any
properties that are in common. Thus the customized file has the 'final say'
on the given property. The format of the property values are described in
the properties files themselves. Values may be retrieved using the
getValue(String,[String])
methods below.
Alternatively, a grouping
of properties may be obtained via the
getValues(String,String)
method.
The properties files can be reloaded dynamically at runtime without having
to shutdown the MethodServer and restarting by invoking the method
reloadProperties()
or by invoking this class from the command
prompt (if in a development environment) using java
wt.prefs.registry.PrefsRegistry
Supported API: true
Extendable: false
Field Summary | |
static String |
BOOLEAN_LABEL
The constant for Boolean type labels |
private static String |
coreResource
The constant for Windchill preference Registry |
private static String |
custInfoFilename
Static filename for the customized Infos |
static String |
CUSTOM_RENDERER
Properties File OnlyThe constant for Custom Renderer Tags which determine the renderer to use. |
private static String |
custResource
The constant for customized preference Registry |
static String |
DEFAULT
The constant for the local default value |
static String |
DESCRIPTION
The constant for the local description |
static String |
DIRECTORY_ONLY
Properties File Only The constant for Directory Only Preferences. |
static String |
DISPLAY_NAME
The constant for the local display name |
private static boolean |
isLoaded
static constant for loading of preferences |
private static String |
prefInfoFilename
Static filename for the preference Infos |
private static Properties |
prefProperties
Static property file for customizations |
private static String |
RESOURCE
static constant for the preference resource bundles |
static String |
SHORT_DESCRIPTION
The constant for the local short description |
static String |
SUFFIX_TOKEN
delimiter for separation of keyname from suffix in properties files |
static String |
TEXT_LABEL
The constant for the local list of valid values |
static String |
TYPE
Properties File Only The constant for Preference Type |
static String |
USER_VISIBLE
Properties File Only The constant for The User Visible Property flag. |
static String |
VALID_VALUES
The constant for Valid Values |
Fields inherited from interface wt.method.RemoteAccess |
versionID |
Constructor Summary | |
PrefsRegistry()
|
Method Summary | |
private static void |
addToVector(Vector vec,
String key)
|
private static String |
getLocalizedDefault(String keyname,
Locale aLocale)
Deprecated. |
static String |
getLocalizedDescription(String keyname,
Locale aLocale)
This method will return the localized description for the given key name. |
static String |
getLocalizedName(String keyname,
Locale aLocale)
This method will return the localized name of the preference given a fully qualified key name. |
static String |
getLocalizedShortDescription(String keyname,
Locale aLocale)
This method will return the localized short description for the given key name. |
protected static String |
getLocalizedValue(String keyname,
Locale locale)
This method will get a localized value from the Registry whose name is a valid keyname. |
static String |
getLocalizedValue(String keyname,
String constant,
Locale locale)
This method will get a localized value from the Registry using the keyname and a constant. |
static HashMap |
getLocalizedValues(String keyname,
String constant,
Locale locale)
This method will return a map of Localized Values from the registry. |
static Vector |
getRegistryKeys()
This method will return a list of all the Registry Keys that are in the the registry that may be used to query the registry. |
protected static String |
getValue(String keyname)
This method will return an entry from the Preference property Information file for the given formated keyname. |
static String |
getValue(String keyname,
String suffix)
This method will return an entry from the Preference property Information files for the given keyname and optional suffix. |
static HashMap |
getValues(String keyname,
String suffix)
This method will return a map of all the values which are referenced by the designated keyname and optional suffix from the properties file. |
static void |
initializeProperties()
This method will initialize the properties object by re-reading the properties files, and creating the properties object if required. |
static void |
main(String[] args)
This method serves as a way to flush the properties registry files at runtime, which is useful if a developer wants to change the properties file without shutting down and restarting the method servers. |
static void |
reloadProperties()
This method will cause the properties files to be reinitialized within the Preference Registry within the MethodServer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SUFFIX_TOKEN
public static final String DISPLAY_NAME
public static final String DESCRIPTION
public static final String DEFAULT
public static final String TEXT_LABEL
public static final String SHORT_DESCRIPTION
public static final String VALID_VALUES
public static final String BOOLEAN_LABEL
public static final String CUSTOM_RENDERER
public static final String DIRECTORY_ONLY
public static final String TYPE
public static final String USER_VISIBLE
private static final String coreResource
private static final String custResource
private static Properties prefProperties
private static final String custInfoFilename
private static final String prefInfoFilename
private static boolean isLoaded
private static final String RESOURCE
Constructor Detail |
public PrefsRegistry()
Method Detail |
public static final String getLocalizedName(String keyname, Locale aLocale)
keyname
- The preference key.aLocale
- The locale of the key
public static final String getLocalizedDescription(String keyname, Locale aLocale)
keyname
- The preference key.aLocale
- The locale of the key
public static final String getLocalizedShortDescription(String keyname, Locale aLocale)
keyname
- The preference key.aLocale
- The locale of the key
private static String getLocalizedDefault(String keyname, Locale aLocale)
keyname
- The preference key.aLocale
- The locale of the key.
public static Vector getRegistryKeys()
SUFFIX_TOKEN
will be parsed off. Essentially, it returns a vector of all the keys
for which there is some registry entry for.
private static void addToVector(Vector vec, String key)
protected static String getLocalizedValue(String keyname, Locale locale)
DISPLAY_NAME
. The
customized resource bundle will be searched first, followed by the preference
resource bundle provided by Windchill.
If none of these are found the properties
files will be searched for an entry in an alternate resource bundle.
keyname
- The keyname to search for (well-formed)locale
- The locale to search for the key in.
public static String getLocalizedValue(String keyname, String constant, Locale locale)
keyname
- The fully Qualified Preference Key name.constant
- The constant (either defined above or not)locale
- The locale for the value
public static HashMap getLocalizedValues(String keyname, String constant, Locale locale)
/wt/test/Sample%VALID_VALUES=ACCEPT_BUTTON,DENY_BUTTON
getLocalizedValues()
method
would expect a keyname of /wt/test/Sample
and a constant of %VALID_VALUES
. This would then be queried
in the properties files. The values ACCEPT_BUTTON
and
DENY_BUTTON
would then be requested from the registry under the
registry key of /wt/test/Sample%VALID_VALUES.ACCEPT_BUTTON
for example, and this value would be placed in the HashMap.
keyname
- The name of the preference keyconstant
- The optional constant to append to the keylocale
- The locale of the Preference values.
protected static String getValue(String keyname)
getValue(String,String)
below to
retrieve the property as this will insure a properly formated keyname is
generated.
keyname
- The fully qualified formated keyname.
public static final String getValue(String keyname, String suffix)
keyname
- The key name for the preference.suffix
- The optional suffix (without the SUFFIX_TOKEN)
public static HashMap getValues(String keyname, String suffix)
/wt/test/Sample%VALID_VALUES=ACCEPT_FLAG,DENY_FLAG
ACCEPT_FLAG
and DENY_FLAG
) these properties are
looked up in the Prefernce Property files. Any values found will be returned
in the map. If the value can not be found, the map will contain the value
obtained from the reference (for example ACCEPT_FLAG
) for both
the map key and value.
%VALID_VALUES
was used, however any suffix is valid.
keyname
- The keyname to retrievesuffix
- The suffix to retrive the information under.
public static void initializeProperties() throws IOException
IOException
- Thrown if there is an error reading the files.public static void reloadProperties() throws IOException, WTException
IOException
- Thown if there is an error reading the files.
WTException
public static void main(String[] args)
args
- (ignored)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |