Start or Stop your SOA Suite 11g Composite in Java

Bookmark and Share
In this short blogpost I will show you how can execute operations on a SOA Suite 11g Composite in java. The operations are start, stop, activate, retire, set the default version and list all the deployed composites.



I use for this the oracle.fabric.management.deployedcomposites.CompositeManager class ( located in the fabric runtime ) with its static methods.

The SOA ANT scripts also uses this class or you can do it yourself by looking up the right Composite MBean and invoke the same operations.



Before PS2 you could lookup the composite and call the start/ stop methods, but this not working anymore so now you need to use this ( or use the EM or the MBeans )

package nl.whitehorses.soa.client;

import oracle.fabric.management.deployedcomposites.CompositeManager;

public class ActivateComposite {

public static void main(String[] args) {
try {
CompositeManager.initConnection("localhost", "8001", "weblogic", "weblogic1");

CompositeManager.assignDefaultComposite(CompositeManager.getCompositeLifeCycleMBean(), "default/Helloworld!1.0");

CompositeManager.stopComposite(CompositeManager.getCompositeLifeCycleMBean(), "default/Helloworld!1.0");

CompositeManager.startComposite(CompositeManager.getCompositeLifeCycleMBean(), "default/Helloworld!1.0");

CompositeManager.activateComposite(CompositeManager.getCompositeLifeCycleMBean(), "default/Helloworld!1.0");

CompositeManager.retireComposite(CompositeManager.getCompositeLifeCycleMBean(), "default/Helloworld!1.0");

System.out.println(CompositeManager.listDeployedComposites(CompositeManager.getCompositeLifeCycleMBean()));

CompositeManager.closeConnection(); 

} catch (Exception  e) {
e.printStackTrace();
} 
}
}


With this as result.

Connecting to: service:jmx:t3://localhost:8001/jndi/weblogic.management.mbeanservers.runtime



Following 5 composites are currently deployed to the platform:



1. HttpBinding[1.0], mode=active, state=on, isDefault=true, deployedTime=2010-08-20T22:42:58.888+02:00

2. SoaSpring[1.0], mode=active, state=on, isDefault=true, deployedTime=2010-07-10T15:41:07.640+02:00

3. bpm[1.0], mode=active, state=on, isDefault=true, deployedTime=2010-07-10T15:58:13.853+02:00

4. Helloworld[1.0], mode=retired, state=on, isDefault=true, deployedTime=2010-09-22T02:37:50.924+02:00

5. BPELCorrelation[1.0], mode=active, state=on, isDefault=true, deployedTime=2010-09-01T22:14:59.374+02:00

{ 0 comments... Views All / Send Comment! }

Post a Comment