<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shaaf's Blog &#187; Administrator</title>
	<atom:link href="http://www.shaafshah.com/tag/administrator/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaafshah.com</link>
	<description>Another bit in the wall</description>
	<lastBuildDate>Wed, 12 Aug 2009 14:28:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Calling wsadmin scripts from ant</title>
		<link>http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/</link>
		<comments>http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 08:17:46 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[websphere]]></category>
		<category><![CDATA[wsadmin]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=148</guid>
		<description><![CDATA[You can simply add the following to a target. For the following wsadmin should be in your PATH env. < exec dir="." executable="wsadmin.bat" logError="true" failonerror="true" output="wsconfig.out" > < arg line="-lang jython -f ../../createQFactory.py"/ > < /exec > All output will be logged to wsconfig.out]]></description>
			<content:encoded><![CDATA[<p>You can simply add the following to a target.<br />
For the following wsadmin should be in your PATH env.</p>
<p>< exec dir="." executable="wsadmin.bat" logError="true" failonerror="true" output="wsconfig.out" ><br />
   < arg line="-lang jython -f ../../createQFactory.py"/ ><br />
< /exec ></p>
<p>All output will be logged to wsconfig.out</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>wasprofile -create -delete</title>
		<link>http://www.shaafshah.com/2008/10/24/wasprofile-create-delete/</link>
		<comments>http://www.shaafshah.com/2008/10/24/wasprofile-create-delete/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 11:38:00 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[wasprofile]]></category>
		<category><![CDATA[websphere]]></category>
		<category><![CDATA[wsadmin]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=91</guid>
		<description><![CDATA[Sometimes you require to do things silently, without any questions asked and &#8220;Just Do It&#8221; attitude is required. I often find my self with this problem. If you want to delete or create a Websphere profile from your command line try the following. (I have tried on RSA only) # deleteing a profile wasprofile -delete [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you require to do things silently, without any questions asked and &#8220;Just Do It&#8221; attitude is required.</p>
<p>I often find my self with this problem.</p>
<p>If you want to delete or create a Websphere profile from your command line try the following. (I have tried on RSA only)</p>
<p># deleteing a profile<br />
<strong>wasprofile </strong>-delete -profileName MyProfile</p>
<p>You should get the following message on deletion</p>
<p><strong>INSTCONFSUCCESS: Success: The profile no longer exists.</strong></p>
<p>Creating a websphere profile</p>
<p><strong>wasprofile </strong>-create -profileName MyProfile -profilePath \<br />
[PROFILE PATH] -templatePath \<br />
[RSA HOME]runtimes\base_v6\profileTemplates\default \<br />
-nodeName [NODE NAME] -cellName [CELL NAME] -hostName [HOSTNAME].</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/10/24/wasprofile-create-delete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HowTo create a JDBC provider with wsadmin scripting &#8211; Jython</title>
		<link>http://www.shaafshah.com/2008/07/01/howto-create-a-jdbc-provider-with-wsadmin-scripting-jython/</link>
		<comments>http://www.shaafshah.com/2008/07/01/howto-create-a-jdbc-provider-with-wsadmin-scripting-jython/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 12:21:48 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[websphere]]></category>
		<category><![CDATA[wsadmin]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=12</guid>
		<description><![CDATA[Last week I wrote a post about creating MQQueues with jacl. However today I am moving to Jython. This is the new scripting languauge supported by the wsadmin. The following write-up helps you create a JDBC provider using Jython in 6 easy steps on the wsadmin console. Pre requirements: Following should be known to start using [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I wrote a post about creating MQQueues with jacl. However today I am moving to Jython. This is the new scripting languauge supported by the wsadmin. The following write-up helps you create a JDBC provider using Jython in 6 easy steps on the wsadmin console.</p>
<p><strong>Pre requirements:<br />
</strong>Following should be known to start using this tutorial.</p>
<p>1. How to launch the wsadmin with Jython enabled.</p>
<p><strong>Where will I find the wsadmin?<br />
</strong>It is typically placed in the bin directory of your server.<br />
In my case its lying in my RAD installation directory as<br />
../Rational/SDP/6.0/runtimes/base_v6/bin</p>
<p>To invoke the wasadmin, just open your terminal and move to the bin dir where you can simply call it by typing wsadmin -lang jython. By doing so you would be invoking the default profile. if you want to specify the profile then use the switch -profileName YOURPROFILENAME</p>
<p>You can either paste the commands step by step or store the whole code listing in one file like DataSources.py. This means you can run this with wsadmin by specifying the -f switch.</p>
<p>After the wsadmin console is launched we can now move to creating the provider step by step.</p>
<p><strong>STEP 1.</strong><br />
Identify classpath for the provider. This is a path to the jar files that need to be used by the provider. In our case its a jdbc dirver for oracle.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">driverPath = <span style="color: #483d8b;">'C:<span style="color: #000099; font-weight: bold;">\l</span>ib<span style="color: #000099; font-weight: bold;">\o</span>jdbc14.jar'</span></pre></div></div>

<p><strong>STEP 2.</strong><br />
Identify the node and cell that will hold this provider. Node/Cell is how websphere is organized. As the Provider will be created inside a node we need to know which node we are working with.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">cellName=AdminControl.<span style="color: black;">getCell</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
nodeName=AdminControl.<span style="color: black;">getNode</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
node = AdminConfig.<span style="color: black;">getid</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/Cell:%s/Node:%s/'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>cellName,nodeName<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>In the code above first we get the NodeName and CellName of the current connected server and then take the reference of it as node.</p>
<p><strong>STEP 3.<br />
</strong>Specify a template, In our case we have taken an &#8216;Oracle JDBC Driver (XA)&#8217; template.<br />
The following command will list the template for the provider specified and store it in a variable &#8216;providerTemplate&#8217;</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">providerTemplate=AdminConfig.<span style="color: black;">listTemplates</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'JDBCProvider'</span>, <span style="color: #483d8b;">'Oracle JDBC Driver (XA)'</span><span style="color: black;">&#41;</span></pre></div></div>

<p><strong>STEP 4.<br />
</strong>The name for our provider. It could be any name you want to give your provider.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">providerName = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'name'</span>, <span style="color: #483d8b;">'Oracle JDBC Driver (XA)'</span><span style="color: black;">&#93;</span></pre></div></div>

<p>Implementation class and classpath for driver.<br />
It is important to give the implementation class for our provider. In some cases they can be different in ours we use the default one.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">implClassName = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'implementationClassName'</span>, <span style="color: #483d8b;">'oracle.jdbc.xa.client.OracleXADataSource'</span><span style="color: black;">&#93;</span></pre></div></div>

<p><strong>STEP 5.</strong><br />
The following code will just put all the above variables into a form expected by wsadmin as a temp variable jdbcAttrs.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">classpath = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'classpath'</span>,driverPath<span style="color: black;">&#93;</span>
jdbcAttrs = <span style="color: black;">&#91;</span>providerName,  implClassName,classpath<span style="color: black;">&#93;</span></pre></div></div>

<p><strong>STEP 6.</strong></p>
<p>Now is the time to create the provider. and the following will just do that. It passes the type of the provider, the node ref, the jdbcAttrs created in step 5 and the template to be used to create the provider.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">provider  = AdminConfig.<span style="color: black;">createUsingTemplate</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'JDBCProvider'</span>, node, jdbcAttrs, providerTemplate<span style="color: black;">&#41;</span>
AdminConfig.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>This is pretty much it. You should now be able to see the provider in the AdminConsole.</p>
<p>Complete code listing is as follows</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">driverPath = <span style="color: #483d8b;">'C:<span style="color: #000099; font-weight: bold;">\l</span>ib<span style="color: #000099; font-weight: bold;">\o</span>jdbc14.jar'</span>
cellName=AdminControl.<span style="color: black;">getCell</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
nodeName=AdminControl.<span style="color: black;">getNode</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
providerTemplate=AdminConfig.<span style="color: black;">listTemplates</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'JDBCProvider'</span>, <span style="color: #483d8b;">'Oracle JDBC Driver (XA)'</span><span style="color: black;">&#41;</span>
node = AdminConfig.<span style="color: black;">getid</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/Cell:%s/Node:%s/'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>cellName,nodeName<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
providerName = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'name'</span>, <span style="color: #483d8b;">'Oracle JDBC Driver (XA)'</span><span style="color: black;">&#93;</span>
implClassName = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'implementationClassName'</span>, <span style="color: #483d8b;">'oracle.jdbc.xa.client.OracleXADataSource'</span><span style="color: black;">&#93;</span>
classpath = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'classpath'</span>,driverPath<span style="color: black;">&#93;</span>
jdbcAttrs = <span style="color: black;">&#91;</span>providerName,  implClassName,classpath<span style="color: black;">&#93;</span>
provider  = AdminConfig.<span style="color: black;">createUsingTemplate</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'JDBCProvider'</span>, node, jdbcAttrs, providerTemplate<span style="color: black;">&#41;</span>
AdminConfig.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/07/01/howto-create-a-jdbc-provider-with-wsadmin-scripting-jython/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating the MQQueues with wsadmin scripting &#8211; JACL Part 2</title>
		<link>http://www.shaafshah.com/2008/06/25/creating-the-mqqueues-with-wsadmin-scripting-jacl-part-2/</link>
		<comments>http://www.shaafshah.com/2008/06/25/creating-the-mqqueues-with-wsadmin-scripting-jacl-part-2/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 12:40:47 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[jacl]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MQ]]></category>
		<category><![CDATA[MQQueue]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[websphere]]></category>
		<category><![CDATA[wsadmin]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=9</guid>
		<description><![CDATA[Yesterday I wrote an article about creating and configuring the MQQueueConnectionFactory with the JACL on the wsadmin console. The other half of the article that was left out was to create the queues also. The world looks pretty much the same today and my /etc/profile doesnt seemed to have been sourced again. Good we dont [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I wrote an article about creating and configuring the MQQueueConnectionFactory with the JACL on the wsadmin console. The other half of the article that was left out was to create the queues also.</p>
<p>The world looks pretty much the same today and my /etc/profile doesnt seemed to have been sourced again. Good we dont need a restart.</p>
<p>You would find some of the steps to be similar and that is because we are running on the same configs.</p>
<p><strong>Step 1.</strong><br />
Identify the Provider for your Queue. By default this is the name for it. If you have created a new provider with a different name then specify it here.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> tmp1 <span style="color: #483d8b;">&quot;WebSphere MQ JMS Provider&quot;</span></pre></div></div>

<p><strong>Step 2.</strong><br />
Now you would need to find the CELL NAME and the NODE NAME of your server<br />
A typical location to my websphere profile’s Node configuration file is as follows<br />
C:\Programs\IBM\Rational\SDP\6.0\runtimes\base_v6\profiles\test_wsp\config\cells\BNode05Cell\nodes\BNode05<br />
The cell name in this location is after \cells\ i.e. BNode05Cell<br />
And the node name is at the end after \nodes\ i.e. BNode05</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> newjmsp <span style="color: black;">&#91;</span><span style="color: #ff3333;">$AdminConfig</span> getid /Cell:CELLNAMECell/Node:NODENAME/JMSProvider:<span style="color: #ff3333;">$tmp1</span>/<span style="color: black;">&#93;</span></pre></div></div>

<p><strong>Step 3.</strong><br />
You would now need to set the attributes that go into the queue.</p>
<p>To see all the attributes you can simply run the following command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">$AdminConfig</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>required<span style="color: #000000; font-weight: bold;">|</span>attributes<span style="color: #7a0874; font-weight: bold;">&#93;</span> MQQueue</pre></div></div>

<p>i.e. required or attributes</p>
<p>The attributes that I will be setting in the following commands are<br />
name, jndiName, baseQueueName, targetClient</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> name <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> name NAME<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">set</span> jndi <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> jndiName jms/jndiName<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">set</span> baseQN <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> baseQueueName BASEQUEUENAME<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">set</span> targetclient <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> targetClient MQ<span style="color: black;">&#93;</span></pre></div></div>

<p>You can see in the above example the target client is set to MQ it can be JMS based on your configuration.</p>
<p><strong>Step 4.</strong><br />
Now set all parameters in one string so that they can be passed to the command as one.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> mqqAttrs <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> <span style="color: #ff3333;">$name</span> <span style="color: #ff3333;">$jndi</span> <span style="color: #ff3333;">$baseQN</span> <span style="color: #ff3333;">$targetclient</span><span style="color: black;">&#93;</span></pre></div></div>

<p><strong>Step 5.</strong><br />
Now to create the MQQueue use the following command. This will add the Queue to the node and cell mentioned earlier in step 2.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff3333;">$AdminConfig</span> create MQQueue <span style="color: #ff3333;">$newjmsp</span> <span style="color: #ff3333;">$mqqAttrs</span></pre></div></div>

<p>Once it is created it is not saved and only stays in the current session. So to save it run the following command. And you should be all set.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff3333;">$AdminConfig</span> save</pre></div></div>

<p>You can alternatively also save this script in a file on your local system. And run it by passing it to the wasadmin. Follwing is a sample command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">wsadmin <span style="color: #660033;">-profileName</span> test_wsp <span style="color: #660033;">-f</span> <span style="color: #007800;">$SCRIPT_FILENAME_LOCATION</span>$</pre></div></div>

<p>&#8216;Complete code listing is as follows.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> tmp1 <span style="color: #483d8b;">&quot;WebSphere MQ JMS Provider&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> newjmsp <span style="color: black;">&#91;</span><span style="color: #ff3333;">$AdminConfig</span> getid /Cell:HOSTNAMENode04Cell/Node:HOSTNAMENode04/JMSProvider:<span style="color: #ff3333;">$tmp1</span>/<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> name <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> name Q.REPLY<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">set</span> jndi <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> jndiName jms/Q.REPLY<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">set</span> baseQN <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> baseQueueName Q.SYSTEM<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">set</span> targetclient <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> targetClient MQ<span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">set</span> mqqAttrs <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> <span style="color: #ff3333;">$name</span> <span style="color: #ff3333;">$jndi</span> <span style="color: #ff3333;">$baseQN</span> <span style="color: #ff3333;">$targetclient</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff3333;">$AdminConfig</span> create MQQueue <span style="color: #ff3333;">$newjmsp</span> <span style="color: #ff3333;">$mqqAttrs</span>
&nbsp;
<span style="color: #ff3333;">$AdminConfig</span> save</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/06/25/creating-the-mqqueues-with-wsadmin-scripting-jacl-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating the MQQueueConnectionFactory with wsadmin scripting  &#8211; JACL Part 1.</title>
		<link>http://www.shaafshah.com/2008/06/24/websphere-admin-scripting-jacl-part-1/</link>
		<comments>http://www.shaafshah.com/2008/06/24/websphere-admin-scripting-jacl-part-1/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 13:44:31 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[jacl]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[MQ]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[websphere]]></category>
		<category><![CDATA[wsadmin]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=8</guid>
		<description><![CDATA[While working my way in some piece of long java code I came across this huge pile of sand that just shattered me off every bit of patience I was left with. The dilemma all of us face every second day. CONFIGURATIONS!! While my sarcastic mind was just saying Congratulations to me instead. And just [...]]]></description>
			<content:encoded><![CDATA[<p>While working my way in some piece of long java code I came across this huge pile of sand that just shattered me off every bit of patience I was left with. The dilemma all of us face every second day. <span style="color: #808080;">CONFIGURATIONS!!</span></p>
<p>While my sarcastic mind was just saying Congratulations to me instead. And just how the &#8211; would you expect me to start configuring now.</p>
<p>So what exactly is my problem? I have a list of MQs, Factories, datasource, providers etc.. that I need to configure. And every time I create a new profile on my RAD (Rational Application Developer) I have to manually goto the Admin console and configure them.</p>
<p>With the very useless bit of linux I am acquainted too I cant live with clicks at least while programming.</p>
<p>As I am working with websphere and its a biggy in all those names I thought the guys would be smart and would at least have something in the box for *people like me. Well guess what I was right.</p>
<p>IBM has provided two languages for scripting.</p>
<p>1. JACL<br />
2. Jython</p>
<p>If I am not wrong JACL will be deprecated out in future releases and Jython would be the tool for our scripting bit. <a title="[ Link Here ]" href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rmig_deprecationlist.html">[ Link here ]</a></p>
<p>In this article I will just go briefly with JACL and move to Jython in the next version where we will be able to configure the data sources in the websphere.</p>
<p>So what exactly is JACL. or pronounced as &#8220;JACKAL&#8221;</p>
<p>Jacl, Java Command Language, is much like/version of the Tcl scripting language for the Java. It runs on the JVM much like we hear about JRuby and the interpreter is written completely in Java.</p>
<p>For more details on the language itself you could go <a title="[ Here ]" href="http://publib.boulder.ibm.com/infocenter/imshelp1/v3r0/index.jsp?topic=/com.ibm.sif.doc/jaclabout.html">[ here ]</a></p>
<p>Lets get down to business: <strong>How to create a Webspehere MQ Connection Factory with wsamdin using JACL.</strong><br />
You would already have some of the details of the queues but some you will need to extract.</p>
<p><strong>Step 1.<br />
</strong>Identify the Provider for your Factory. By default this is the name for it. If you have created a new provider with a different name then specify it here.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> tmp1 <span style="color: #483d8b;">&quot;WebSphere MQ JMS Provider&quot;</span></pre></div></div>

<p><strong>Step 2.</strong><br />
Now you would need to find the CELL NAME and the NODE NAME of your server<br />
A typical location to my websphere profile&#8217;s Node configuration file is as follows<br />
C:\Programs\IBM\Rational\SDP\6.0\runtimes\base_v6\profiles\test_wsp\config\cells\BNode05Cell\nodes\BNode05<br />
The cell name in this location is after \cells\ i.e. BNode05Cell<br />
And the node name is at the end after \nodes\ i.e. BNode05</p>
<p>set newjmsp [$AdminConfig getid /Cell:CELLNAMECell/Node:NODENAME/JMSProvider:$tmp1/]</p>
<p><strong>Step 3.</strong><br />
Now you need to specify the Factories properties.</p>
<p>The properties I plan to setup are as follows.<br />
Name, jndiName,QueueManager, sname, port, channel, ttype, xaenabled</p>
<p>To check what are the required parameters for the Factory you can run the following command on the wsadmin console.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff3333;">$AdminConfig</span> required WASQueueConnectionFactory</pre></div></div>

<p>Example output:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">wsadmin <span style="color: #007800;">$AdminConfig</span> required WASQueueConnectionFactory
Attribute                       Type
name                            String
jndiName                        String</pre></div></div>

<p><strong>Where will I find the wsadmin?</strong><br />
It is typically placed in the bin directory of your server.<br />
In my case its lying in my RAD installation directory as<br />
../Rational/SDP/6.0/runtimes/base_v6/bin</p>
<p>To invoke the wasadmin, just open your terminal and move to the bin dir where you can simply call it by typing wsadmin.  By doing so you would be invoking the default profile. if you want to specify the profile then use the switch -profileName YOURPROFILENAME</p>
<p>To see the all parameters required and optional write the following command on the console.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff3333;">$AdminConfig</span> attributes WASQueueConnectionFactory</pre></div></div>

<p>Example output:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">wsadmin <span style="color: #007800;">$AdminConfig</span> attributes WASQueueConnectionFactory
<span style="color: #ff0000;">&quot;XAEnabled boolean&quot;</span>
<span style="color: #ff0000;">&quot;authDataAlias String&quot;</span>
<span style="color: #ff0000;">&quot;authMechanismPreference ENUM(BASIC_PASSWORD, KERBEROS)&quot;</span>
<span style="color: #ff0000;">&quot;category String&quot;</span>
<span style="color: #ff0000;">&quot;connectionPool ConnectionPool&quot;</span>
<span style="color: #ff0000;">&quot;description String&quot;</span>
<span style="color: #ff0000;">&quot;jndiName String&quot;</span>
<span style="color: #ff0000;">&quot;logMissingTransactionContext boolean&quot;</span>
<span style="color: #ff0000;">&quot;manageCachedHandles boolean&quot;</span>
<span style="color: #ff0000;">&quot;mapping MappingModule&quot;</span>
<span style="color: #ff0000;">&quot;name String&quot;</span>
<span style="color: #ff0000;">&quot;node String&quot;</span>
<span style="color: #ff0000;">&quot;preTestConfig ConnectionTest&quot;</span>
<span style="color: #ff0000;">&quot;propertySet J2EEResourcePropertySet&quot;</span>
<span style="color: #ff0000;">&quot;provider J2EEResourceProvider@&quot;</span>
<span style="color: #ff0000;">&quot;providerType String&quot;</span>
<span style="color: #ff0000;">&quot;serverName String&quot;</span>
<span style="color: #ff0000;">&quot;sessionPool ConnectionPool&quot;</span>
<span style="color: #ff0000;">&quot;xaRecoveryAuthAlias String&quot;</span></pre></div></div>

<p>I have added some extra optional parameters for those of us who are using extra options.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> name <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> name NAME<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> jndi <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> jndiName jms/JNDINAME<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> qManager <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> queueManager QMANAGER<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> sname <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> host HOSTNAME<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> port <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> port <span style="color: #ff4500;">1414</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> channel <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> channel CHANNEL<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> ttype <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> transportType CLIENT<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> xa <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> XAEnabled True|false<span style="color: black;">&#93;</span></pre></div></div>

<p><strong>Step 4.</strong><br />
Now set all parameters in one string so that they can be passed to the command as one.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> mqcfAttrs <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> <span style="color: #ff3333;">$name</span> <span style="color: #ff3333;">$jndi</span> <span style="color: #ff3333;">$qManager</span> <span style="color: #ff3333;">$sname</span> <span style="color: #ff3333;">$port</span> <span style="color: #ff3333;">$channel</span> <span style="color: #ff3333;">$ttype</span> <span style="color: #ff3333;">$xa</span><span style="color: black;">&#93;</span></pre></div></div>

<p><strong>Step 5.</strong><br />
Now to create the Factory use the following command. This will add the factory to the node and cell mentioned earlier in step 2.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff3333;">$AdminConfig</span> create MQQueueConnectionFactory <span style="color: #ff3333;">$newjmsp</span> <span style="color: #ff3333;">$mqcfAttrs</span></pre></div></div>

<p>Once it is created it is not saved and only stays in the current session. So to save it run the following command. And you should be all set.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff3333;">$AdminConfig</span> save</pre></div></div>

<p>You can alternatively also save this script in a file on your local system. And run it by passing it to the wasadmin. Follwing is a sample command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">wsadmin <span style="color: #660033;">-profileName</span> test_wsp <span style="color: #660033;">-f</span> <span style="color: #007800;">$SCRIPT_FILENAME_LOCATION</span>$</pre></div></div>

<p>Complete code listing is as follows.</p>

<div class="wp_syntax"><div class="code"><pre class="tcl" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">set</span> tmp1 <span style="color: #483d8b;">&quot;WebSphere MQ JMS Provider&quot;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> newjmsp <span style="color: black;">&#91;</span><span style="color: #ff3333;">$AdminConfig</span> getid /Cell:CELLNAMECell/Node:NODENAME/JMSProvider:<span style="color: #ff3333;">$tmp1</span>/<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> name <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> name NAME<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> jndi <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> jndiName jms/JNDINAME<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> qManager <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> queueManager QMANAGER<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> sname <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> host HOSTNAME<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> port <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> port <span style="color: #ff4500;">1414</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> channel <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> channel CHANNEL<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> ttype <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> transportType CLIENT<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> xa <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> XAEnabled false<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">set</span> mqcfAttrs <span style="color: black;">&#91;</span><span style="color: #008000;">list</span> <span style="color: #ff3333;">$name</span> <span style="color: #ff3333;">$jndi</span> <span style="color: #ff3333;">$qManager</span> <span style="color: #ff3333;">$sname</span> <span style="color: #ff3333;">$port</span> <span style="color: #ff3333;">$channel</span> <span style="color: #ff3333;">$ttype</span> <span style="color: #ff3333;">$xa</span><span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #ff3333;">$AdminConfig</span> create MQQueueConnectionFactory <span style="color: #ff3333;">$newjmsp</span> <span style="color: #ff3333;">$mqcfAttrs</span>
&nbsp;
<span style="color: #ff3333;">$AdminConfig</span> save</pre></div></div>

<p><strong>More Resources:</strong></p>
<p>[http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rmig_deprecationlist.html]</p>
<p>[http://publib.boulder.ibm.com/infocenter/imshelp1/v3r0/index.jsp?topic=/com.ibm.sif.doc/jaclabout.html]</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/06/24/websphere-admin-scripting-jacl-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
