KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > caucho > jsp > cfg > TldTaglib


1 /*
2  * Copyright (c) 1998-2006 Caucho Technology -- all rights reserved
3  *
4  * This file is part of Resin(R) Open Source
5  *
6  * Each copy or derived work must preserve the copyright notice and this
7  * notice unmodified.
8  *
9  * Resin Open Source is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * Resin Open Source is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
17  * of NON-INFRINGEMENT. See the GNU General Public License for more
18  * details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with Resin Open Source; if not, write to the
22  *
23  * Free Software Foundation, Inc.
24  * 59 Temple Place, Suite 330
25  * Boston, MA 02111-1307 USA
26  *
27  * @author Scott Ferguson
28  */

29
30 package com.caucho.jsp.cfg;
31
32 import com.caucho.config.DependencyBean;
33 import com.caucho.server.webapp.Application;
34 import com.caucho.vfs.Path;
35 import com.caucho.vfs.PersistentDependency;
36
37 import java.util.ArrayList JavaDoc;
38
39 /**
40  * Configuration for the taglib in the .tld
41  */

42 public class TldTaglib implements DependencyBean {
43   private String JavaDoc _tlibVersion;
44   private String JavaDoc _jspVersion;
45   private String JavaDoc _shortName;
46   private String JavaDoc _uri;
47   private String JavaDoc _displayName;
48   private String JavaDoc _smallIcon;
49   private String JavaDoc _largeIcon;
50   private String JavaDoc _description;
51   private String JavaDoc _info;
52   private TldValidator _validator;
53   private ArrayList JavaDoc<TldListener> _listeners = new ArrayList JavaDoc<TldListener>();
54   private ArrayList JavaDoc<TldTag> _tags = new ArrayList JavaDoc<TldTag>();
55   private ArrayList JavaDoc<TldTagFile> _tagFiles = new ArrayList JavaDoc<TldTagFile>();
56   private ArrayList JavaDoc<TldFunction> _functionList = new ArrayList JavaDoc<TldFunction>();
57
58   private Path _jarPath;
59   private Throwable JavaDoc _configException;
60
61   private ArrayList JavaDoc<PersistentDependency> _dependList
62     = new ArrayList JavaDoc<PersistentDependency>();
63
64   private boolean _isInit;
65
66   /**
67    * Adds a dependency.
68    */

69   public void addDependency(PersistentDependency depend)
70   {
71     _dependList.add(depend);
72   }
73
74   /**
75    * Sets the tld version.
76    */

77   public void setVersion(String JavaDoc version)
78   {
79     _jspVersion = version;
80   }
81
82   /**
83    * Sets the schema location.
84    */

85   public void setSchemaLocation(String JavaDoc location)
86   {
87   }
88
89   /**
90    * Sets the icon.
91    */

92   public void setIcon(com.caucho.config.types.Icon icon)
93   {
94   }
95   
96   /**
97    * Sets the taglib version.
98    */

99   public void setTlibVersion(String JavaDoc tlibVersion)
100   {
101     _tlibVersion = tlibVersion;
102   }
103
104   /**
105    * Gets the taglib version.
106    */

107   public String JavaDoc getTlibVersion()
108   {
109     return _tlibVersion;
110   }
111
112   /**
113    * Sets the JSP version.
114    */

115   public void setJspVersion(String JavaDoc jspVersion)
116   {
117     _jspVersion = jspVersion;
118   }
119
120   /**
121    * Gets the jsp version.
122    */

123   public String JavaDoc getJspVersion()
124   {
125     return _jspVersion;
126   }
127
128   /**
129    * Sets the info string
130    */

131   public void setInfo(String JavaDoc info)
132   {
133     _info = info;
134   }
135
136   /**
137    * Gets the info string.
138    */

139   public String JavaDoc getInfo()
140   {
141     return _info;
142   }
143
144   /**
145    * Sets the short name (prefix)
146    */

147   public void setShortName(String JavaDoc shortName)
148   {
149     _shortName = shortName;
150   }
151
152   /**
153    * Gets the short name (prefix)
154    */

155   public String JavaDoc getShortName()
156   {
157     return _shortName;
158   }
159
160   /**
161    * Sets the uri
162    */

163   public void setURI(String JavaDoc uri)
164   {
165     _uri = uri;
166   }
167
168   /**
169    * Gets the uri
170    */

171   public String JavaDoc getURI()
172   {
173     return _uri;
174   }
175
176   /**
177    * Sets the display-name
178    */

179   public void setDisplayName(String JavaDoc displayName)
180   {
181     _displayName = displayName;
182   }
183
184   /**
185    * Gets the display-name
186    */

187   public String JavaDoc getDisplayName()
188   {
189     return _displayName;
190   }
191
192   /**
193    * Sets the small-icon
194    */

195   public void setSmallIcon(String JavaDoc smallIcon)
196   {
197     _smallIcon = smallIcon;
198   }
199
200   /**
201    * Gets the small-icon
202    */

203   public String JavaDoc getSmallIcon()
204   {
205     return _smallIcon;
206   }
207
208   /**
209    * Sets the large-icon
210    */

211   public void setLargeIcon(String JavaDoc largeIcon)
212   {
213     _largeIcon = largeIcon;
214   }
215
216   /**
217    * Gets the large-icon
218    */

219   public String JavaDoc getLargeIcon()
220   {
221     return _largeIcon;
222   }
223
224   /**
225    * Sets the description
226    */

227   public void setDescription(String JavaDoc description)
228   {
229     _description = description;
230   }
231
232   /**
233    * Gets the description
234    */

235   public String JavaDoc getDescription()
236   {
237     return _description;
238   }
239
240   /**
241    * Sets the validator
242    */

243   public void setValidator(TldValidator validator)
244   {
245     _validator = validator;
246   }
247
248   /**
249    * Gets the validator
250    */

251   public TldValidator getValidator()
252   {
253     return _validator;
254   }
255
256   /**
257    * Adds a listener
258    */

259   public void addListener(TldListener listener)
260   {
261     _listeners.add(listener);
262   }
263
264   /**
265    * Adds a tag
266    */

267   public void addTag(TldTag tag)
268   {
269     _tags.add(tag);
270   }
271
272   /**
273    * Returns the list of tags.
274    */

275   public ArrayList JavaDoc<TldTag> getTagList()
276   {
277     return _tags;
278   }
279
280   /**
281    * Adds a tag-file
282    */

283   public void addTagFile(TldTagFile tagFile)
284   {
285     _tagFiles.add(tagFile);
286   }
287
288   /**
289    * Returns the list of tag files.
290    */

291   public ArrayList JavaDoc<TldTagFile> getTagFileList()
292   {
293     return _tagFiles;
294   }
295
296   /**
297    * Adds a function
298    */

299   public void addFunction(TldFunction function)
300   {
301     _functionList.add(function);
302   }
303
304   /**
305    * Returns the list of functions.
306    */

307   public ArrayList JavaDoc<TldFunction> getFunctionList()
308   {
309     return _functionList;
310   }
311
312   /**
313    * Sets the jar path.
314    */

315   public void setJarPath(Path path)
316   {
317     _jarPath = path;
318   }
319
320   /**
321    * Gets the jar path.
322    */

323   public Path getJarPath()
324   {
325     return _jarPath;
326   }
327
328   /**
329    * Sets any configuration exception
330    */

331   public void setConfigException(Throwable JavaDoc e)
332   {
333     _configException = e;
334   }
335
336   /**
337    * Gets any configuration exception
338    */

339   public Throwable JavaDoc getConfigException()
340   {
341     return _configException;
342   }
343
344   /**
345    * Applies the listeners.
346    */

347   public void initListeners(Application app)
348     throws InstantiationException JavaDoc, IllegalAccessException JavaDoc
349   {
350     if (app == null)
351       return;
352     
353     for (int i = 0; i < _listeners.size(); i++) {
354       TldListener listener = _listeners.get(i);
355
356       listener.register(app);
357     }
358   }
359
360   /**
361    * Checks for modification.
362    */

363   public boolean isModified()
364   {
365     for (int i = 0; i < _dependList.size(); i++) {
366       if (_dependList.get(i).isModified())
367     return true;
368     }
369
370     return false;
371   }
372 }
373
Popular Tags