1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.tomcat.util.descriptor.tld;
18
19 import java.util.ArrayList;
20 import java.util.List;
21
22 import javax.servlet.jsp.tagext.FunctionInfo;
23
24 /**
25  * Common representation of a Tag Library Descriptor (TLD) XML file.
26  * <p>
27  * This stores the raw result of parsing an TLD XML file, flattening different
28  * version of the descriptors to a common format. This is different to a
29  * TagLibraryInfo instance that would be passed to a tag validator in that it
30  * does not contain the uri and prefix values used by a JSP to reference this
31  * tag library.
32  */

33 public class TaglibXml {
34     private String tlibVersion;
35     private String jspVersion;
36     private String shortName;
37     private String uri;
38     private String info;
39     private ValidatorXml validator;
40     private final List<TagXml> tags = new ArrayList<>();
41     private final List<TagFileXml> tagFiles = new ArrayList<>();
42     private final List<String> listeners = new ArrayList<>();
43     private final List<FunctionInfo> functions = new ArrayList<>();
44
45     public String getTlibVersion() {
46         return tlibVersion;
47     }
48
49     public void setTlibVersion(String tlibVersion) {
50         this.tlibVersion = tlibVersion;
51     }
52
53     public String getJspVersion() {
54         return jspVersion;
55     }
56
57     public void setJspVersion(String jspVersion) {
58         this.jspVersion = jspVersion;
59     }
60
61     public String getShortName() {
62         return shortName;
63     }
64
65     public void setShortName(String shortName) {
66         this.shortName = shortName;
67     }
68
69     public String getUri() {
70         return uri;
71     }
72
73     public void setUri(String uri) {
74         this.uri = uri;
75     }
76
77     public String getInfo() {
78         return info;
79     }
80
81     public void setInfo(String info) {
82         this.info = info;
83     }
84
85     public ValidatorXml getValidator() {
86         return validator;
87     }
88
89     public void setValidator(ValidatorXml validator) {
90         this.validator = validator;
91     }
92
93     public void addTag(TagXml tag) {
94         tags.add(tag);
95     }
96
97     public List<TagXml> getTags() {
98         return tags;
99     }
100
101     public void addTagFile(TagFileXml tag) {
102         tagFiles.add(tag);
103     }
104
105     public List<TagFileXml> getTagFiles() {
106         return tagFiles;
107     }
108
109     public void addListener(String listener) {
110         listeners.add(listener);
111     }
112
113     public List<String> getListeners() {
114         return listeners;
115     }
116
117     public void addFunction(String name, String klass, String signature) {
118         functions.add(new FunctionInfo(name, klass, signature));
119     }
120
121     public List<FunctionInfo> getFunctions() {
122         return functions;
123     }
124 }
125