|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ptc.windchill.cadx.common.preference.EpdParams
This preference system serves up key-value pairs, directory locations or file locations. It is designed to be flexible enough to solve most user preference issues in that it is up to the implementation team as to which settings are policies and which can be modified by the users or overridden on the command line. It consists of six distinct areas which are searched for the desired objects:
It is intended that the site and default directories would ultimately reside on network disks, protected from user changes, giving the administrators the ability to force certain preferences to be policy rather than the typical arrangement of copying files to all workstations, only to have the users change the control files immediately after the transfers. By specifying those policy values and by providing basic defaults for all options in these two directories, the administrators get the control they need, yet the users can still tailor the application to suit their tastes.
A major difference between this implementation and most property retrieval routines is that the key is main unit being searched for, not the file. Just because an infobrowser.ini file is found in the site dir it does not mean that all preferences stored in infobrowser.ini must be found in that site dir based file. Each key is searched for independently of where any other key has been located.
For example, the infobrowser.ini file might have a geometry section containing top, left, width, and height as keys. The administrator may wish to force the infobrowser to always be top=0 and left=0, yet leave the width and height to the user. To do this, the site dir must contain an infobrowser.ini file with a geometry section and ONLY top=0 and left=0 as the keys in the section. As long as width and height are not specified in the site dir, the user may override them on the command line or in another infobrowser.ini file in the user dir that contains a geometry section and key-value pairs for width and height. To be sure there are first-use values for the width and height (the application will update the settings every time the size or position is changed, but would have no original setting), the administrator could also provide an infobrowser.ini file in the default dir and have default values of top=0, left=0, width=400, height=800.
It has three main access methods for finding objects:
IMPORTANT: in order to locate the preference files, the command arguments / parameters "siteDir", "userDir", and "defaultDir" are needed to fix the directory locations needed by the preference system. If none are specified, then all preference data must be supplied in the file.section.key=value format in the command arguments / parameters. These arguments cannot be found anywhere but on the command line since there is no way to locate the files to find these keys unless the keys were set on the command line. It is intended that eventually an LDAP server would supply these keys to the application based on the user, host and the platform type they are currently using.
Implementation note: If only one directory is going to be used, it would be best to use userDir, since without it, no "set" operations can occur. The next level is to add defaultDir with the site default values for the preferences. Finally, add siteDir when it becomes necessary to set site-wide policies. This preference system keeps one UserParams object per user.
Field Summary | |
static String |
CADXHTMLUI_DATA_SOURCE
|
static String |
NEWWORKSPACE_SECTION
|
static String |
PARTCENTRIC_DEFAULT_VALUE
|
static String |
PARTCENTRIC_KEY
|
private static HashMap |
userPrefMap
|
Constructor Summary | |
EpdParams()
|
Method Summary | |
boolean |
deleteEpdParameter(String key,
String dataSource,
String section,
String val)
This method allows applications to delete values of parameters in the $userDir/datasource.ini file, in memory. |
static boolean |
doesEpdParameterExist(String key,
String dataSource,
String section)
Read a parameter for a specific datasource from within a specific Section in a specific Ini File. |
static String |
getEpdParameter(String key,
String dataSource,
String section,
String defVal)
Read a parameter for a specific datasource from within a specific Section in a specific Ini File. |
static Collection |
getEpdParameterIgnoringCase(String key,
String dataSource,
String section,
String defVal)
Read a parameter for a specific datasource from within a specific Section in a specific Ini File ignoring case of "key" argument. |
private static UserParams |
getUserParam()
|
void |
reload()
reset EpdParameters to force them to be reread from a file |
static void |
saveAllUserIni()
Saves all userDir based settings. |
static boolean |
saveUserIni(String dataSource)
This method allows the user to save the $userDir/datasource.ini file to disk, if the file/url permissions permit it. |
static boolean |
setEpdParameter(String key,
String dataSource,
String section,
String val)
This method allows applications to add/change values of parameters in the $userDir/datasource.ini file, in memory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String CADXHTMLUI_DATA_SOURCE
public static final String NEWWORKSPACE_SECTION
public static final String PARTCENTRIC_KEY
public static final String PARTCENTRIC_DEFAULT_VALUE
private static HashMap userPrefMap
Constructor Detail |
public EpdParams()
Method Detail |
private static UserParams getUserParam()
public static String getEpdParameter(String key, String dataSource, String section, String defVal)
public static boolean doesEpdParameterExist(String key, String dataSource, String section)
public static Collection getEpdParameterIgnoringCase(String key, String dataSource, String section, String defVal)
public static boolean setEpdParameter(String key, String dataSource, String section, String val)
public boolean deleteEpdParameter(String key, String dataSource, String section, String val)
public static boolean saveUserIni(String dataSource)
public static void saveAllUserIni()
public void reload()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |