001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.jee;
017:
018: import javax.xml.bind.annotation.XmlAccessType;
019: import javax.xml.bind.annotation.XmlAccessorType;
020: import javax.xml.bind.annotation.XmlAttribute;
021: import javax.xml.bind.annotation.XmlElement;
022: import javax.xml.bind.annotation.XmlID;
023: import javax.xml.bind.annotation.XmlTransient;
024: import javax.xml.bind.annotation.XmlType;
025: import javax.xml.bind.annotation.XmlRootElement;
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.Collection;
030: import java.util.List;
031: import java.util.Map;
032:
033: /**
034: * The taglib tag is the document root, it defines:
035: * <p/>
036: * description a simple string describing the "use" of this
037: * taglib, should be user discernable
038: * <p/>
039: * display-name the display-name element contains a
040: * short name that is intended to be displayed
041: * by tools
042: * <p/>
043: * icon optional icon that can be used by tools
044: * <p/>
045: * tlib-version the version of the tag library implementation
046: * <p/>
047: * short-name a simple default short name that could be
048: * used by a JSP authoring tool to create
049: * names with a mnemonic value; for example,
050: * the it may be used as the prefered prefix
051: * value in taglib directives
052: * <p/>
053: * uri a uri uniquely identifying this taglib
054: * <p/>
055: * validator optional TagLibraryValidator information
056: * <p/>
057: * listener optional event listener specification
058: * <p/>
059: * tag tags in this tag library
060: * <p/>
061: * tag-file tag files in this tag library
062: * <p/>
063: * function zero or more EL functions defined in this
064: * tag library
065: * <p/>
066: * taglib-extension zero or more extensions that provide extra
067: * information about this taglib, for tool
068: * consumption
069: */
070: @XmlRootElement(name="taglib")
071: @XmlAccessorType(XmlAccessType.FIELD)
072: @XmlType(name="tldTaglibType",propOrder={"descriptions","displayNames","icon","tlibVersion","jspVersion","shortName","uri","validator","listener","tag","tagFile","function","taglibExtension"})
073: public class TldTaglib {
074: @XmlTransient
075: protected TextMap description = new TextMap();
076: @XmlTransient
077: protected TextMap displayName = new TextMap();
078: @XmlElement(name="icon",required=true)
079: protected LocalCollection<Icon> icon = new LocalCollection<Icon>();
080:
081: @XmlElement(name="tlib-version",required=true)
082: protected String tlibVersion;
083: @XmlElement(name="jsp-version")
084: protected String jspVersion;
085: @XmlElement(name="short-name",required=true)
086: protected String shortName;
087: protected String uri;
088: protected Validator validator;
089: protected List<Listener> listener;
090: protected List<Tag> tag;
091: @XmlElement(name="tag-file")
092: protected List<TagFile> tagFile;
093: protected List<Function> function;
094: @XmlElement(name="taglib-extension")
095: protected List<TldExtension> taglibExtension;
096: @XmlAttribute
097: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
098: @XmlID
099: protected String id;
100: @XmlAttribute(required=true)
101: protected String version;
102:
103: @XmlElement(name="description",required=true)
104: public Text[] getDescriptions() {
105: return description.toArray();
106: }
107:
108: public void setDescriptions(Text[] text) {
109: description.set(text);
110: }
111:
112: public String getDescription() {
113: return description.get();
114: }
115:
116: @XmlElement(name="display-name",required=true)
117: public Text[] getDisplayNames() {
118: return displayName.toArray();
119: }
120:
121: public void setDisplayNames(Text[] text) {
122: displayName.set(text);
123: }
124:
125: public String getDisplayName() {
126: return displayName.get();
127: }
128:
129: public Collection<Icon> getIcons() {
130: if (icon == null) {
131: icon = new LocalCollection<Icon>();
132: }
133: return icon;
134: }
135:
136: public Map<String, Icon> getIconMap() {
137: if (icon == null) {
138: icon = new LocalCollection<Icon>();
139: }
140: return icon.toMap();
141: }
142:
143: public Icon getIcon() {
144: return icon.getLocal();
145: }
146:
147: public String getTlibVersion() {
148: return tlibVersion;
149: }
150:
151: public void setTlibVersion(String value) {
152: this .tlibVersion = value;
153: }
154:
155: public String getJspVersion() {
156: return jspVersion;
157: }
158:
159: public void setJspVersion(String jspVersion) {
160: this .jspVersion = jspVersion;
161: }
162:
163: public String getShortName() {
164: return shortName;
165: }
166:
167: public void setShortName(String value) {
168: this .shortName = value;
169: }
170:
171: public String getUri() {
172: return uri;
173: }
174:
175: public void setUri(String value) {
176: this .uri = value;
177: }
178:
179: public Validator getValidator() {
180: return validator;
181: }
182:
183: public void setValidator(Validator value) {
184: this .validator = value;
185: }
186:
187: public List<Listener> getListener() {
188: if (listener == null) {
189: listener = new ArrayList<Listener>();
190: }
191: return this .listener;
192: }
193:
194: public List<Tag> getTag() {
195: if (tag == null) {
196: tag = new ArrayList<Tag>();
197: }
198: return this .tag;
199: }
200:
201: public List<TagFile> getTagFile() {
202: if (tagFile == null) {
203: tagFile = new ArrayList<TagFile>();
204: }
205: return this .tagFile;
206: }
207:
208: public List<Function> getFunction() {
209: if (function == null) {
210: function = new ArrayList<Function>();
211: }
212: return this .function;
213: }
214:
215: public List<TldExtension> getTaglibExtension() {
216: if (taglibExtension == null) {
217: taglibExtension = new ArrayList<TldExtension>();
218: }
219: return this .taglibExtension;
220: }
221:
222: public String getId() {
223: return id;
224: }
225:
226: public void setId(String value) {
227: this .id = value;
228: }
229:
230: public String getVersion() {
231: if (version == null) {
232: return "2.1";
233: } else {
234: return version;
235: }
236: }
237:
238: public void setVersion(String value) {
239: this.version = value;
240: }
241: }
|