Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Scripting for naming and directory


Configure namespace bindings using the wsadmin scripting tool

Use this topic to configure name space bindings with the Jython or Jacl scripting languages and wsadmin.sh. Use this task and the following examples to configure string, EJB, CORBA, or indirect name space bindings on a cell.


Procedure

  1. Start wsadmin.sh.

  2. Identify the cell and assign it to the cell variable.

    ### Jacl

    set cell [$AdminConfig getid /Cell:mycell/]
    

    Example output:

    mycell(cells/mycell|cell.xml#Cell_1)
    

    ### Jython

    cell = AdminConfig.getid('/Cell:mycell/')
    print cell 
    We can change this example to configure on a node or server here.

  3. Add a new name space binding on the cell. There are four binding types to choose from when configuring a new name space binding. They are string, EJB, CORBA, and indirect.

    • To configure a string type name space binding:

      ### Jacl

      $AdminConfig create StringNameSpaceBinding $cell {{name binding1} {nameInNameSpace
      myBindings/myString} {stringToBind "This is the String value that gets bound"}}
      

      Example output:

      binding1(cells/mycell|namebindings.xml#StringNameSpaceBinding_1)
      

      ### Jython

      print AdminConfig.create('StringNameSpaceBinding', cell, [['name', 'binding1'],
      ['nameInNameSpace', 'myBindings/myString'], ['stringToBind', "This is the String value that gets bound"]])
      

    • To configure an EJB type name space binding:

      ### Jacl

      $AdminConfig create EjbNameSpaceBinding $cell {{name binding2} {nameInNameSpace myBindings/myEJB}
      {applicationNodeName mynode} {bindingLocation SINGLESERVER} {applicationServerName server1}
      {ejbJndiName ejb/myEJB}}
      

      ### Jython

      print AdminConfig.create('EjbNameSpaceBinding', cell, [['name', 'binding2'],  ['nameInNameSpace',
      'myBindings/myEJB'], ['applicationNodeName', 'mynode'],  ['bindingLocation', 'SINGLESERVER'],
      ['applicationServerName', 'server1'], ['ejbJndiName', 'ejb/myEJB']])
      

      This example is for an EJB located in a server. For an EJB in a cluster, change the configuration example to:

      ### Jacl

      $AdminConfig create EjbNameSpaceBinding $cell {{name binding2} {nameInNameSpace myBindings/myEJB}
      {bindingLocation SERVERCLUSTER} {applicationServerName cluster1} {ejbJndiName ejb/myEJB}}
      

      ### Jython

      print AdminConfig.create('EjbNameSpaceBinding', cell, [['name','binding2'],
      ['nameInNameSpace','myBindings/myEJB'], ['bindingLocation','SERVERCLUSTER'],
      ['applicationServerName','cluster1'], ['ejbJndiName','ejb/myEJB']])
      

      Example output:

      binding2(cells/mycell|namebindings.xml#EjbNameSpaceBinding_1)
      

    • To configure a CORBA type name space binding:

      ### Jacl

      $AdminConfig create CORBAObjectNameSpaceBinding $cell {{name binding3} {nameInNameSpace
      myBindings/myCORBA}{corbanameUrl corbaname:iiop:somehost.somecompany.com:2809#stuff/MyCORBAOjbect}
      {federatedContext false}}
      

      Example output:

      binding3(cells/mycell|namebindings.xml#CORBAObjectNameSpaceBinding_1)
      

      ### Jython

      print AdminConfig.create('CORBAObjectNameSpaceBinding', cell, [['name', 'binding3'],['nameInNameSpace',
      'myBindings/myCORBA'],['corbanameUrl','corbaname:iiop:somehost.somecompany.com:2809#stuff/MyCORBAOjbect'],
      ['federatedContext', 'false']])
      

    • To configure an indirect type name space binding:

      ### Jacl

      $AdminConfig create IndirectLookupNameSpaceBinding $cell
      {{name binding4} {nameInNameSpace myBindings/myIndirect} {providerURL
      corbaloc::myCompany.com:9809/NameServiceServerRoot} {jndiName jndi/name/for/EJB}}
      

      Example output:

      binding4(cells/mycell|namebindings.xml#IndirectLookupNameSpaceBinding_1)
      

      ### Jython

      print AdminConfig.create('IndirectLookupNameSpaceBinding', cell, [['name', 'binding4'],
      ['nameInNameSpace','myBindings/myIndirect'], ['providerURL', 'corbaloc::myCompany.com:9809/NameServiceServerRoot'],
      ['jndiName', 'jndi/name/for/EJB']])
      

  4. Save the configuration changes.

    Save the configuration changes:

    AdminConfig.save()
    


Start the wsadmin scripting client using wsadmin.sh
Use the script library to automate the application serving environment using wsadmin.sh
Enable and disable security using scripting
Use wsadmin scripting
Get started with wsadmin scripting

+

Search Tips   |   Advanced Search