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.XmlTransient;
025: import javax.xml.bind.annotation.XmlType;
026: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
027: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
028: import java.util.ArrayList;
029: import java.util.List;
030: import java.util.Collection;
031: import java.util.Map;
032:
033: @XmlAccessorType(XmlAccessType.FIELD)
034: @XmlType(name="servletType",propOrder={"descriptions","displayNames","icon","servletName","servletClass","jspFile","initParam","loadOnStartup","runAs","securityRoleRef"})
035: public class Servlet {
036:
037: @XmlTransient
038: protected TextMap description = new TextMap();
039: @XmlTransient
040: protected TextMap displayName = new TextMap();
041: @XmlElement(name="icon",required=true)
042: protected LocalCollection<Icon> icon = new LocalCollection<Icon>();
043:
044: @XmlElement(name="servlet-name",required=true)
045: protected String servletName;
046: @XmlElement(name="servlet-class")
047: protected String servletClass;
048: @XmlElement(name="jsp-file")
049: protected String jspFile;
050: @XmlElement(name="init-param")
051: protected List<ParamValue> initParam;
052: @XmlElement(name="load-on-startup")
053: protected Boolean loadOnStartup;
054: @XmlElement(name="run-as")
055: protected RunAs runAs;
056: @XmlElement(name="security-role-ref")
057: protected List<SecurityRoleRef> securityRoleRef;
058: @XmlAttribute
059: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
060: @XmlID
061: protected String id;
062:
063: @XmlElement(name="description",required=true)
064: public Text[] getDescriptions() {
065: return description.toArray();
066: }
067:
068: public void setDescriptions(Text[] text) {
069: description.set(text);
070: }
071:
072: public String getDescription() {
073: return description.get();
074: }
075:
076: @XmlElement(name="display-name",required=true)
077: public Text[] getDisplayNames() {
078: return displayName.toArray();
079: }
080:
081: public void setDisplayNames(Text[] text) {
082: displayName.set(text);
083: }
084:
085: public String getDisplayName() {
086: return displayName.get();
087: }
088:
089: public Collection<Icon> getIcons() {
090: if (icon == null) {
091: icon = new LocalCollection<Icon>();
092: }
093: return icon;
094: }
095:
096: public Map<String, Icon> getIconMap() {
097: if (icon == null) {
098: icon = new LocalCollection<Icon>();
099: }
100: return icon.toMap();
101: }
102:
103: public Icon getIcon() {
104: return icon.getLocal();
105: }
106:
107: public String getServletName() {
108: return servletName;
109: }
110:
111: public void setServletName(String value) {
112: this .servletName = value;
113: }
114:
115: public String getServletClass() {
116: return servletClass;
117: }
118:
119: public void setServletClass(String value) {
120: this .servletClass = value;
121: }
122:
123: public String getJspFile() {
124: return jspFile;
125: }
126:
127: public void setJspFile(String value) {
128: this .jspFile = value;
129: }
130:
131: public List<ParamValue> getInitParam() {
132: if (initParam == null) {
133: initParam = new ArrayList<ParamValue>();
134: }
135: return this .initParam;
136: }
137:
138: public Boolean getLoadOnStartup() {
139: return loadOnStartup;
140: }
141:
142: public void setLoadOnStartup(Boolean value) {
143: this .loadOnStartup = value;
144: }
145:
146: public RunAs getRunAs() {
147: return runAs;
148: }
149:
150: public void setRunAs(RunAs value) {
151: this .runAs = value;
152: }
153:
154: public List<SecurityRoleRef> getSecurityRoleRef() {
155: if (securityRoleRef == null) {
156: securityRoleRef = new ArrayList<SecurityRoleRef>();
157: }
158: return this .securityRoleRef;
159: }
160:
161: public String getId() {
162: return id;
163: }
164:
165: public void setId(String value) {
166: this.id = value;
167: }
168:
169: }
|