KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > wfxml > SharkServiceImpl


1 /* SharkWebServiceImpl.java */
2
3 package org.enhydra.shark.wfxml;
4
5 import javax.xml.namespace.QName JavaDoc;
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 /**
15  * @author V.Puskas, S.Bojanic
16  * @version 0.2
17  */

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 JavaDoc[] 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             /*String pkgId = repositoryMgr.getPackageId(XPDL_FILENAME);
42             if (!packageAdministration.isPackageOpened(pkgId)) {
43                packageAdministration.openPackage(XPDL_FILENAME);
44              }*/

45
46          } catch (Throwable JavaDoc t) {
47             t.printStackTrace();
48          }
49
50          //asapPersistenceManager=new DODSAsapPersistenceManager();
51
//asapPersistenceManager.configure(Shark.getInstance().getProperties());
52

53          //sharkExternalRequester=new RequesterImpl();
54

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          //restoreExternalRequester();
68
QName JavaDoc xmlType = new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema",
69                                                        "anyType");
70          DefaultTypeMappingImpl.getSingleton()
71             .register(String JavaDoc.class,
72                       xmlType,
73                       new SimpleSerializerFactory(String JavaDoc.class,
74                                                 new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema",
75                                                 "string")),
76                       new AltBeanDeserializerFactory(String JavaDoc.class,
77                                                      new javax.xml.namespace.QName JavaDoc("http://www.w3.org/2001/XMLSchema",
78                                                                                    "string")));
79
80          String JavaDoc[] args = new String JavaDoc[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 JavaDoc[] {
86                args.getClass()
87             })
88             .invoke(null, new Object JavaDoc[] {
89                args
90             });
91       } catch (Exception JavaDoc 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