Siebel System Administration Guide > Siebel Management Framework APIs >

Example of Enterprise-Level JMX API


The following is an example of the Enterprise-level JMX API.

CAUTION:  You must test these methods carefully before deploying into production, as some of these commands can shutdown or disable components, servers, or even the enterprise.

/**

*

*/

import com.siebel.management.jmxapi.*;

public class Enterprise

{

/**

* @param args

*/

public static void main(String[] args)

{

JmxEnterpriseMBean emb = new JmxEnterprise();

try

{

//+ The following 2 need to be changed by the person using this program

String ent = "siebel"; // enterprise name

//get servers//

System.out.println("Servers:");

String[] Servers = emb.getServers (ent);

for (int i = 0; i < Servers.length; i++)

{

System.out.println(" " + Servers[i]);

}

//getConnectedServers//

System.out.println("ConnectedServers:");

String[] ConnectedServers = emb.getConnectedServers (ent);

for (int i = 0; i < ConnectedServers.length; i++)

{

System.out.println(" " + ConnectedServers[i]);

}

//getDisconnectedServers//

System.out.println("DisconnectedServers:");

String[] DisconnectedServers = emb.getDisconnectedServers (ent);

for (int i = 0; i < DisconnectedServers.length; i++)

{

System.out.println(" " + DisconnectedServers[i]);

}

//get comp availability//

String arg = "ServerMgr";

Float compState = emb.getComponentAvailability (ent, arg);

System.out.println("getComponentAvailability('" + arg + "'):" + compState);

//shutdownComponent//

String arg1 = "Dbxtract";

Boolean shutdownComp = emb.shutdownComponent(ent, arg1, false);

System.out.println("shutdownComponent('" + arg1 + "'):" + shutdownComp);

//A sleep time of 2min before staring the component//

System.out.println("SleepTime:2 min");

try {

Thread.sleep( 120000 ); }

catch ( InterruptedException e ) { System.out.println( "awakened prematurely" );}

//startComponent//

//String arg1 = "Dbxtract";

Boolean startComp = emb.startComponent(ent, arg1);

System.out.println("startComponent('" + arg1 + "'):" + startComp);

//A sleep time of 2min before staring the component//

System.out.println("SleepTime:2 min");

try {

Thread.sleep( 120000 ); }

catch ( InterruptedException e ) { System.out.println( "awakened prematurely" );}

//getparam//

String arg2 = "Connect";

String Param = emb.getParam (ent, arg2);

System.out.println("getParam('" + arg2 + "'):" + Param);

//shutdownEnterprise//

Boolean shutdownEnt = emb.shutdownEnterprise (ent);

System.out.println("shutdownEnterprise('" + ent + "'):" + shutdownEnt);

//A sleeptime of 5 min before starting the enterprise//

System.out.println("SleepTime:5 min");

try {

Thread.sleep( 300000 ); }

catch ( InterruptedException e ) { System.out.println( "awakened prematurely" ); }

//startEnterprise//

Boolean startEnt = emb.startEnterprise (ent);

System.out.println("startEnterprise('" + ent + "'):" + startEnt);

}

catch (Exception e)

{

e.printStackTrace();

}

}

}

Siebel System Administration Guide Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices.