Source Code Cross Referenced for TldTag.java in  » EJB-Server-resin-3.1.5 » resin » com » caucho » jsp » cfg » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server resin 3.1.5 » resin » com.caucho.jsp.cfg 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 1998-2008 Caucho Technology -- all rights reserved
003:         *
004:         * This file is part of Resin(R) Open Source
005:         *
006:         * Each copy or derived work must preserve the copyright notice and this
007:         * notice unmodified.
008:         *
009:         * Resin Open Source is free software; you can redistribute it and/or modify
010:         * it under the terms of the GNU General Public License as published by
011:         * the Free Software Foundation; either version 2 of the License, or
012:         * (at your option) any later version.
013:         *
014:         * Resin Open Source is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, or any warranty
017:         * of NON-INFRINGEMENT.  See the GNU General Public License for more
018:         * details.
019:         *
020:         * You should have received a copy of the GNU General Public License
021:         * along with Resin Open Source; if not, write to the
022:         *   Free SoftwareFoundation, Inc.
023:         *   59 Temple Place, Suite 330
024:         *   Boston, MA 02111-1307  USA
025:         *
026:         * @author Scott Ferguson
027:         */
028:
029:        package com.caucho.jsp.cfg;
030:
031:        import com.caucho.config.Config;
032:        import com.caucho.config.ConfigException;
033:        import com.caucho.config.DependencyBean;
034:        import com.caucho.jsp.JspLineParseException;
035:        import com.caucho.jsp.JspParseException;
036:        import com.caucho.util.L10N;
037:        import com.caucho.vfs.PersistentDependency;
038:
039:        import javax.servlet.jsp.tagext.SimpleTag;
040:        import javax.servlet.jsp.tagext.Tag;
041:        import javax.servlet.jsp.tagext.TagAttributeInfo;
042:        import javax.servlet.jsp.tagext.TagExtraInfo;
043:        import javax.servlet.jsp.tagext.TagVariableInfo;
044:        import javax.servlet.jsp.tagext.VariableInfo;
045:        import java.util.ArrayList;
046:        import java.util.logging.Logger;
047:
048:        /**
049:         * Configuration for the taglib tag in the .tld
050:         */
051:        public class TldTag implements  DependencyBean {
052:            private final static L10N L = new L10N(TldTag.class);
053:            private final static Logger log = Logger.getLogger(TldTag.class
054:                    .getName());
055:
056:            private String _name;
057:            private String _tagClassName;
058:            private String _teiClassName;
059:            private String _bodyContent;
060:            private String _displayName;
061:            private String _info;
062:            private String _smallIcon;
063:            private String _largeIcon;
064:            private String _description;
065:            private ArrayList<TagVariableInfo> _variableList = new ArrayList<TagVariableInfo>();
066:            private ArrayList<TagAttributeInfo> _attributeList = new ArrayList<TagAttributeInfo>();
067:            private ArrayList<TldFragmentAttribute> _fragmentAttributeList = new ArrayList<TldFragmentAttribute>();
068:            private boolean _dynamicAttributes;
069:            private String _dynamicAttributeName;
070:            private String _example;
071:
072:            private String _configLocation;
073:            private JspParseException _configException;
074:
075:            private ArrayList<PersistentDependency> _dependencyList = new ArrayList<PersistentDependency>();
076:
077:            private TldTag _baseTag;
078:
079:            /**
080:             * Sets the config location.
081:             */
082:            public void setConfigLocation(String filename, int line) {
083:                _configLocation = filename + ":" + line + ": ";
084:            }
085:
086:            /**
087:             * Adds a dependency.
088:             */
089:            public void addDependency(PersistentDependency dependency) {
090:                _dependencyList.add(dependency);
091:            }
092:
093:            /**
094:             * Returns the dependency.
095:             */
096:            public ArrayList<PersistentDependency> getDependencyList() {
097:                return _dependencyList;
098:            }
099:
100:            /**
101:             * Sets the tag name, i.e. the local name.
102:             */
103:            public void setName(String name) {
104:                _name = name;
105:            }
106:
107:            /**
108:             * Gets the tag name, i.e. the local name.
109:             */
110:            public String getName() {
111:                return _name;
112:            }
113:
114:            /**
115:             * Sets the icon.
116:             */
117:            public void setIcon(com.caucho.config.types.Icon icon) {
118:                if (icon != null) {
119:                    _smallIcon = icon.getSmallIcon();
120:                    _largeIcon = icon.getLargeIcon();
121:                }
122:            }
123:
124:            /**
125:             * Sets the tag class
126:             */
127:            public void setTagClass(String tagClassName) throws ConfigException {
128:                _tagClassName = tagClassName;
129:
130:                Class tagClass = null;
131:
132:                try {
133:                    ClassLoader loader = Thread.currentThread()
134:                            .getContextClassLoader();
135:
136:                    tagClass = Class.forName(tagClassName, false, loader);
137:
138:                    Config.checkCanInstantiate(tagClass);
139:                } catch (ConfigException e) {
140:                    throw e;
141:                } catch (Throwable e) {
142:                    log.warning(_configLocation + e);
143:
144:                    if (_configException == null)
145:                        _configException = new JspLineParseException(
146:                                _configLocation + e);
147:
148:                    return;
149:                }
150:
151:                if (!Tag.class.isAssignableFrom(tagClass)
152:                        && !SimpleTag.class.isAssignableFrom(tagClass))
153:                    throw new ConfigException(L.l(
154:                            "{0} must either implement Tag or SimpleTag.",
155:                            tagClass.getName()));
156:            }
157:
158:            /**
159:             * Sets the tei class
160:             */
161:            public void setTagclass(String tagClassName)
162:                    throws ConfigException, InstantiationException,
163:                    IllegalAccessException {
164:                setTagClass(tagClassName);
165:            }
166:
167:            /**
168:             * Gets the tag class
169:             */
170:            public Class getTagClass() {
171:                try {
172:                    ClassLoader loader = Thread.currentThread()
173:                            .getContextClassLoader();
174:
175:                    return Class.forName(_tagClassName, false, loader);
176:                } catch (ClassNotFoundException e) {
177:                    throw new RuntimeException(e);
178:                }
179:            }
180:
181:            /**
182:             * Gets the tag class
183:             */
184:            public String getTagClassName() {
185:                return _tagClassName;
186:            }
187:
188:            /**
189:             * Sets the tei class
190:             */
191:            public void setTeiClass(String teiClassName) throws ConfigException {
192:                _teiClassName = teiClassName;
193:
194:                try {
195:                    ClassLoader loader = Thread.currentThread()
196:                            .getContextClassLoader();
197:
198:                    Class teiClass = Class.forName(teiClassName, false, loader);
199:
200:                    Config.validate(teiClass, TagExtraInfo.class);
201:                } catch (ConfigException e) {
202:                    throw e;
203:                } catch (Throwable e) {
204:                    log.warning(_configLocation + e);
205:
206:                    if (_configException == null)
207:                        _configException = new JspParseException(
208:                                _configLocation + e);
209:
210:                    return;
211:                }
212:            }
213:
214:            /**
215:             * Old-style setting of the tei class
216:             */
217:            public void setTeiclass(String teiClassName) throws ConfigException {
218:                setTeiClass(teiClassName);
219:            }
220:
221:            /**
222:             * Gets the tei class
223:             */
224:            public String getTeiClassName() {
225:                return _teiClassName;
226:            }
227:
228:            /**
229:             * Gets the tei object
230:             */
231:            public TagExtraInfo getTagExtraInfo() {
232:                try {
233:                    if (_teiClassName == null)
234:                        return null;
235:                    else {
236:                        ClassLoader loader = Thread.currentThread()
237:                                .getContextClassLoader();
238:
239:                        Class teiClass = Class.forName(_teiClassName, false,
240:                                loader);
241:
242:                        return (TagExtraInfo) teiClass.newInstance();
243:                    }
244:                } catch (Exception e) {
245:                    throw new RuntimeException(e);
246:                }
247:            }
248:
249:            /**
250:             * Sets the body-content
251:             */
252:            public void setBodyContent(String bodyContent) {
253:                _bodyContent = bodyContent;
254:            }
255:
256:            /**
257:             * Sets the bodycontent (backwards compat)
258:             */
259:            public void setBodycontent(String bodyContent) {
260:                setBodyContent(bodyContent);
261:            }
262:
263:            /**
264:             * Gets the body-content
265:             */
266:            public String getBodyContent() {
267:                return _bodyContent;
268:            }
269:
270:            /**
271:             * Sets the display-name
272:             */
273:            public void setDisplayName(String displayName) {
274:                _displayName = displayName;
275:            }
276:
277:            /**
278:             * Gets the display-name
279:             */
280:            public String getDisplayName() {
281:                return _displayName;
282:            }
283:
284:            /**
285:             * Sets the info
286:             */
287:            public void setInfo(String info) {
288:                _info = info;
289:            }
290:
291:            /**
292:             * Gets the info
293:             */
294:            public String getInfo() {
295:                return _info;
296:            }
297:
298:            /**
299:             * Sets the small-icon
300:             */
301:            public void setSmallIcon(String smallIcon) {
302:                _smallIcon = smallIcon;
303:            }
304:
305:            /**
306:             * Gets the small-icon
307:             */
308:            public String getSmallIcon() {
309:                return _smallIcon;
310:            }
311:
312:            /**
313:             * Sets the large-icon
314:             */
315:            public void setLargeIcon(String largeIcon) {
316:                _largeIcon = largeIcon;
317:            }
318:
319:            /**
320:             * Gets the large-icon
321:             */
322:            public String getLargeIcon() {
323:                return _largeIcon;
324:            }
325:
326:            /**
327:             * Sets the description
328:             */
329:            public void setDescription(String description) {
330:                _description = description;
331:            }
332:
333:            /**
334:             * Gets the description
335:             */
336:            public String getDescription() {
337:                return _description;
338:            }
339:
340:            /**
341:             * Adds a variable.
342:             */
343:            public void addVariable(TldVariable variable)
344:                    throws ConfigException {
345:                TagVariableInfo varInfo;
346:
347:                String scopeName = variable.getScope();
348:                int scope;
349:
350:                if (scopeName == null)
351:                    scope = VariableInfo.NESTED;
352:                else if (scopeName.equals("NESTED"))
353:                    scope = VariableInfo.NESTED;
354:                else if (scopeName.equals("AT_BEGIN"))
355:                    scope = VariableInfo.AT_BEGIN;
356:                else if (scopeName.equals("AT_END"))
357:                    scope = VariableInfo.AT_END;
358:                else
359:                    throw new ConfigException(L.l(
360:                            "{0} expects a valid scope at `{1}'", variable
361:                                    .getNameGiven(), scopeName));
362:
363:                varInfo = new TagVariableInfo(variable.getNameGiven(), variable
364:                        .getNameFromAttribute(), variable.getVariableClass(),
365:                        variable.getDeclare(), scope);
366:
367:                _variableList.add(varInfo);
368:            }
369:
370:            /**
371:             * Gets the variables
372:             */
373:            public ArrayList<TagVariableInfo> getVariableList() {
374:                return _variableList;
375:            }
376:
377:            /**
378:             * Returns the variables.
379:             */
380:            public TagVariableInfo[] getVariables() {
381:                TagVariableInfo[] variables;
382:
383:                variables = new TagVariableInfo[_variableList.size()];
384:
385:                return _variableList.toArray(variables);
386:            }
387:
388:            /**
389:             * Adds an attribute.
390:             */
391:            public void addAttribute(TldAttribute attribute) {
392:                TagAttributeInfo attrInfo;
393:
394:                Class type = attribute.getType();
395:                attrInfo = new TagAttributeInfo(attribute.getName(), attribute
396:                        .getRequired(), type == null ? null : type.getName(),
397:                        attribute.getRtexprvalue(), attribute.isFragment(),
398:                        attribute.getDescription(), attribute
399:                                .getDeferredValue() != null, attribute
400:                                .getDeferredMethod() != null, attribute
401:                                .getExpectedType(), attribute
402:                                .getDeferredMethodSignature());
403:
404:                _attributeList.add(attrInfo);
405:            }
406:
407:            /**
408:             * Gets the attributes
409:             */
410:            public ArrayList getAttributeList() {
411:                return _attributeList;
412:            }
413:
414:            /**
415:             * Returns the attributes.
416:             */
417:            public TagAttributeInfo[] getAttributes() {
418:                TagAttributeInfo[] attributes;
419:
420:                attributes = new TagAttributeInfo[_attributeList.size()];
421:
422:                return (TagAttributeInfo[]) _attributeList.toArray(attributes);
423:            }
424:
425:            /**
426:             * Adds an fragmentAttribute.
427:             */
428:            public void addFragmentAttribute(TldFragmentAttribute attribute) {
429:                _fragmentAttributeList.add(attribute);
430:            }
431:
432:            /**
433:             * Returns the attributes.
434:             */
435:            public ArrayList getFragmentAttributes() {
436:                return _fragmentAttributeList;
437:            }
438:
439:            /**
440:             * Sets the example
441:             */
442:            public void setExample(String example) {
443:                _example = example;
444:            }
445:
446:            /**
447:             * Gets the dynamic-attributes
448:             */
449:            public boolean getDynamicAttributes() {
450:                return _dynamicAttributes;
451:            }
452:
453:            /**
454:             * Sets the dynamic-attributes
455:             */
456:            public void setDynamicAttributes(boolean dynamicAttributes) {
457:                _dynamicAttributes = dynamicAttributes;
458:            }
459:
460:            /**
461:             * Gets the dynamic-attrisavesavebutes
462:             */
463:            public String getDynamicAttributeName() {
464:                return _dynamicAttributeName;
465:            }
466:
467:            /**
468:             * Sets the dynamic-attributes
469:             */
470:            public void setDynamicAttributeName(String name) {
471:                _dynamicAttributeName = name;
472:            }
473:
474:            /**
475:             * Gets the example
476:             */
477:            public String getExample() {
478:                return _example;
479:            }
480:
481:            /**
482:             * validates.
483:             */
484:            public void validate() throws JspParseException {
485:                if (_configException != null)
486:                    throw _configException;
487:            }
488:
489:            public int hashCode() {
490:                return _name.hashCode();
491:            }
492:
493:            public boolean equals(Object o) {
494:                if (this  == o)
495:                    return true;
496:                else if (!(o instanceof  TldTag))
497:                    return false;
498:
499:                TldTag tag = (TldTag) o;
500:
501:                return _name.equals(tag._name);
502:            }
503:
504:            public void setBaseTag(TldTag tag) {
505:                if (tag == this )
506:                    throw new IllegalStateException();
507:
508:                _baseTag = tag;
509:            }
510:
511:            public TldTag getBaseTag() {
512:                return _baseTag;
513:            }
514:
515:            public String toString() {
516:                return getClass().getName() + "[" + getName() + "]";
517:            }
518:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.