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.w3c.dom.Element ; 30 31 34 public class InquiryService extends AbstractService 35 { 36 private static Log log = LogFactory.getLog(InquiryService.class); 38 39 private TreeSet operations = null; 41 42 public void init(ServletConfig config) 43 throws ServletException 44 { 45 super.init(config); 46 47 operations = new TreeSet (); 48 operations.add("find_business"); 49 operations.add("find_service"); 50 operations.add("find_binding"); 51 operations.add("find_tmodel"); 52 operations.add("find_relatedbusinesses"); 53 operations.add("get_businessdetail"); 54 operations.add("get_businessdetailext"); 55 operations.add("get_servicedetail"); 56 operations.add("get_bindingdetail"); 57 operations.add("get_tmodeldetail"); 58 } 59 60 public void validateRequest(String operation,String version,Element uddiReq) 61 throws RegistryException 62 { 63 69 if (version == null) 70 throw new FatalErrorException("A UDDI generic attribute " + 71 "value was not found for UDDI request: "+operation+" (The " + 72 "'generic' attribute must be present)"); 73 else if (!version.equals(IRegistry.UDDI_V2_GENERIC)) 74 throw new UnsupportedException("Only UDDI v2 " + 75 "requests are currently supported. The generic attribute value " + 76 "received was: "+version); 77 78 if ((operation == null) || (operation.trim().length() == 0)) 79 throw new FatalErrorException("The UDDI service operation " + 80 "could not be identified."); 81 else if (!operations.contains(operation.toLowerCase())) 82 throw new UnsupportedException("The operation "+operation+" is not " + 83 "supported by the UDDI version 2 Inquiry API."); 84 } 85 } 86 | Popular Tags |