1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
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 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
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 |
1
| public String getContextName()
|
42 |
| { |
43 |
1
| return _contextName;
|
44 |
| } |
45 |
| |
46 |
1
| public String getRootDirectory()
|
47 |
| { |
48 |
1
| return _rootDirectory;
|
49 |
| } |
50 |
| |
51 |
9
| public void setContextName(String string)
|
52 |
| { |
53 |
9
| _contextName = string;
|
54 |
| } |
55 |
| |
56 |
9
| public void setRootDirectory(String string)
|
57 |
| { |
58 |
9
| _rootDirectory = string;
|
59 |
| } |
60 |
| |
61 |
| |
62 |
| |
63 |
| |
64 |
14
| public ServletDescriptor getServletDescriptor(String name)
|
65 |
| { |
66 |
14
| return (ServletDescriptor) _servletDescriptors.get(name);
|
67 |
| } |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
| |
73 |
| |
74 |
| |
75 |
9
| public void addServletDescriptor(ServletDescriptor sd)
|
76 |
| { |
77 |
9
| String name = sd.getName();
|
78 |
| |
79 |
9
| ServletDescriptor existing = getServletDescriptor(name);
|
80 |
| |
81 |
9
| if (existing != null)
|
82 |
1
| 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 |
8
| _servletDescriptors.put(name, sd);
|
94 |
| |
95 |
8
| if (_defaultServletDescriptor == null)
|
96 |
5
| _defaultServletDescriptor = sd;
|
97 |
| } |
98 |
| |
99 |
7
| public void addRequestDescriptor(RequestDescriptor rd)
|
100 |
| { |
101 |
7
| _requests.add(rd);
|
102 |
| } |
103 |
| |
104 |
| |
105 |
| |
106 |
| |
107 |
| |
108 |
5
| public List getRequestDescriptors()
|
109 |
| { |
110 |
5
| return _requests;
|
111 |
| } |
112 |
| |
113 |
2
| public ServletDescriptor getDefaultServletDescriptor()
|
114 |
| { |
115 |
2
| return _defaultServletDescriptor;
|
116 |
| } |
117 |
| |
118 |
| } |