You can specify to create, modify, and delete objects in
one properties file. You run the applyConfigProperties command
to apply the configuration changes.
Before you begin
Determine the changes that you want to make to configuration
objects.
About this task
Using the PropertiesBasedConfiguration command group for
the AdminTask object, you can use properties files to create, modify,
and delete configuration objects from your environment.
You
can create, delete, and modify objects using one properties file.
Specify in the header of the properties section DELETE=true
to
delete an entire object or DELTEPROP=true
to delete
an object property and then run the applyConfigProperties command
to apply the properties file. With this approach, you do not need
to run the deleteConfigProperties command to delete
an object.
Note: You cannot
apply a z/OS® operating system properties file directly
to a distributed operating system. Similarly, you cannot apply a
distributed operating system properties file directly to a z/OS operating
system. See the topic on applying portable properties files across
multiple environments.
Procedure
- Start the wsadmin scripting tool.
- Extract a properties file for the subtype of interest from
your configuration.
Use the
extractConfigProperties command
to extract the properties file for the resource of interest. The following
example extracts the properties for the JDBCProvider resource to the
derby.props file:
AdminTask.extractConfigProperties('[-propertiesFileName derby.props -configData
Server=server1 -filterMechanism SELECTED_SUBTYPES -selectedSubTypes [JDBCProvider]]')
The
command generates a template file similar to the following sample
template:
#
# SubSection 1.0 # JDBCProvider attributes
#
ResourceType=JDBCProvider
ImplementingResourceType=JDBCProvider
ResourceId=Cell=!{cellName}:ServerCluster=!{clusterName}:JDBCProvider=Derby JDBC
Provider (XA)
#
#
#Properties
#
classpath={${DERBY_JDBC_DRIVER_PATH}/derby.jar}
name=Derby JDBC Provider (XA) #required
implementationClassName=org.apache.derby.jdbc.EmbeddedXADataSource #required
isolatedClassLoader=false #boolean,default(false)
nativepath={}
description=Built-in Derby JDBC Provider (XA)
providerType=Derby JDBC Provider (XA) #readonly
xa=true #boolean,default(false)
- Edit the extracted properties file to specify that it create,
modify, or delete configuration objects.
To create a
new object or modify or delete an existing object, edit the extracted
properties file. You can specify one or more create, modify, and delete
operations in the same properties file.
- To create a new object, specify unique properties for an object.
Set the ResourceId attribute to a value that does not exist in your
configuration.
The following example creates a new DataSource object,
DefaultDatasource_1, which does not exist in the configuration:
#
# Create a new object
#
ResourceType=DataSource
ImplementingResourceType=GenericType
ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource_1
#
#
#Properties
#
name=Default Datasource1 #required
jndiName=DefaultDatasource_1
manageCachedHandles=false #boolean,default(false)
provider=Derby JDBC Provider #ObjectName(JDBCProvider),readonly
description=Datasource for the WebSphere Default Application
logMissingTransactionContext=true #boolean,default(true)
- To modify an existing object, change one or more object properties.
The
following example changes the description
property
of the DefaultDatasource_1 object by adding _1
to
the end of the description:
#
# Modify a property
#
ResourceType=DataSource
ImplementingResourceType=GenericType
ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource_1
#
#
#Properties
#
description=Datasource for the WebSphere Default Application_1
- To delete an existing object property, specify
DELETEPROP=true
in
the header of the properties file.The following example deletes
the description
property:
#
# Delete a property
#
ResourceType=DataSource
ImplementingResourceType=GenericType
ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource_1
DELETEPROP=true
#
#
#Properties
#
description=Datasource for the WebSphere Default Application_1
- To delete an existing object, specify
DELETE=true
in
the header of the properties file.The following example deletes
the DefaultDatasource
object:
#
# Delete an existing object
#
ResourceType=DataSource
ImplementingResourceType=GenericType
ResourceId=Cell=!{cellName}:Node=!{nodeName}:Server=!{serverName}:JDBCProvider=Derby JDBC Provider:DataSource=jndiName#DefaultDatasource
DELETE=true
#
#
#Properties
#
name=Default Datasource #required
jndiName=DefaultDatasource
- Run the applyConfigProperties command
to apply the properties file and change your configuration.
The
following example command applies the derby.props properties
file:
AdminTask.applyConfigProperties('[-propertiesFileName derby.props]')
The command automatically validates the properties
file, then applies the changes to your configuration.
Avoid trouble: If you run the applyConfigProperties command
before you add the DELETE=true
attribute and value
to the properties file, the command resets each property to the default
value. The system completely removes properties that do not have default
values.
Results
The administrative command runs and applies the properties
file.
What to do next
Save the changes to your configuration.