1 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 36 public class GetPublisherAssertionsFunction extends AbstractFunction 37 { 38 private static Log log = LogFactory.getLog(GetPublisherAssertionsFunction.class); 40 41 44 public GetPublisherAssertionsFunction(RegistryEngine registry) 45 { 46 super(registry); 47 } 48 49 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 DataStore dataStore = DataStoreFactory.getDataStore(); 61 62 try 63 { 64 dataStore.beginTrans(); 65 66 Publisher publisher = getPublisher(authInfo,dataStore); 68 String publisherID = publisher.getPublisherID(); 69 70 73 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 106 107 108 109 public static void main(String [] args) 110 { 111 RegistryEngine reg = new RegistryEngine(); 113 reg.init(); 114 115 try 116 { 117 } 118 catch (Exception ex) 119 { 120 ex.printStackTrace(); 122 } 123 finally 124 { 125 reg.dispose(); 127 } 128 } 129 } | Popular Tags |