03-21-07 12:20 AM
How to determine to which server I am connected in wsadmin?
I found the following code in JYTHON and JACL to do this..I wanted to know h
ow to code a corresponding Java version of the same ...Please read my commen
ts after the two code snippets..
----------------------------------------------------------------------------
--
IN JYTHON:
wsadminSvr =
AdminControl.queryNames("node="+AdminControl.getNode( )+",type=Server,*" )
wsadminSvrId = AdminControl.getConfigId(wsadminSvr )
wsadminType = AdminConfig.showAttribute(wsadminSvrId, "serverType" )
wsadminVers = AdminControl.getAttribute(wsadminSvr, "platformVersion" )
wsadminConn = AdminControl.getType( )
wsadminServer = AdminControl.getAttribute(wsadminSvr, "name" )
wsadminNode = AdminControl.getNode( )
wsadminCell = AdminControl.getCell( )
wsadminHost = AdminControl.getHost( )
wsadminPort = AdminControl.getPort( )
IN JACL:
set wsadminSvr [$AdminControl queryNames node=[$AdminControl
getNode],type=Server,* ]
set wsadminSvrId [$AdminControl getConfigId $wsadminSvr]
set wsadminType [$AdminConfig showAttribute $wsadminSvrId serverType]
set wsadminVers [$AdminControl getAttribute $wsadminSvr
platformVersion]
set wsadminConn [$AdminControl getType]
set wsadminServer [$AdminControl getAttribute $wsadminSvr name]
set wsadminNode [$AdminControl getNode]
set wsadminCell [$AdminControl getCell]
set wsadminHost [$AdminControl getHost]
set wsadminPort [$AdminControl getPort]
wsadminServer will contain "dmgr" or whatever your server name is.
----------------------------------------------------------------------------
--
IN JAX:
This snippet traverses all the servers on the server node..but does not tell
me which server I am currently connected to. (I have attached the actual fi
le which has the entire code, for it for reference)
javax.management.ObjectName on = new javax.management.ObjectName("WebSphere:
*");
Set objectNameSet= ac.queryNames(on, null);
// you can check properties like type, name, and process to find a specified
ObjectName After you get all the ObjectNames, you can use the following
example code to get all the node names:
HashSet nodeSet = new HashSet();
for(Iterator i = objectNameSet.iterator(); i.hasNext(); on =
(ObjectName)i.next()) {
String type = on.getKeyProperty("type");
if(type != null && type.equals("Server")) {
nodeSet.add(servers[i].getKeyProperty("node"));
}
}
----------------------------------------------------------------------------
----
I am assuming the AdminControl class in JACL/JYTHON is equivalent to the Adm
inClient class in com.ibm.websphere.management package...am I correct in XXX
uming this??
If so for some reason I CANNOT find the equivalent function AdminControl.get
Node( ) thats available in JACL/JYTHON...the AdminControl class dosnt seem t
o have this function...consequently I am not sure how I get the equivaalent
Java code for the first lin
e in the JACL/JYTHON version..
wsadminSvr =
AdminControl.queryNames("node="+AdminControl.getNode( )+",type=Server,*" )
Can some please help..I would appreciate any input..
Thanks
Jay
[ Post a follow-up to this message ]
|