KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > test > UploadXPDL


1 package org.enhydra.shark.test;
2
3 import java.util.*;
4 import org.enhydra.shark.Shark;
5 import org.enhydra.shark.api.client.wfservice.ExternalPackageInvalid;
6 import org.enhydra.shark.api.client.wfservice.PackageAdministration;
7 import org.enhydra.shark.api.client.wfservice.PackageInvalid;
8
9 public class UploadXPDL {
10
11    public static void main (String JavaDoc[] args) throws Exception JavaDoc {
12       String JavaDoc confF=args[0];
13       List xpdlsToLoad=new ArrayList();
14       for (int i=1; i<args.length; i++) {
15          xpdlsToLoad.add(args[i]);
16       }
17
18       Shark.configure(confF);
19       Shark ss=Shark.getInstance();
20       PackageAdministration pa=ss.getAdminInterface().getPackageAdministration();
21
22       try {
23          Iterator it=xpdlsToLoad.iterator();
24          while (it.hasNext()) {
25             pa.openPackage((String JavaDoc)it.next());
26          }
27       } catch (Throwable JavaDoc ex) {
28          if (ex instanceof PackageInvalid) {
29             System.out.println("PIERRS="+((PackageInvalid)ex).getXPDLValidationErrors());
30          }
31          if (ex instanceof ExternalPackageInvalid) {
32             System.out.println("PIERRS="+((ExternalPackageInvalid)ex).getXPDLValidationErrors());
33          }
34          ex.printStackTrace();
35       } finally {
36          org.enhydra.dods.DODS.shutdown();
37          System.exit(0);
38       }
39
40    }
41
42 }
43
44
Popular Tags