Example: Modifying attributes with the AdminConfig object
The modify command changes objects in the configuration. In the wsadmin tool, the AdminConfig attributes command displays configuration object types, or object metadata, and does not represent a particular configuration object. This article discusses using the metadata information to modify configuration objects.
- Modify simple attributes
For example:
$AdminConfig modify $myex1 {{attr1 sampleStringValue}}or$AdminConfig modify $myex1 "{attr1 sampleStringValue}"For multiple attributes:
$AdminConfig attributes ExampleType2 "attr1 String" "attr2 Boolean" "attr3 Integer" $AdminConfig modify $myex2 {{attr1 "new string"} {attr2 false} {attr3 43}}In this example, you supply values for all three of the attributes that the ExampleType2 defines. If you enter the following:
$AdminConfig modify $myex2 {{attr3 43}}The attr1 and attr2 attributes would not change.
The following is an example that uses an attribute of ENUM type:
$AdminConfig attributes ExampleType3 "attr4 ENUM(ALL, SOME, NONE)" $AdminConfig modify $myex3 {{attr4 NONE}}- Modify nested attributes
For example, you want to modify the ex10 attribute of an object of type ExampleType9:
$AdminConfig attributes ExampleType9 "attr9a String" "ex10 ExampleType10" $AdminConfig attributes ExampleType10 "attr10a String"There are two ways to modify this object:
- Modify this attribute directly. Perform the following steps:
- Obtain the configuration ID of the ex10 object:
$AdminConfig show $myex9 {attr9a MyFavoriteStrings} {ex10 MyEx10(cells/mycell/adocument.xml#ExampleType10_1)}- Modify the ExampleType10 object:
$AdminConfig modify MyEx10(cells/mycell/adocument.xml#ExampleType10_1) {{attr10a yetAnotherString}}- Modify the nested attribute of its containing object. Use the nested attributes syntax:
$AdminConfig modify $myex9 {{ex10 {{attr10a yetAnotherString}}}}
- Modify list attributes
List attribute values represent a list of objects. For example, the ServerCluster type has an attribute called BackupClusters which contains an object collection of the BackupCluster type. The syntax for this type of attribute involves the members of the collection containing an extra set of braces around them, for example:
$AdminConfig modify $cluster1 {{backupClusters {{{backupClusterName cell20}} {{backupClusterName bc4}}}}}In this example, the modify command takes a string that represents a list of attributes, a single attribute called backupClusters. The backupClusters attribute contains a list of objects of of type BackupCluster. The list contains two objects, and each object is represented by exactly one attribute. {{backupClusterName cell20}} represents one object of the BackupCluster type, {{backupClusterName bc4}} represents a second BackupCluster object, and {{{backupClusterName cell20}} {{backupClusterName bc4}}} is the collection of these objects associated with the backupClusters attribute. The same syntax is required even if there is only a single object in the list. When supplying these list attributes, the list is added to the existing list. Be aware that there is no way to delete from a list. To remove the entire list, set the value of a list attribute to an empty string, for example, (""). The modify command given in the above example, results in the addition of the backupClusters attribute to the existing contents.
The following is an example of modifying a nested attribute:
$AdminConfig modify $cluster1 {{name "App Cluster #3"} {preferLocal false} {enableDynamicWLM true} {backupClusters {{{backupClusterName cell20} {domainBootstrapAddress {{port 555} {host myhost}}}} {{backupClusterName rrkbc4}}}} {members {{{weight 1} {memberName name1}} {{weight 2} {memberName name2}} {{weight 3} {memberName name3}}}}}This example list has five attributes: name, preferLocal, enableDynamicWLM, backupClusters, and members. The members attribute is a list of three objects, each of which consists of two sub-attributes, weight and memberName. The backupClusters attribute is a list of two objects. The first of these objects contains one simple subattribute and one complex subattribute. The complex subattribute contains two more subattributes, port and host.
The final variation on specifying configuration objects relates to the fact that some attributes represent generic objects that have different types of values. When you use the AdminConfig attributes command to display the attributes of an object, the various possibilities for specific types are shown in parentheses, for example:
$AdminConfig attributes MyType "name String" "components Component(SpecificType1, SpecificType2, SpecificType3)*"In this example, the component attribute represents a list of objects. Each member of the components attribute is the component type. Component is a generic type with three specific subtypes. When you specify an attribute in a modify or create command, specify the type of component. If you do not specify the type of component, a generic component object is assumed. To specify a particular component, use components:SpecificType1 instead of components, for example:
$AdminConfig modify $myMyType {{name name1} {components:SpecificType2 {{{attr1 val1} {attr2 val2}} {{attr1 val1a} {attr2 val2a}}}}}This command modifies two attributes of the myMyType object: name and components.
- Modify string list attributes
String list attributes have several attributes on various objects. These objects have the String* type, which is a list of strings. These attributes can represent class paths, for example. To update this list of strings, separate the members of the list by semi-colons. Use semi-colons with all platforms. The syntax for modifying these attributes is a list of strings, and not lists of attribute or name-value pairs, for example:
$AdminConfig modify $obj1 {{classpath c:/mine/one.jar;"c:/Program Files/two.jar";f:/myother/three.jar"}}