1 15 package org.apache.tapestry.test; 16 17 import java.util.ArrayList ; 18 import java.util.HashMap ; 19 import java.util.List ; 20 import java.util.Map ; 21 22 import org.apache.hivemind.ApplicationRuntimeException; 23 import org.apache.hivemind.impl.BaseLocatable; 24 25 31 public class ScriptDescriptor extends BaseLocatable 32 { 33 private String _contextName; 34 private String _rootDirectory; 35 36 private Map _servletDescriptors = new HashMap (); 37 private List _requests = new ArrayList (); 38 39 private ServletDescriptor _defaultServletDescriptor; 40 41 public String getContextName() 42 { 43 return _contextName; 44 } 45 46 public String getRootDirectory() 47 { 48 return _rootDirectory; 49 } 50 51 public void setContextName(String string) 52 { 53 _contextName = string; 54 } 55 56 public void setRootDirectory(String string) 57 { 58 _rootDirectory = string; 59 } 60 61 64 public ServletDescriptor getServletDescriptor(String name) 65 { 66 return (ServletDescriptor) _servletDescriptors.get(name); 67 } 68 69 75 public void addServletDescriptor(ServletDescriptor sd) 76 { 77 String name = sd.getName(); 78 79 ServletDescriptor existing = getServletDescriptor(name); 80 81 if (existing != null) 82 throw new ApplicationRuntimeException( 83 "Servlet descriptor '" 84 + name 85 + "' (at " 86 + sd.getLocation() 87 + ") conflicts with prior instance at " 88 + existing.getLocation() 89 + ".", 90 sd.getLocation(), 91 null); 92 93 _servletDescriptors.put(name, sd); 94 95 if (_defaultServletDescriptor == null) 96 _defaultServletDescriptor = sd; 97 } 98 99 public void addRequestDescriptor(RequestDescriptor rd) 100 { 101 _requests.add(rd); 102 } 103 104 108 public List getRequestDescriptors() 109 { 110 return _requests; 111 } 112 113 public ServletDescriptor getDefaultServletDescriptor() 114 { 115 return _defaultServletDescriptor; 116 } 117 118 } 119 | Popular Tags |