1 2 3 package org.enhydra.shark.wfxml; 4 5 import javax.xml.namespace.QName ; 6 7 import org.apache.axis.encoding.DefaultTypeMappingImpl; 8 import org.apache.axis.encoding.ser.SimpleSerializerFactory; 9 import org.enhydra.shark.Shark; 10 import org.enhydra.shark.api.RootError; 11 import org.enhydra.shark.api.client.wfservice.*; 12 import org.enhydra.shark.wfxml.util.AltBeanDeserializerFactory; 13 14 18 public class SharkServiceImpl extends org.enhydra.shark.asap.SharkServiceImpl { 19 20 private static PackageAdministration packageAdministration; 21 22 private static RepositoryMgr repositoryMgr; 23 24 public static void main(String [] argv) { 25 try { 26 Shark.configure(argv[0]); 27 packageAdministration = Shark.getInstance() 28 .getAdminInterface() 29 .getPackageAdministration(); 30 repositoryMgr = Shark.getInstance().getRepositoryManager(); 31 UserGroupAdministration uga = Shark.getInstance() 32 .getAdminInterface() 33 .getUserGroupAdministration(); 34 try { 35 if (!uga.doesGroupExist(GROUPNAME)) { 36 uga.createGroup("test", "test group"); 37 } 38 if (!uga.doesUserExist(USERNAME)) { 39 uga.createUser(GROUPNAME, USERNAME, PASSWD, "Jane", "Doe", ""); 40 } 41 45 46 } catch (Throwable t) { 47 t.printStackTrace(); 48 } 49 50 53 55 adminMisc = Shark.getInstance().getAdminInterface().getAdminMisc(); 56 adminMisc.connect(SharkServiceImpl.USERNAME); 57 58 executionAdmin = Shark.getInstance() 59 .getAdminInterface() 60 .getExecutionAdministration(); 61 executionAdmin.connect(SharkServiceImpl.USERNAME, 62 SharkServiceImpl.PASSWD, 63 "", 64 ""); 65 factoryBindingAddress = new SharkWebServiceLocator().getwfxmlFactoryBindingAddress(); 66 67 QName xmlType = new javax.xml.namespace.QName ("http://www.w3.org/2001/XMLSchema", 69 "anyType"); 70 DefaultTypeMappingImpl.getSingleton() 71 .register(String .class, 72 xmlType, 73 new SimpleSerializerFactory(String .class, 74 new javax.xml.namespace.QName ("http://www.w3.org/2001/XMLSchema", 75 "string")), 76 new AltBeanDeserializerFactory(String .class, 77 new javax.xml.namespace.QName ("http://www.w3.org/2001/XMLSchema", 78 "string"))); 79 80 String [] args = new String [argv.length - 1]; 81 for (int n = 1; n < argv.length; ++n) { 82 args[n - 1] = argv[n]; 83 } 84 Class.forName("org.apache.axis.transport.http.SimpleAxisServer") 85 .getDeclaredMethod("main", new Class [] { 86 args.getClass() 87 }) 88 .invoke(null, new Object [] { 89 args 90 }); 91 } catch (Exception e) { 92 throw new RootError(e); 93 } 94 } 95 96 public static PackageAdministration getPackageAdministration() { 97 return packageAdministration; 98 } 99 100 public static RepositoryMgr getRepositoryMgr() { 101 return repositoryMgr; 102 } 103 104 public static AdminMisc getAdminMiscUtilities() { 105 return adminMisc; 106 } 107 } 108 | Popular Tags |