001: /**
002: *
003: * Licensed to the Apache Software Foundation (ASF) under one or more
004: * contributor license agreements. See the NOTICE file distributed with
005: * this work for additional information regarding copyright ownership.
006: * The ASF licenses this file to You under the Apache License, Version 2.0
007: * (the "License"); you may not use this file except in compliance with
008: * the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */package org.apache.openejb.jee;
018:
019: import javax.xml.bind.annotation.XmlAccessType;
020: import javax.xml.bind.annotation.XmlAccessorType;
021: import javax.xml.bind.annotation.XmlAttribute;
022: import javax.xml.bind.annotation.XmlElement;
023: import javax.xml.bind.annotation.XmlID;
024: import javax.xml.bind.annotation.XmlRootElement;
025: import javax.xml.bind.annotation.XmlTransient;
026: import javax.xml.bind.annotation.XmlType;
027: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
028: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
029: import java.util.ArrayList;
030: import java.util.List;
031: import java.util.Collection;
032: import java.util.Map;
033:
034: @XmlRootElement(name="web-app")
035: @XmlAccessorType(XmlAccessType.FIELD)
036: @XmlType(name="web-appType",propOrder={"descriptions","displayNames","icon","distributable","contextParam","filter","filterMapping","listener","servlet","servletMapping","sessionConfig","mimeMapping","welcomeFileList","errorPage","jspConfig","securityConstraint","loginConfig","securityRole","localeEncodingMappingList","envEntry","ejbRef","ejbLocalRef","serviceRef","resourceRef","resourceEnvRef","messageDestinationRef","persistenceContextRef","persistenceUnitRef","postConstruct","preDestroy","messageDestination"})
037: public class WebApp implements JndiConsumer {
038: @XmlTransient
039: private String contextRoot;
040:
041: @XmlTransient
042: protected TextMap description = new TextMap();
043: @XmlTransient
044: protected TextMap displayName = new TextMap();
045: @XmlElement(name="icon",required=true)
046: protected LocalCollection<Icon> icon = new LocalCollection<Icon>();
047:
048: protected List<EmptyType> distributable;
049: @XmlElement(name="context-param")
050: protected List<ParamValue> contextParam;
051: protected List<Filter> filter;
052: @XmlElement(name="filter-mapping")
053: protected List<FilterMapping> filterMapping;
054: protected List<Listener> listener;
055: protected List<Servlet> servlet;
056: @XmlElement(name="servlet-mapping")
057: protected List<ServletMapping> servletMapping;
058: @XmlElement(name="session-config")
059: protected List<SessionConfig> sessionConfig;
060: @XmlElement(name="mime-mapping")
061: protected List<MimeMapping> mimeMapping;
062: @XmlElement(name="welcome-file-list")
063: protected List<WelcomeFileList> welcomeFileList;
064: @XmlElement(name="error-page")
065: protected List<ErrorPage> errorPage;
066: @XmlElement(name="jsp-config")
067: protected List<JspConfig> jspConfig;
068: @XmlElement(name="security-constraint")
069: protected List<SecurityConstraint> securityConstraint;
070: @XmlElement(name="login-config")
071: protected List<LoginConfigType> loginConfig;
072: @XmlElement(name="security-role")
073: protected List<SecurityRole> securityRole;
074: @XmlElement(name="locale-encoding-mapping-list")
075: protected List<LocaleEncodingMappingList> localeEncodingMappingList;
076:
077: @XmlElement(name="env-entry",required=true)
078: protected KeyedCollection<String, EnvEntry> envEntry;
079: @XmlElement(name="ejb-ref",required=true)
080: protected KeyedCollection<String, EjbRef> ejbRef;
081: @XmlElement(name="ejb-local-ref",required=true)
082: protected KeyedCollection<String, EjbLocalRef> ejbLocalRef;
083: @XmlElement(name="service-ref",required=true)
084: protected KeyedCollection<String, ServiceRef> serviceRef;
085: @XmlElement(name="resource-ref",required=true)
086: protected KeyedCollection<String, ResourceRef> resourceRef;
087: @XmlElement(name="resource-env-ref",required=true)
088: protected KeyedCollection<String, ResourceEnvRef> resourceEnvRef;
089: @XmlElement(name="message-destination-ref",required=true)
090: protected KeyedCollection<String, MessageDestinationRef> messageDestinationRef;
091: @XmlElement(name="persistence-context-ref",required=true)
092: protected KeyedCollection<String, PersistenceContextRef> persistenceContextRef;
093: @XmlElement(name="persistence-unit-ref",required=true)
094: protected KeyedCollection<String, PersistenceUnitRef> persistenceUnitRef;
095: @XmlElement(name="post-construct",required=true)
096: protected List<LifecycleCallback> postConstruct;
097: @XmlElement(name="pre-destroy",required=true)
098: protected List<LifecycleCallback> preDestroy;
099:
100: @XmlElement(name="message-destination",required=true)
101: protected List<MessageDestination> messageDestination;
102:
103: @XmlAttribute
104: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
105: @XmlID
106: protected String id;
107: @XmlAttribute(name="metadata-complete")
108: protected Boolean metadataComplete;
109: @XmlAttribute(required=true)
110: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
111: protected String version;
112:
113: public String getJndiConsumerName() {
114: return contextRoot;
115: }
116:
117: public String getContextRoot() {
118: return contextRoot;
119: }
120:
121: public void setContextRoot(String contextRoot) {
122: this .contextRoot = contextRoot;
123: }
124:
125: @XmlElement(name="description",required=true)
126: public Text[] getDescriptions() {
127: return description.toArray();
128: }
129:
130: public void setDescriptions(Text[] text) {
131: description.set(text);
132: }
133:
134: public String getDescription() {
135: return description.get();
136: }
137:
138: @XmlElement(name="display-name",required=true)
139: public Text[] getDisplayNames() {
140: return displayName.toArray();
141: }
142:
143: public void setDisplayNames(Text[] text) {
144: displayName.set(text);
145: }
146:
147: public String getDisplayName() {
148: return displayName.get();
149: }
150:
151: public Collection<Icon> getIcons() {
152: if (icon == null) {
153: icon = new LocalCollection<Icon>();
154: }
155: return icon;
156: }
157:
158: public Map<String, Icon> getIconMap() {
159: if (icon == null) {
160: icon = new LocalCollection<Icon>();
161: }
162: return icon.toMap();
163: }
164:
165: public Icon getIcon() {
166: return icon.getLocal();
167: }
168:
169: public List<EmptyType> getDistributable() {
170: if (distributable == null) {
171: distributable = new ArrayList<EmptyType>();
172: }
173: return this .distributable;
174: }
175:
176: public List<ParamValue> getContextParam() {
177: if (contextParam == null) {
178: contextParam = new ArrayList<ParamValue>();
179: }
180: return this .contextParam;
181: }
182:
183: public List<Filter> getFilter() {
184: if (filter == null) {
185: filter = new ArrayList<Filter>();
186: }
187: return this .filter;
188: }
189:
190: public List<FilterMapping> getFilterMapping() {
191: if (filterMapping == null) {
192: filterMapping = new ArrayList<FilterMapping>();
193: }
194: return this .filterMapping;
195: }
196:
197: public List<Listener> getListener() {
198: if (listener == null) {
199: listener = new ArrayList<Listener>();
200: }
201: return this .listener;
202: }
203:
204: public List<Servlet> getServlet() {
205: if (servlet == null) {
206: servlet = new ArrayList<Servlet>();
207: }
208: return this .servlet;
209: }
210:
211: public List<ServletMapping> getServletMapping() {
212: if (servletMapping == null) {
213: servletMapping = new ArrayList<ServletMapping>();
214: }
215: return this .servletMapping;
216: }
217:
218: public List<SessionConfig> getSessionConfig() {
219: if (sessionConfig == null) {
220: sessionConfig = new ArrayList<SessionConfig>();
221: }
222: return this .sessionConfig;
223: }
224:
225: public List<MimeMapping> getMimeMapping() {
226: if (mimeMapping == null) {
227: mimeMapping = new ArrayList<MimeMapping>();
228: }
229: return this .mimeMapping;
230: }
231:
232: public List<WelcomeFileList> getWelcomeFileList() {
233: if (welcomeFileList == null) {
234: welcomeFileList = new ArrayList<WelcomeFileList>();
235: }
236: return this .welcomeFileList;
237: }
238:
239: public List<ErrorPage> getErrorPage() {
240: if (errorPage == null) {
241: errorPage = new ArrayList<ErrorPage>();
242: }
243: return this .errorPage;
244: }
245:
246: public List<JspConfig> getJspConfig() {
247: if (jspConfig == null) {
248: jspConfig = new ArrayList<JspConfig>();
249: }
250: return this .jspConfig;
251: }
252:
253: public List<SecurityConstraint> getSecurityConstraint() {
254: if (securityConstraint == null) {
255: securityConstraint = new ArrayList<SecurityConstraint>();
256: }
257: return this .securityConstraint;
258: }
259:
260: public List<LoginConfigType> getLoginConfig() {
261: if (loginConfig == null) {
262: loginConfig = new ArrayList<LoginConfigType>();
263: }
264: return this .loginConfig;
265: }
266:
267: public List<SecurityRole> getSecurityRole() {
268: if (securityRole == null) {
269: securityRole = new ArrayList<SecurityRole>();
270: }
271: return this .securityRole;
272: }
273:
274: public List<LocaleEncodingMappingList> getLocaleEncodingMappingList() {
275: if (localeEncodingMappingList == null) {
276: localeEncodingMappingList = new ArrayList<LocaleEncodingMappingList>();
277: }
278: return this .localeEncodingMappingList;
279: }
280:
281: public Collection<EnvEntry> getEnvEntry() {
282: if (envEntry == null) {
283: envEntry = new KeyedCollection<String, EnvEntry>();
284: }
285: return this .envEntry;
286: }
287:
288: public Map<String, EnvEntry> getEnvEntryMap() {
289: if (envEntry == null) {
290: envEntry = new KeyedCollection<String, EnvEntry>();
291: }
292: return this .envEntry.toMap();
293: }
294:
295: public Collection<EjbRef> getEjbRef() {
296: if (ejbRef == null) {
297: ejbRef = new KeyedCollection<String, EjbRef>();
298: }
299: return this .ejbRef;
300: }
301:
302: public Map<String, EjbRef> getEjbRefMap() {
303: if (ejbRef == null) {
304: ejbRef = new KeyedCollection<String, EjbRef>();
305: }
306: return this .ejbRef.toMap();
307: }
308:
309: public Collection<EjbLocalRef> getEjbLocalRef() {
310: if (ejbLocalRef == null) {
311: ejbLocalRef = new KeyedCollection<String, EjbLocalRef>();
312: }
313: return this .ejbLocalRef;
314: }
315:
316: public Map<String, EjbLocalRef> getEjbLocalRefMap() {
317: if (ejbLocalRef == null) {
318: ejbLocalRef = new KeyedCollection<String, EjbLocalRef>();
319: }
320: return this .ejbLocalRef.toMap();
321: }
322:
323: public Collection<ServiceRef> getServiceRef() {
324: if (serviceRef == null) {
325: serviceRef = new KeyedCollection<String, ServiceRef>();
326: }
327: return this .serviceRef;
328: }
329:
330: public Map<String, ServiceRef> getServiceRefMap() {
331: if (serviceRef == null) {
332: serviceRef = new KeyedCollection<String, ServiceRef>();
333: }
334: return this .serviceRef.toMap();
335: }
336:
337: public Collection<ResourceRef> getResourceRef() {
338: if (resourceRef == null) {
339: resourceRef = new KeyedCollection<String, ResourceRef>();
340: }
341: return this .resourceRef;
342: }
343:
344: public Map<String, ResourceRef> getResourceRefMap() {
345: if (resourceRef == null) {
346: resourceRef = new KeyedCollection<String, ResourceRef>();
347: }
348: return this .resourceRef.toMap();
349: }
350:
351: public Collection<ResourceEnvRef> getResourceEnvRef() {
352: if (resourceEnvRef == null) {
353: resourceEnvRef = new KeyedCollection<String, ResourceEnvRef>();
354: }
355: return this .resourceEnvRef;
356: }
357:
358: public Map<String, ResourceEnvRef> getResourceEnvRefMap() {
359: if (resourceEnvRef == null) {
360: resourceEnvRef = new KeyedCollection<String, ResourceEnvRef>();
361: }
362: return this .resourceEnvRef.toMap();
363: }
364:
365: public Collection<MessageDestinationRef> getMessageDestinationRef() {
366: if (messageDestinationRef == null) {
367: messageDestinationRef = new KeyedCollection<String, MessageDestinationRef>();
368: }
369: return this .messageDestinationRef;
370: }
371:
372: public Map<String, MessageDestinationRef> getMessageDestinationRefMap() {
373: if (messageDestinationRef == null) {
374: messageDestinationRef = new KeyedCollection<String, MessageDestinationRef>();
375: }
376: return this .messageDestinationRef.toMap();
377: }
378:
379: public Collection<PersistenceContextRef> getPersistenceContextRef() {
380: if (persistenceContextRef == null) {
381: persistenceContextRef = new KeyedCollection<String, PersistenceContextRef>();
382: }
383: return this .persistenceContextRef;
384: }
385:
386: public Map<String, PersistenceContextRef> getPersistenceContextRefMap() {
387: if (persistenceContextRef == null) {
388: persistenceContextRef = new KeyedCollection<String, PersistenceContextRef>();
389: }
390: return this .persistenceContextRef.toMap();
391: }
392:
393: public Collection<PersistenceUnitRef> getPersistenceUnitRef() {
394: if (persistenceUnitRef == null) {
395: persistenceUnitRef = new KeyedCollection<String, PersistenceUnitRef>();
396: }
397: return this .persistenceUnitRef;
398: }
399:
400: public Map<String, PersistenceUnitRef> getPersistenceUnitRefMap() {
401: if (persistenceUnitRef == null) {
402: persistenceUnitRef = new KeyedCollection<String, PersistenceUnitRef>();
403: }
404: return this .persistenceUnitRef.toMap();
405: }
406:
407: public List<LifecycleCallback> getPostConstruct() {
408: if (postConstruct == null) {
409: postConstruct = new ArrayList<LifecycleCallback>();
410: }
411: return this .postConstruct;
412: }
413:
414: public List<LifecycleCallback> getPreDestroy() {
415: if (preDestroy == null) {
416: preDestroy = new ArrayList<LifecycleCallback>();
417: }
418: return this .preDestroy;
419: }
420:
421: public List<MessageDestination> getMessageDestination() {
422: if (messageDestination == null) {
423: messageDestination = new ArrayList<MessageDestination>();
424: }
425: return this .messageDestination;
426: }
427:
428: public String getId() {
429: return id;
430: }
431:
432: public void setId(String value) {
433: this .id = value;
434: }
435:
436: public Boolean isMetadataComplete() {
437: return metadataComplete != null && metadataComplete;
438: }
439:
440: public void setMetadataComplete(Boolean value) {
441: this .metadataComplete = value;
442: }
443:
444: public String getVersion() {
445: return version;
446: }
447:
448: public void setVersion(String value) {
449: this.version = value;
450: }
451:
452: }
|