Intelligent Management: runtime operations user preferences administrative tasks
We can use the Jacl and Jython scripting languages to clone, set, and get preferences with wsadmin.sh. Use commands in the UserPreferences group.
User preferences are stored under the cell context or in the context for each resource type. The following list gives examples at the cell level and each resource level:
- cells/myCell/preferences/User_1/preferenceset.xml
- cells/myCell/applications/TestAppA.ear/preferences/User_1/preferenceset.xml
- cells/myCell/nodes/myNode/servers/myServer/preferences/User_1/preferenceset.xml
- cells/myCell/clusters/myCluster/preferences/User_1/preferenceset.xml
- cells/myCell/serviceclasses/Platinum/preferences/User_1/preferenceset.xml
Use the following commands to work with the preferences for runtime operations:
For examples using Jython to interact with preferences objects, see Jython preferences object commands.
clonePreference
The clonePreference command copies a preference from one user or role to another user or role.
Target object:
The configID of the parent.
Required parameters
-name Name of the preference to clone. (String, required)
Optional parameters
- scope: Scope of the preference to save when the preferences are cloned. If we do not specify a scope, the scope of the configID is used. (String, optional) The scope can be one of the following values:
- Applications
- Servers
- Clusters
- ServiceClasses
- touser: User for which to retrieve preferences. If we do not indicate this value, the default uses the user ID for the session in which the command is running. (String, optional)
- torole: Role for which to retrieve preferences. This value is ignored if specified the -touser parameter. (String, optional)
- fromuser: User that gets a copy the preferences. We can indicate multiple users by putting the users in a list, for example: user1,user2,user3. Do not put spaces in the list. (String, optional)
- fromrole: Role that gets a copy of the preferences. (String, optional)
Batch mode example
- Jython:
cellid= AdminConfig.getid("/Cell:myCell") AdminTask.clonePreference(cellid, '[-name ChartGroups -fromuser user1 -touser user2,user3,user4,user5]') AdminConfig.save()
- Jacl:
$AdminTask clonePreference cells/dabtcCell02|cell.xml#Cell_1 {-name ChartGroups -fromuser user1 -touser user2,user3,user4,user5}
Interactive mode
- Jython:
AdminTask.clonePreference('[-interactive]')
- Jacl:
$AdminTask clonePreference {-interactive}
getPreferences
The getPreferences command returns a collection of preferences based on the preference document specified by passing in a role or user name. We must have administrator privileges to get preferences for a certain user or user role.
Target object:
The configID of the parent.
Required parameters
- name: Name of the preference. (String, required)
Optional parameters
- scope: Specifies a scope for the preferences. We can choose from one of the following valid values:
- Applications
- Servers
- Clusters
- ServiceClasses
The default scope is empty, or undefined. If the scope is empty, the scope is derived from where the document is being read. For example, if the document is in the cell scope, then the scope is cell scoped. If the document is in a specific server context, then the scope is assumed to be applicable to that server. (String, optional)
- user: User name for which to retrieve preferences. If we do not indicate a user, the default action is to use the user name running the script. (String, optional)
- role: User role for which to retrieve preferences. (String, optional)
Return value
The command returns a DescriptivePropertyGroup object containing the preferences, or null if no preferences are found.
Batch mode example
- Jython string...
cellid= AdminConfig.getid("/Cell:myCell") AdminTask.getPreferences(cellid, '[-name ChartGroups -user user1]')
- Jacl:
$AdminTask getPreferences cells/dabtcCell02|cell.xml#Cell_1 {-name Reports -user user1}
Interactive mode
- Jython string...
AdminTask.getPreferences('[-interactive]')
- Jacl:
$AdminTask getPreferences {-interactive}
setPreference
The setPreference command sets a specific preference in a preference document. We must have administrator privileges to set preferences for a certain user or user role.
Target object:
The configID of the parent.
Required parameters
- name: Name of the preference. (String, required)
- propertyLongName: Fully-qualified path to the property in the property group, delimited by a forward slash (/) character. If the property is directly contained in the root property group, then the short name of the property can be used because it would be exactly equal to the long name. (String, required)
- propertyValue: New value to set for the preference. (String, required)
Optional parameters
- scope: Scope of the preference to save when the preferences are cloned. If we do not specify a scope, the scope of the configID is used. (String, optional) The scope can be one of the following values:
- Applications
- Servers
- Clusters
- ServiceClasses
- user: User name for which to save preferences. If we do not indicate a user, the default action is to use the user name running the script. (String, optional)
- role: User role for which to save preferences. (String, optional)
Batch mode example
- Jython string...
AdminTask.setPreference(cellid, '[-name myChartGroup -propertyLongName defaultChartSize -propertyValue large]')
- Jacl:
$AdminTask setPreference cells/dabtcCell02|cell.xml#Cell_1 {-name Reports -user user1 -propertyLongName defaultChartSize -propertyValue large}
Interactive mode
- Jython string...
AdminTask.setPreference('[-interactive]')
- Jacl:
$AdminTask setPreference {-interactive}
Jython preferences object commands
Use the following examples to interact with the preferences object with Jython commands:
To list preferences per user
prefSets = AdminConfig.list("PreferenceSet") print prefSetsTo remove preferences for a user
prefid = AdminConfig.getid("/PreferenceSet:User_1") AdminConfig.remove(prefid) AdminConfig.save()To list preferences for all users, grouped by user
prefs = AdminConfig.list("Preferences") print prefs
Related concepts
Runtime operations overview
Related tasks
Monitor Intelligent Management operations Create and manage reports
Intelligent Management: administrator scripting interface Reference topic