Create configuration objects using the wsadmin tool

Overview

Perform this task if you want to create an object. To create new objects from the default template, use the create command. Alternatively, you can create objects using an existing object as a template with the createFromTemplate command.

  1. Invoke the AdminConfig object commands interactively, in a script, or use the wsadmin -c command from an operating system command prompt.

  2. Use the AdminConfig object listTemplates command to list available templates:

    Using Jacl:

    $AdminConfig listTemplates JDBCProvider

    [V5.1 and later]Using Jython:

    AdminConfig.listTemplates('JDBCProvider')

    where:

    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    listTemplates is an AdminConfig command
    JDBCProvider is an object type


  3. Assign the ID string that identifies the existing object to which the new object is added. You can add the new object under any valid object type. The following example uses a node as the valid object type:

    Using Jacl:

    set n1 [$AdminConfig getid /Node:mynode/]

    [V5.1 and later]Using Jython:

    n1 =  AdminConfig.getid('/Node:mynode/')

    where:

    set is a Jacl command
    $ is a Jacl operator for substituting a variable name with its value
    n1 is a variable name
    AdminConfig is an object representing the WebSphere Application Server configuration
    getid is an AdminConfig command
    Node is an object type
    mynode is the host name of the node where the new object is added


  4. Specify the template that you want to use:

    Using Jacl:

    set t1 [$AdminConfig listTemplates JDBCProvider "DB2 JDBC Provider (XA)"]

    [V5.1 and later]Using Jython:

    t1 = AdminConfig.listTemplates('JDBCProvider', 'DB1 JDBC Provider (XA)')

    where:

    set is a Jacl command
    $ is a Jacl operator for substituting a variable name with its value
    t1 is a variable name
    AdminConfig is an object representing the WebSphere Application Server configuration
    listTemplates is an AdminConfig command
    JDBCProvider is an object type
    DB1 JDBC Provider (XA) is the name of the template to use for the new object


    If you supply a string after the name of a type, you get back a list of templates with display names that contain the string you supplied. In this example, the AdminConfig listTemplates command returns the JDBCProvider template whose name matches DB2 JDBC Provider (XA).

  5. Create the object with the following command:

    Using Jacl:

    $AdminConfig createUsingTemplate JDBCProvider $n1 {{name newdriver}} $t1

    [V5.1 and later]Using Jython:

    AdminConfig.createUsingTemplate('JDBCProvider', n1, [['name', 'newdriver']], t1)

    where:

    $ is a Jacl operator for substituting a variable name with its value
    AdminConfig is an object representing the WebSphere Application Server configuration
    createUsingTemplate is an AdminConfig command
    JDBCProvider is an object type
    n1 evaluates the ID of the host node specified in step number 3
    name is an attribute of JDBCProvider objects
    newdriver is the value of the name attribute
    t1 evaluates the ID of the template specified in step number 4


    Note: All create commands use a template unless there are no templates to use. If a default template exists, the command creates the object.

  6. Save the configuration changes with the following command:

    Using Jacl:

    $AdminConfig save

    [V5.1 and later]Using Jython:

    AdminConfig.save()

    Use the reset command of the AdminConfig object to undo changes that you made to your workspace since your last save.


Related reference
Example: Finding available templates