1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
package org.apache.jetspeed.om.servlet.impl; |
18 |
|
|
19 |
|
import java.io.Serializable; |
20 |
|
import java.util.ArrayList; |
21 |
|
import java.util.Collection; |
22 |
|
import java.util.Locale; |
23 |
|
|
24 |
|
import javax.servlet.ServletContext; |
25 |
|
|
26 |
|
import org.apache.commons.logging.Log; |
27 |
|
import org.apache.commons.logging.LogFactory; |
28 |
|
import org.apache.jetspeed.om.common.MutableDescription; |
29 |
|
import org.apache.jetspeed.om.common.MutableDisplayName; |
30 |
|
import org.apache.jetspeed.om.common.servlet.MutableWebApplication; |
31 |
|
import org.apache.jetspeed.om.impl.DescriptionImpl; |
32 |
|
import org.apache.jetspeed.om.impl.DescriptionSetImpl; |
33 |
|
import org.apache.jetspeed.om.impl.DisplayNameSetImpl; |
34 |
|
import org.apache.jetspeed.om.impl.WebAppDescriptionImpl; |
35 |
|
import org.apache.jetspeed.om.impl.WebAppDisplayNameImpl; |
36 |
|
import org.apache.jetspeed.util.JetspeedLocale; |
37 |
|
import org.apache.jetspeed.util.JetspeedLongObjectID; |
38 |
|
import org.apache.pluto.om.common.Description; |
39 |
|
import org.apache.pluto.om.common.DescriptionSet; |
40 |
|
import org.apache.pluto.om.common.DisplayName; |
41 |
|
import org.apache.pluto.om.common.DisplayNameSet; |
42 |
|
import org.apache.pluto.om.common.ObjectID; |
43 |
|
import org.apache.pluto.om.common.ParameterSet; |
44 |
|
import org.apache.pluto.om.servlet.ServletDefinitionList; |
45 |
|
import org.apache.pluto.om.common.SecurityRole; |
46 |
|
import org.apache.pluto.om.common.SecurityRoleSet; |
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
0 |
public class WebApplicationDefinitionImpl implements MutableWebApplication, Serializable |
57 |
|
{ |
58 |
|
private Long id; |
59 |
|
private JetspeedLongObjectID oid; |
60 |
0 |
private Collection displayNames = new ArrayList(); |
61 |
0 |
private DisplayNameSetImpl DNCollWrapper = new DisplayNameSetImpl(); |
62 |
|
|
63 |
0 |
private Collection descriptions = new ArrayList(); |
64 |
0 |
private DescriptionSetImpl descCollWrapper = new DescriptionSetImpl(DescriptionImpl.TYPE_WEB_APP); |
65 |
0 |
private Collection securityRoles = new ArrayList(); |
66 |
0 |
private SecurityRoleSetImpl secRolesListWrapper = new SecurityRoleSetImpl(); |
67 |
|
|
68 |
|
private String contextRoot; |
69 |
|
private ParameterSet initParameters; |
70 |
|
|
71 |
0 |
private static final Log log = LogFactory.getLog(WebApplicationDefinitionImpl.class); |
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
public ObjectID getId() |
77 |
|
{ |
78 |
0 |
if ( oid == null && id != class="keyword">null ) |
79 |
|
{ |
80 |
0 |
oid = new JetspeedLongObjectID(id); |
81 |
|
} |
82 |
0 |
return oid; |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
public DisplayName getDisplayName(Locale locale) |
89 |
|
{ |
90 |
|
|
91 |
0 |
if (displayNames != null) |
92 |
|
{ |
93 |
0 |
DNCollWrapper.setInnerCollection(displayNames); |
94 |
0 |
return DNCollWrapper.get(locale); |
95 |
|
} |
96 |
0 |
return null; |
97 |
|
|
98 |
|
} |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
public Description getDescription(Locale locale) |
104 |
|
{ |
105 |
0 |
if (descriptions != null) |
106 |
|
{ |
107 |
0 |
descCollWrapper.setInnerCollection(descriptions); |
108 |
0 |
return descCollWrapper.get(locale); |
109 |
|
} |
110 |
0 |
return null; |
111 |
|
|
112 |
|
} |
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
public ParameterSet getInitParameterSet() |
118 |
|
{ |
119 |
0 |
return initParameters; |
120 |
|
} |
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
public ServletDefinitionList getServletDefinitionList() |
126 |
|
{ |
127 |
|
|
128 |
0 |
return null; |
129 |
|
} |
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
public ServletContext getServletContext(ServletContext servletContext) |
135 |
|
{ |
136 |
|
|
137 |
0 |
return null; |
138 |
|
} |
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
public String getContextRoot() |
144 |
|
{ |
145 |
0 |
return contextRoot; |
146 |
|
} |
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
public void setDisplayNameSet(DisplayNameSet displayNames) |
152 |
|
{ |
153 |
0 |
this.displayNames = ((DisplayNameSetImpl) displayNames).getInnerCollection(); |
154 |
0 |
} |
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
|
159 |
|
public void setContextRoot(String contextRoot) |
160 |
|
{ |
161 |
0 |
this.contextRoot = contextRoot; |
162 |
0 |
} |
163 |
|
|
164 |
|
|
165 |
|
|
166 |
|
|
167 |
|
public void addDescription(Locale locale, String description) |
168 |
|
{ |
169 |
0 |
if (descriptions == null) |
170 |
|
{ |
171 |
0 |
descriptions = new ArrayList(); |
172 |
|
} |
173 |
0 |
descCollWrapper.setInnerCollection(descriptions); |
174 |
|
try |
175 |
|
{ |
176 |
0 |
MutableDescription descObj = new WebAppDescriptionImpl(); |
177 |
|
|
178 |
0 |
descObj.setLocale(locale); |
179 |
0 |
descObj.setDescription(description); |
180 |
0 |
descCollWrapper.addDescription(descObj); |
181 |
|
} |
182 |
0 |
catch (Exception e) |
183 |
|
{ |
184 |
0 |
String msg = "Unable to instantiate Description implementor, " + e.toString(); |
185 |
0 |
log.error(msg, e); |
186 |
0 |
throw new IllegalStateException(msg); |
187 |
0 |
} |
188 |
0 |
} |
189 |
|
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
|
public void addDisplayName(Locale locale, String name) |
194 |
|
{ |
195 |
0 |
if (displayNames == null) |
196 |
|
{ |
197 |
0 |
displayNames = new ArrayList(); |
198 |
|
} |
199 |
0 |
DNCollWrapper.setInnerCollection(displayNames); |
200 |
|
try |
201 |
|
{ |
202 |
0 |
MutableDisplayName dn = new WebAppDisplayNameImpl(); |
203 |
|
|
204 |
0 |
dn.setLocale(locale); |
205 |
0 |
dn.setDisplayName(name); |
206 |
0 |
DNCollWrapper.addDisplayName(dn); |
207 |
|
} |
208 |
0 |
catch (Exception e) |
209 |
|
{ |
210 |
0 |
String msg = "Unable to instantiate DisplayName implementor, " + e.toString(); |
211 |
0 |
log.error(msg, e); |
212 |
0 |
throw new IllegalStateException(msg); |
213 |
0 |
} |
214 |
|
|
215 |
0 |
} |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
|
public void setDescriptionSet(DescriptionSet descriptions) |
221 |
|
{ |
222 |
0 |
this.descriptions = ((DescriptionSetImpl) descriptions).getInnerCollection(); |
223 |
0 |
} |
224 |
|
|
225 |
|
|
226 |
|
|
227 |
|
|
228 |
|
|
229 |
|
|
230 |
|
public String getDescription() |
231 |
|
{ |
232 |
0 |
Description desc = getDescription(JetspeedLocale.getDefaultLocale()); |
233 |
0 |
if (desc != null) |
234 |
|
{ |
235 |
0 |
return desc.getDescription(); |
236 |
|
} |
237 |
0 |
return null; |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
|
|
244 |
|
|
245 |
|
public void setDescription(String desc) |
246 |
|
{ |
247 |
0 |
addDescription(JetspeedLocale.getDefaultLocale(), desc); |
248 |
0 |
} |
249 |
|
|
250 |
|
|
251 |
|
|
252 |
|
|
253 |
|
public SecurityRoleSet getSecurityRoles() |
254 |
|
{ |
255 |
0 |
secRolesListWrapper.setInnerCollection(securityRoles); |
256 |
0 |
return secRolesListWrapper; |
257 |
|
} |
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
|
public void addSecurityRole(SecurityRole securityRole) |
263 |
|
{ |
264 |
0 |
secRolesListWrapper.setInnerCollection(securityRoles); |
265 |
0 |
secRolesListWrapper.add(securityRole); |
266 |
0 |
} |
267 |
|
} |