1 16 package org.apache.juddi.registry; 17 18 import java.util.TreeSet ; 19 20 import javax.servlet.ServletConfig ; 21 import javax.servlet.ServletException ; 22 23 import org.apache.commons.logging.Log; 24 import org.apache.commons.logging.LogFactory; 25 import org.apache.juddi.IRegistry; 26 import org.apache.juddi.error.FatalErrorException; 27 import org.apache.juddi.error.RegistryException; 28 import org.apache.juddi.error.UnsupportedException; 29 import org.apache.juddi.registry.AbstractService; 30 import org.w3c.dom.Element ; 31 32 35 public class PublishService extends AbstractService 36 { 37 private static Log log = LogFactory.getLog(PublishService.class); 39 40 private TreeSet operations = null; 42 43 public void init(ServletConfig config) 44 throws ServletException 45 { 46 super.init(config); 47 48 operations = new TreeSet (); 49 operations.add("get_authtoken"); 50 operations.add("get_registeredinfo"); 51 operations.add("discard_authtoken"); 52 operations.add("save_business"); 53 operations.add("save_service"); 54 operations.add("save_binding"); 55 operations.add("save_tmodel"); 56 operations.add("delete_business"); 57 operations.add("delete_service"); 58 operations.add("delete_binding"); 59 operations.add("delete_tmodel"); 60 operations.add("add_publisherassertions"); 61 operations.add("set_publisherassertions"); 62 operations.add("get_publisherassertions"); 63 operations.add("delete_publisherassertions"); 64 operations.add("get_assertionstatusreport"); 65 } 66 67 public void validateRequest(String operation,String version,Element uddiReq) 68 throws RegistryException 69 { 70 76 if (version == null) 77 throw new FatalErrorException("A UDDI generic attribute " + 78 "value was not found for UDDI request: "+operation+" (The " + 79 "'generic' attribute must be present)"); 80 else if (!version.equals(IRegistry.UDDI_V2_GENERIC)) 81 throw new UnsupportedException("Only UDDI v2 " + 82 "requests are currently supported. The generic attribute value " + 83 "received was: "+version); 84 85 if ((operation == null) || (operation.trim().length() == 0)) 86 throw new FatalErrorException("The UDDI service operation " + 87 "could not be identified."); 88 else if (!operations.contains(operation.toLowerCase())) 89 throw new UnsupportedException("The operation "+operation+" is not " + 90 "supported by the UDDI version 2 Publish API."); 91 } 92 } 93 | Popular Tags |