What forced me into it?
Undeploying BPEL process from BPEL Console is a nightmare especially when you have many environments. And with each test cycle, the environment is refreshed and recreated.
It takes hell a lot of time and AS admin time to get this. (Well these admin guy are always short of time with their hand full of work)
Best option, automate the process. So I have small piece of code that I have pulled.
You will be surprised how short this is?
package bpelUndeployment;
import java.util.Properties;
import com.oracle.bpel.client.BPELProcessId;
import com.oracle.bpel.client.IBPELDomainHandle;
import com.oracle.bpel.client.Locator;
import com.oracle.bpel.client.ServerException;
/**
* @author Kalidass Mookkaiah
*/
public class UnDeployBPELProcess {
public static void main(String[] args) throws ServerException {
//Properties with BPEL server connection information
Properties props = new Properties();
props.put("orabpel.platform", "ias_10g");
props.put("java.naming.factory.initial", "com.evermind.server.rmi.RMIInitialContextFactory");
props.put("java.naming.provider.url", "opmn:ormi://hostname:6008:home/orabpel");
props.put("java.naming.security.principal", "oc4jadmin");
props.put("java.naming.security.credentials", "oc4jadmin");
props.put("dedicated.connection","true");
//Get a locator in default domain
Locator locator = new Locator("default","welcome1",props);
//Get a handle to the domain
IBPELDomainHandle iBPELDomainHandle = locator.lookupDomain();
//Undeploy this process from default domain
iBPELDomainHandle.undeployProcess(new BPELProcessId("default","MyUndeployedBPELProcess"));
}
}
Explanation!!!
If you do not know that the properties mean, see this post
http://oraclebpelindepth.blogspot.com/2008/08/bpel-context-properties-for-client-api.html
Well if you have read the above post then you know what the Properties are for.
In one word it is values to connect to the AS server.
Use the locator to get a handle to the domain.
Use this handle to perform undeployment.
Here I have used the BPELProcessId class to identify the domain and ProcessName.
The ProcessName should match exactly.
What about versioned BPEL process?
Help your self.
But what I can hint you with is this.
The Class BPELProcessId has overloaded constructor.
3 of them.
One takes domain and processID
Other takes domain, processID and revision Tag.
There is another one tooo with domain, processID, revision Tag and process GUID.
Happy hunting with the overloaded constructors.
And don't forget to run the code ;)
What Jars to include?
And if you are looking to find the jars to include to run this see the link
http://oraclebpelindepth.blogspot.com/2008/09/jars-for-bpel-java-api.html
Monday, September 29, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment