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