Operating Systems: AIX, HP-UX, Linux, Solaris, Windows, z/OS
Runtime operations user preferences administrative tasks
You can use the Jacl and Jython scripting languages to clone, set, and get preferences with the wsadmin tool. Use the commands and parameters 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 on the cell level and at each resource level:
Use the following commands to work with the preferences for runtime operations:
- 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
clonePreference
The clonePreference command copies a preference from one user or role to another user or role.
Target object: The configID of the parent of where the preference is cloned.
Required parameters
- -name
- Name of the preference to clone. (String, required)
Optional parameters
- -scope
- Specifies the scope of the preference to save when the preferences are cloned. The scope can be one of the following values:
If you do not specify a scope, the scope of the configID is used. (String, optional)
- Applications
- Servers
- Clusters
- ServiceClasses
- -touser
- Specifies the user for which to retrieve preferences. If you do not indicate this value, the default uses the user ID for the session in which the command is running. (String, optional)
- -torole
- Specifies the role for which to retrieve preferences. This value is ignored if you specified the -touser parameter. (String, optional)
- -fromuser
- Specifies the user that gets a copy the preferences. You 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
- Specifies the role that gets a copy of the preferences. (String, optional)
Return value
The command returns
Batch mode example usage
- Use Jython:
cellid= AdminConfig.getid("/Cell:myCell") AdminTask.clonePreference(cellid, '[-name ChartGroups -fromuser user1 -touser user2,user3,user4,user5]') AdminConfig.save()- Use Jacl:
AdminTask getPreferences cells/dabtcCell02|cell.xml#Cell_1 {-name ChartGroups -fromuser user1 -touser user2,user3,user4,user5}Interactive mode example usage
- Use Jython:
AdminTask.clonePreference('[-interactive]')
getPreferences
The getPreferences command returns a collection of preferences based on the preference document you specify by passing in a role or user name. You 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. You can choose from one of the following valid values:
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)
- Applications
- Servers
- Clusters
- ServiceClasses
- -user
- Specifies the user name for which to retrieve preferences. If you do not indicate a user, the default action is to use the user name that is running the script. (String, optional)
- -role
- Specifies the user role for which to retrieve preferences. (String, optional)
Return value:
The command returns a DescriptivePropertyGroup object that contains the preferences, or null if no preferences are found.
Batch mode example usage
- Use Jython string:
cellid= AdminConfig.getid("/Cell:myCell") AdminTask.getPreferences(cellid, '[-name ChartGroups -user user1]')- Use Jacl:
$AdminTask getPreferences cells/dabtcCell02|cell.xml#Cell_1 {-name Reports -user user1}Interactive mode example usage
- Use Jython string:
AdminTask.getPreferences('[-interactive]')- Use Jacl:
$AdminTask getPreferences {-interactive}
setPreference
The setPreference command sets a specific preference in a preference document. You 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
- Specifies the 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
- Specifies a scope for the preferences. You can choose from one of the following valid values:
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)
- Applications
- Servers
- Clusters
- ServiceClasses
- -user
- Specifies the user name for which to save preferences. If you do not indicate a user, the default action is to use the user name that is running the script. (String, optional)
- -role
- Specifies the user role for which to save preferences. (String, optional)
Return value
The command returns
Batch mode example usage
- Use Jython string:
AdminTask.setPreference(cellid, '[-name myChartGroup -propertyLongName defaultChartSize -propertyValue large]')- Use Jacl:
$AdminTask setPreference cells/dabtcCell02|cell.xml#Cell_1 {-name Reports -user user1 -propertyLongName defaultChartSize -propertyValue large}Interactive mode example usage
- Use Jython string:
AdminTask.setPreference('[-interactive]')- Use 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 operations
Creating and managing reports
Related reference
Administrator scripting interfaces