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!
LVL 1
hu8myphoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HonorGodSoftware EngineerCommented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

HonorGodSoftware EngineerCommented:
Yes.

I know Jython scripting of the WebSphere Application Server environment very, very well.
0
HonorGodSoftware EngineerCommented:
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
HonorGodSoftware EngineerCommented:
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
HonorGodSoftware EngineerCommented:
- 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
HonorGodSoftware EngineerCommented:
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
HonorGodSoftware EngineerCommented:
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
HonorGodSoftware EngineerCommented:
no problem.  I know the feeling.
0
HonorGodSoftware EngineerCommented:
Thanks for the grade & the points.

Good luck & have a great day
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java App Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.