• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2850
  • Last Modified:

Exporting WebSphere name space bindings and import into new WebSphere configuration

Hi folks,

I need help find a way to export  a big list of name space bindings from
to one WebSphere configuration to another.  There is 100+ in this
environment and may need to be done in several iterations, I am hoping
that a utility or script of some sort can help with this?

I have been looking at the dumpNameSpace tool but don't know if this will get me what I need 'easily'

Thanks!
0
hu8mypho
Asked:
hu8mypho
  • 9
  • 7
1 Solution
 
HonorGodCommented:
Unfortrunately, the information that you provide isn't very specific.

What version of WebSphere is beins used?

Is it a stand-alone application server, or a federated (multi-node server) environment?

Have you used the dumpNameSpace tool to see if the information is what you need?

For what it is, the dumpNameSpace tool does a reasonable job.  Remember that you can specify command line options to subset the information to be displayed.  For example:

dumpNameSpace -host myHost.myCompany.com

Remember though, that the specified target must be active.

To get the complete list of supported options, use:

dumpNameSpace -?
0
 
hu8myphoAuthor Commented:
I can use:
dumpNameSpace -host localhost -port 2809 -root cell -format jndi -report {short | long} > NameSpace.log

However, what I need to do is a way to import just the name space bindings under

Environemnt
  Naming
    Name Space Bindings

Under this, I have about 20 for this one base Server for instance, and it's all String type, I just want to be able to export and import into a new server configuration, somehow.  

The Dump tool gives way too much information that I don't know how to parse to just get what I want.
0
 
hu8myphoAuthor Commented:
I think what I need to do is use this reference:
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/txml_namespacebinding.html

with the output of the dump tool and some how use a jython script to import what I need back to a different configuration.

I guess what I need help with is the wsadmin scripting.  I'm adequate when working with the configurations and deploying apps.  Nothing fancy, but I can get it working and generic enough to be reuse for that one app across different systems. :-) .  Still working on the next step... But this will be a different Question.

Do you think you can help me with this and what information would be needed?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
HonorGodCommented:
Yes.

I know Jython scripting of the WebSphere Application Server environment very, very well.
0
 
HonorGodCommented:
Are you asking something for this question, or for this future question?
0
 
hu8myphoAuthor Commented:
For this question:

I have the output of the dumpNameSpace utility, how do I use wsadmin to create something and 'import' or define it in another configuration?

from this:
   26 (top)/persistent/TESTAPP/APP_SMTP_HOST
   26    Bound Java type: java.lang.String
   26    Local Java type: java.lang.String
   26    Corba binding type: org.omg.CosNaming.BindingType.nobject
   26    String representation: smtprelay.myhost.com

These are all string type bindings
nameSpaceBinding.png
0
 
HonorGodCommented:
From the information that you provide, it appears that you want the Jython statements that will allow you to create a String NameSpaceBinding.  To do this you first need to get
the configuration ID of the cell to which the Binding should be made.

wsadmin> cell = AdminConfig.getid( '/Cell:/' )

The reason that you need this is because the create method requires that the configID
of the "parent", or containing resource to be provided.

The parameters for the AdminConfig.create() method are:

- The type of the resouce to be created: i.e., 'StringNameSpaceBinding'
- The configID of the parent resource
- A list (or string list) of values to be used to create the item.

The values used to create the StringNameSpaceBinding have to be associated
with specific attribute names.  Using the values shown in your screen shot above,
these name/value pairs would be:

           name : APP_SMTP_HOST
nameInNameSpace : TESTAPP/APP_SMTP_HOST
   stringToBind : smtprelay.myhost.com

So, the list that you would need to provide on the create call would be:

values = [ [ 'name', 'APP_SMTP_HOST' ], [ 'nameInNameSpace', 'TESTAPP/APP_SMTP_HOST' ], [ 'stringToBind', 'smtprelay.myhost.com' ] ]

Given this assignment statement statement, the wsadmin jython statements that
could be used to create a StringNameSpaceBinding could be:


