v***@in.ibm.com
2009-06-05 06:49:36 UTC
I tried to use the java management APIs of the websphere application server to complete some administration tasks. one of the tasks was to create a service integration bus. In JACL/Jython we used the wasadmin operation
+$AdminTask createSIBus $busName+
In trying to convert this piece to a java function using the websphere java management APIs, i tried the below two methods which did not work. *i want to know which class/package is the WebSphere Java Management API substitute for wsadmin's AdminTask.*
h4. Method 1
In this method i used the AdminOperations Mbean to invoke the createSIBus operation. I tried it eventhough I was aware that AdminOperations MBean doesnt support that operation. As expected it failed :)
{code}
javax.management.ObjectName on = new javax.management.ObjectName
("*:*,type=AdminOperations,process=server1");
Set objectNameSet= adminClient.queryNames(on, null);
if(objectNameSet != null) {
Iterator i = objectNameSet.iterator();
while (i.hasNext()) {
System.out.println("in here");
on = (ObjectName)i.next();
System.out.println(on);
}
}
String signature[] = new String[]{"java.lang.String","java.lang.String"};
Object params[] = new Object[] {busName, busDesc};
adminClient.invoke(on, "createSIBus", params, signature);
{code}
h4. Method 2
This was a more hopeful try by using Node object. This again was a failure. I also tried using server object and failed too.
{code}
ObjectName parent = configService.resolve(session, "Node="+"rfidic-5Node02")[0];
String signature[] = new String[]{"java.lang.String","java.lang.String"};
Object params[] = new Object[] {busName, busDesc};
adminClient.invoke(parent, "createSIBus", params, signature);
{code}
+$AdminTask createSIBus $busName+
In trying to convert this piece to a java function using the websphere java management APIs, i tried the below two methods which did not work. *i want to know which class/package is the WebSphere Java Management API substitute for wsadmin's AdminTask.*
h4. Method 1
In this method i used the AdminOperations Mbean to invoke the createSIBus operation. I tried it eventhough I was aware that AdminOperations MBean doesnt support that operation. As expected it failed :)
{code}
javax.management.ObjectName on = new javax.management.ObjectName
("*:*,type=AdminOperations,process=server1");
Set objectNameSet= adminClient.queryNames(on, null);
if(objectNameSet != null) {
Iterator i = objectNameSet.iterator();
while (i.hasNext()) {
System.out.println("in here");
on = (ObjectName)i.next();
System.out.println(on);
}
}
String signature[] = new String[]{"java.lang.String","java.lang.String"};
Object params[] = new Object[] {busName, busDesc};
adminClient.invoke(on, "createSIBus", params, signature);
{code}
h4. Method 2
This was a more hopeful try by using Node object. This again was a failure. I also tried using server object and failed too.
{code}
ObjectName parent = configService.resolve(session, "Node="+"rfidic-5Node02")[0];
String signature[] = new String[]{"java.lang.String","java.lang.String"};
Object params[] = new Object[] {busName, busDesc};
adminClient.invoke(parent, "createSIBus", params, signature);
{code}