1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.function;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.apache.juddi.datastore.DataStore;
21 import org.apache.juddi.datastore.DataStoreFactory;
22 import org.apache.juddi.datatype.RegistryObject;
23 import org.apache.juddi.datatype.publisher.Publisher;
24 import org.apache.juddi.datatype.request.AuthInfo;
25 import org.apache.juddi.datatype.request.GetAssertionStatusReport;
26 import org.apache.juddi.datatype.response.AssertionStatusReport;
27 import org.apache.juddi.error.RegistryException;
28 import org.apache.juddi.registry.RegistryEngine;
29 import org.apache.juddi.util.Config;
30
31 /***
32 * @author Steve Viens (sviens@apache.org)
33 */
34 public class GetAssertionStatusReportFunction extends AbstractFunction
35 {
36
37 private static Log log = LogFactory.getLog(GetAssertionStatusReportFunction.class);
38
39 /***
40 *
41 */
42 public GetAssertionStatusReportFunction(RegistryEngine registry)
43 {
44 super(registry);
45 }
46
47 /***
48 *
49 */
50 public RegistryObject execute(RegistryObject regObject)
51 throws RegistryException
52 {
53 GetAssertionStatusReport request = (GetAssertionStatusReport)regObject;
54 String generic = request.getGeneric();
55 String completionStatus = request.getCompletionStatus();
56 AuthInfo authInfo = request.getAuthInfo();
57 AssertionStatusReport report = null;
58
59
60 DataStore dataStore = DataStoreFactory.getDataStore();
61
62 try
63 {
64 dataStore.beginTrans();
65
66
67 Publisher publisher = getPublisher(authInfo,dataStore);
68 String publisherID = publisher.getPublisherID();
69
70
71
72
73
74 report = new AssertionStatusReport();
75 report.setGeneric(generic);
76 report.setOperator(Config.getOperator());
77 report.setAssertionStatusItemVector(dataStore.getAssertionStatusItems(publisherID,completionStatus));
78
79 dataStore.commit();
80 }
81 catch(RegistryException regex)
82 {
83 try { dataStore.rollback(); } catch(Exception e) { }
84 log.error(regex);
85 throw (RegistryException)regex;
86 }
87 catch(Exception ex)
88 {
89 try { dataStore.rollback(); } catch(Exception e) { }
90 log.error(ex);
91 throw new RegistryException(ex);
92 }
93 finally
94 {
95 if (dataStore != null)
96 dataStore.release();
97 }
98
99
100
101 return report;
102 }
103
104
105 /****************************************************************************/
106 /****************************** TEST DRIVER *********************************/
107 /****************************************************************************/
108
109
110 public static void main(String[] args)
111 {
112
113 RegistryEngine reg = new RegistryEngine();
114 reg.init();
115
116 try
117 {
118 }
119 catch (Exception ex)
120 {
121
122 ex.printStackTrace();
123 }
124 finally
125 {
126
127 reg.dispose();
128 }
129 }
130 }