wsadmin>cell = AdminConfig.getid( '/Cell:/' )
wsadmin>name = 'APP_SMTP_HOST'
wsadmin>nInS = 'TESTAPP/APP_SMTP_HOST'
wsadmin>str  = 'smtprelay.myhost.com'
wsadmin>value = [ [ 'name', name ], [ 'nameInNameSpace', nInS ], [ 'stringToBind', str ] ]
wsadmin>print AdminConfig.create( 'StringNameSpaceBinding', cell, value )
APP_SMTP_HOST(cells/HonorGodNode01Cell|namebindings.xml#StringNameSpaceBinding_1227467842738)
wsadmin>AdminConfig.save()
''
wsadmin>


How's that?
0
 
hu8myphoAuthor Commented:
Thanks for the response, I was temporarily locked out of account so I couldn't respond sooner.  

This is what I've been working on to get as a start to create one definition at a time.  What I would like to do is able to use the dump tool to extract all of the information from one configuration and then use jython script(s) to 'parse' the output and create the definitions that I need in another configuration.

One thing that I have been doing in the mean time is using the exportWasprofile command to export the configuration as an archive and import.  The problem here is that I get a whole lot more than what I want and lose everything else that I need.  

What you've given is great to help me get understanding and started, but what I need is to a routine to parse store and read to create?

so like an example would be multiply that by 50 to 100x  :-).

Thanks for your help!
0
 
HonorGodCommented:
- Use the dump tool to create the output to be processed
  Redirect the output of the dumpNameSpace command to a file, and read/process the file.
  For example:

import os
os.system( 'dumpNameSpace >dumpNameSpace.out' )

fh = open( 'dumpNameSpace.out' )
data = fh.read()
fh.close()

#
# At this point, data contains the entire text of the dumpNameSpace output
#

- Define what parts of the output you want to extract, and I can show you how to do that...
0
 
hu8myphoAuthor Commented:
I've been able to reroute the nameSpaceDump out to a text file in the past.  The problem is that there so much more stuff in there than the 30, 40 definitions that I want, like about 140+,

I think for now, I will need to manually parse that output and then read in the 'data' from there I will need your help.  
this is a cropping of one of the output
26 (top)/persistent/TESTAPP/APP_SMTP_HOST
   26    Bound Java type: java.lang.String
   26    Local Java type: java.lang.String
   26    Corba binding type: org.omg.CosNaming.BindingType.nobject
   26    String representation: smtprelay.myhost.com

the example you given me :
wsadmin>cell = AdminConfig.getid( '/Cell:/' )
wsadmin>name = 'APP_SMTP_HOST'
wsadmin>nInS = 'TESTAPP/APP_SMTP_HOST'
wsadmin>str  = 'smtprelay.myhost.com'
wsadmin>value = [ [ 'name', name ], [ 'nameInNameSpace', nInS ], [ 'stringToBind', str ] ]
wsadmin>print AdminConfig.create( 'StringNameSpaceBinding', cell, value )
APP_SMTP_HOST(cells/HonorGodNode01Cell|namebindings.xml#StringNameSpaceBinding_1227467842738)
wsadmin>AdminConfig.save()

looks good, so I guess it just needs to iterate through the data to create multiple definitions?
0
 
HonorGodCommented:
You could certainly iterate through the data, the big question though is

How do you know which records are the ones of interest?

I know that text like "Bound Java type: java.lang.String" is pretty useless.

I believe that the number at the beginning of the line can be used to group data together.

Do you have the information you need?
0
 
hu8myphoAuthor Commented:
I agreed, that the output has stuff that is pretty useless to me as well.

I believe that I just want to information just exactly what the screen shot

scope = cell
binding type = string
identifier = [from data]
name = [from data]
string value = [from data]

your example as great, I just don't know how to extend it to an iteration :-)

wsadmin>cell = AdminConfig.getid( '/Cell:/' )
wsadmin>name = 'APP_SMTP_HOST'
wsadmin>nInS = 'TESTAPP/APP_SMTP_HOST'
wsadmin>str  = 'smtprelay.myhost.com'
wsadmin>value = [ [ 'name', name ], [ 'nameInNameSpace', nInS ], [ 'stringToBind', str ] ]
wsadmin>print AdminConfig.create( 'StringNameSpaceBinding', cell, value )

also, for passing arguments, is it difficult specify a 'switch' ie. -appname ?
what am doing today in checking for en(sys.args) to validate required input but if there are optional stuff it get messy with the conditions..

Thanks!
0
 
HonorGodCommented:
Do me a favor and execute the following command:

dumpNameSpace >dumpNameSpace.out

then, attach the dumpNameSpace.out file here.  Then, we can discuss
how to process it.

How's that sound?
0
 
hu8myphoAuthor Commented:
haven't given up on this yet, just juggling a few items, will upload this soon.
0
 
HonorGodCommented:
no problem.  I know the feeling.
0
 
HonorGodCommented:
Thanks for the grade & the points.

Good luck & have a great day
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now