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 AdminService extends AbstractService 35 { 36 private static Log log = LogFactory.getLog(AdminService.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("get_registryinfo"); 49 operations.add("find_publisher"); 50 operations.add("get_publisherdetail"); 51 operations.add("save_publisher"); 52 operations.add("delete_publisher"); 53 } 54 55 public void validateRequest(String operation,String version,Element uddiReq) 56 throws RegistryException 57 { 58 64 if (version == null) 65 throw new FatalErrorException("A jUDDI generic attribute " + 66 "value was not found for UDDI request: "+operation+" (The " + 67 "'generic' attribute must be present)"); 68 else if (!version.equals(IRegistry.JUDDI_V1_GENERIC)) 69 throw new UnsupportedException("Only jUDDI v1 requests " + 70 "are currently supported. The generic attribute value " + 71 "received was: "+version); 72 73 if ((operation == null) || (operation.trim().length() == 0)) 74 throw new FatalErrorException("The jUDDI service operation " + 75 "could not be identified."); 76 else if (!operations.contains(operation.toLowerCase())) 77 throw new UnsupportedException("The operation "+operation+" is not " + 78 "supported by the jUDDI Admin API."); 79 } 80 } 81 | Popular Tags |