1 2 3 package org.enhydra.shark.asap; 4 5 import org.enhydra.shark.Shark; 6 import org.enhydra.shark.api.RootError; 7 import org.enhydra.shark.api.client.wfservice.*; 8 9 13 public class SharkServiceImpl { 14 15 public static final String GROUPNAME = "test"; 16 17 public static final String USERNAME = "admin"; 18 19 public static final String PASSWD = "enhydra"; 20 21 protected static final String XPDL_FILENAME = "test-BeanShell.xpdl"; 22 23 public static final String DEFAULT_PROC_MGR = "test_bs#1#math_operations"; 24 25 public static final String QSPN_PROCESS_DEFINITION = "procDef="; 26 27 public static final String QSPN_PACKAGE_ID = "packageId="; 28 29 public static final String QSPN_PROCESS_MANAGER = "procMgr="; 30 31 public static final String QSPN_PROCESS_INSTANCE = "procInst="; 32 33 35 37 protected static ExecutionAdministration executionAdmin; 38 39 protected static AdminMisc adminMisc; 40 41 public static String factoryBindingAddress; 42 43 public static void main(String [] argv) { 44 try { 45 Shark.configure(argv[0]); 46 PackageAdministration pa = Shark.getInstance() 47 .getAdminInterface() 48 .getPackageAdministration(); 49 RepositoryMgr rm = Shark.getInstance().getRepositoryManager(); 50 UserGroupAdministration uga = Shark.getInstance() 51 .getAdminInterface() 52 .getUserGroupAdministration(); 53 try { 54 if (!uga.doesGroupExist(GROUPNAME)) { 55 uga.createGroup("test", "test group"); 56 } 57 if (!uga.doesUserExist(USERNAME)) { 58 uga.createUser(GROUPNAME, USERNAME, PASSWD, "Jane", "Doe", ""); 59 } 60 String pkgId = rm.getPackageId(XPDL_FILENAME); 61 if (!pa.isPackageOpened(pkgId)) { 62 pa.openPackage(XPDL_FILENAME); 63 } 64 65 } catch (Throwable t) { 66 t.printStackTrace(); 67 } 68 69 72 74 adminMisc = Shark.getInstance().getAdminInterface().getAdminMisc(); 75 adminMisc.connect(SharkServiceImpl.USERNAME); 76 77 executionAdmin = Shark.getInstance() 78 .getAdminInterface() 79 .getExecutionAdministration(); 80 executionAdmin.connect(SharkServiceImpl.USERNAME, 81 SharkServiceImpl.PASSWD, 82 "", 83 ""); 84 85 factoryBindingAddress = new SharkWebServiceLocator().getasapFactoryBindingAddress(); 86 String [] args = new String [argv.length - 1]; 88 for (int n = 1; n < argv.length; ++n) { 89 args[n - 1] = argv[n]; 90 } 91 Class.forName("org.apache.axis.transport.http.SimpleAxisServer") 92 .getDeclaredMethod("main", new Class [] { 93 args.getClass() 94 }) 95 .invoke(null, new Object [] { 96 args 97 }); 98 } catch (Exception e) { 99 throw new RootError(e); 100 } 101 } 102 103 107 108 112 113 public static AdminMisc getAdminMiscUtilities() { 114 return adminMisc; 115 } 116 117 public static ExecutionAdministration getExecAdmin() { 118 return executionAdmin; 119 } 120 131 141 142 } | Popular Tags |