Monday, February 20, 2012

Get BPEL application name BPEL template details

Once in a while, you may want to deploy multiple copies of the same application on server, in that case you can use serviceDeploy -uniqueCellID to create multiple copies of application and deploy on the same server. But all that applications uses the same BPEL template, in such case you may want to print which application is getting executed by printing additional details.

Below snippet can be used to print details of the process template and associated details.

Pass template name in API to get further details...








 
try {
    javax.naming.Context ctx = new javax.naming.InitialContext();
    Object obj = ctx.lookup("local:ejb/com/ibm/bpe/api/BusinessFlowManagerHome");
    LocalBusinessFlowManagerHome fmh = (LocalBusinessFlowManagerHome) javax.rmi.PortableRemoteObject.narrow(obj,com.ibm.bpe.api.LocalBusinessFlowManagerHome.class);
    BusinessFlowManagerService bfm = fmh.create();

    ProcessTemplateData ptd = bfm.getProcessTemplate("testBPEL");

    System.out.println("Process Template ID : " + ptd.getID());
    System.out.println("Application Name : " + ptd.getApplicationName());
    SimpleDateFormat formatter = new SimpleDateFormat("E, y-M-d 'at' hh:mm:ss.sss a zzz");
    System.out.println("Creation time : " + formatter.format(ptd.getCreationTime().getTime()));
    System.out.println("Valid from : " + formatter.format(ptd.getValidFromTime().getTime()));
    System.out.println("State : " + ptd.getState());
    System.out.println("" );
 }catch (Exception e)
{e.printStackTrace();}