//***************************************************************************** //* * //* "This sample program is provided AS IS and may be used, executed, copied * //* and modified without royalty payment by customer * //* (a) for its own instruction and study, * //* (b) in order to develop applications designed to run with an * //* IBM WebSphere product, either for customer's own internal use or for * //* redistribution by customer, as part of such an application, in * //* customer's own products." * //* * //* Product 5655-FLW, * //* (C) COPYRIGHT International Business Machines Corp., 2006 * //* All Rights Reserved * Licensed Materials - Property of IBM * //* * //***************************************************************************** //* * //* DISCLAIMER * //* * //* This material contains programming source code for your consideration. * //* These examples have not been thoroughly tested under all conditions. * //* IBM, therefore, cannot guarantee or imply reliability, serviceability, * //* or function of these programs. * //* ALL PROGRAMS CONTAINED HEREIN ARE PROVIDED TO YOU "AS IS", WITHOUT ANY * //* WARRANTIES (EXPRESS OR IMPLIED) OR SUPPORT WHATSOEVER, INCLUDING BUT * //* NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS * //* FOR A PARTICULAR PURPOSE. * //* * //***************************************************************************** import javax.naming.InitialContext; import com.ibm.bpe.api.*; import com.ibm.task.api.*; public class ApiHelper { public static BusinessFlowManager initializeBFM() throws com.ibm.bpe.api.ProcessException { try { // initialize context and lookup the home interface InitialContext context= new InitialContext(); Object object = context.lookup("com/ibm/bpe/api/BusinessFlowManagerHome"); // typecast (narrow down) the object to BusinessFlowManagerHome BusinessFlowManagerHome bfmHome = (BusinessFlowManagerHome)javax.rmi.PortableRemoteObject.narrow(object, BusinessFlowManagerHome.class); // Access the remote interface for the BusinessFlowManager bean BusinessFlowManager bfm = bfmHome.create(); return bfm; } catch (javax.naming.NamingException xcpt ) { System.out.println( xcpt ); throw new com.ibm.bpe.api.ProcessException(null, xcpt ); } catch (javax.ejb.CreateException xcpt ) { System.out.println( xcpt ); throw new com.ibm.bpe.api.ProcessException(null, xcpt ); } catch (java.rmi.RemoteException xcpt ) { System.out.println( xcpt ); throw new com.ibm.bpe.api.ProcessException(null, xcpt ); } } public static HumanTaskManager initializeHTM() throws com.ibm.task.api.TaskException { try { // initialize context and lookup the home interface InitialContext context= new InitialContext(); Object object = context.lookup("com/ibm/task/api/HumanTaskManagerHome"); // typecast (narrow down) the object to HumanTaskManagerHome HumanTaskManagerHome htmHome = (HumanTaskManagerHome)javax.rmi.PortableRemoteObject.narrow(object, HumanTaskManagerHome.class); // Access the remote interface for the HumanTaskManager bean HumanTaskManager htm = htmHome.create(); return htm; } catch (javax.naming.NamingException xcpt ) { System.out.println( xcpt ); throw new com.ibm.task.api.TaskException( null, xcpt ); } catch (javax.ejb.CreateException xcpt ) { System.out.println( xcpt ); throw new com.ibm.task.api.TaskException( null, xcpt ); } catch (java.rmi.RemoteException xcpt ) { System.out.println( xcpt ); throw new com.ibm.task.api.TaskException(null, xcpt ); } } }