Source Code Cross Referenced for XMLBeanInfoDigester.java in  » Library » Apache-commons-betwixt-0.8-src » org » apache » commons » betwixt » digester » 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 » Library » Apache commons betwixt 0.8 src » org.apache.commons.betwixt.digester 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:         */
017:        package org.apache.commons.betwixt.digester;
018:
019:        import java.util.HashSet;
020:        import java.util.Set;
021:
022:        import javax.xml.parsers.SAXParser;
023:
024:        import org.apache.commons.betwixt.XMLIntrospector;
025:        import org.apache.commons.digester.Digester;
026:        import org.apache.commons.logging.Log;
027:        import org.apache.commons.logging.LogFactory;
028:        import org.xml.sax.XMLReader;
029:
030:        /** <p><code>XMLBeanInfoDigester</code> is a digester of XML files
031:         * containing XMLBeanInfo definitions for a JavaBean.</p>
032:         *
033:         * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
034:         * @version $Revision: 438373 $
035:         */
036:        public class XMLBeanInfoDigester extends Digester {
037:
038:            /** Logger */
039:            private static final Log log = LogFactory
040:                    .getLog(XMLBeanInfoDigester.class);
041:
042:            /** the beans class for this XML descriptor */
043:            private Class beanClass;
044:
045:            /** should attributes or elements be used for primitive types */
046:            private boolean attributesForPrimitives;
047:
048:            /** the set of property names processed so far */
049:            private Set processedPropertyNameSet = new HashSet();
050:
051:            /** the introspector that is using me */
052:            private XMLIntrospector introspector;
053:
054:            /**
055:             * Construct a new XMLBeanInfoDigester with default properties.
056:             */
057:            public XMLBeanInfoDigester() {
058:            }
059:
060:            /**
061:             * Construct a new XMLBeanInfoDigester, allowing a SAXParser to be passed in.  This
062:             * allows XMLBeanInfoDigester to be used in environments which are unfriendly to
063:             * JAXP1.1 (such as WebLogic 6.0).  Thanks for the request to change go to
064:             * James House (james@interobjective.com).  This may help in places where
065:             * you are able to load JAXP 1.1 classes yourself.
066:             *
067:             * @param parser the <code>SAXParser</code> to be used to parse the xml
068:             */
069:            public XMLBeanInfoDigester(SAXParser parser) {
070:                super (parser);
071:            }
072:
073:            /**
074:             * Construct a new XMLBeanInfoDigester, allowing an XMLReader to be passed in.  This
075:             * allows XMLBeanInfoDigester to be used in environments which are unfriendly to
076:             * JAXP1.1 (such as WebLogic 6.0).  Note that if you use this option you
077:             * have to configure namespace and validation support yourself, as these
078:             * properties only affect the SAXParser and emtpy constructor.
079:             *
080:             * @param reader the <code>XMLReader</code> to be used to parse the xml
081:             */
082:            public XMLBeanInfoDigester(XMLReader reader) {
083:                super (reader);
084:            }
085:
086:            /**
087:             * Gets the class of the bean whose .betwixt file is being processed 
088:             *
089:             * @return the beans class for this XML descriptor 
090:             */
091:            public Class getBeanClass() {
092:                return beanClass;
093:            }
094:
095:            /** 
096:             * Sets the beans class for this XML descriptor 
097:             *
098:             * @param beanClass the <code>Class</code> of the bean being processed
099:             */
100:            public void setBeanClass(Class beanClass) {
101:                this .beanClass = beanClass;
102:            }
103:
104:            /** 
105:             * Gets the property names already processed
106:             *
107:             * @return the set of property names that have been processed so far 
108:             */
109:            public Set getProcessedPropertyNameSet() {
110:                return processedPropertyNameSet;
111:            }
112:
113:            /** 
114:             * Should attributes (or elements) be used for primitive types?
115:             * @return true if primitive properties should be written as attributes in the xml
116:             */
117:            public boolean isAttributesForPrimitives() {
118:                return attributesForPrimitives;
119:            }
120:
121:            /** 
122:             * Set whether attributes (or elements) should be used for primitive types. 
123:             * @param attributesForPrimitives pass true if primitive properties should be 
124:             * written as attributes
125:             */
126:            public void setAttributesForPrimitives(
127:                    boolean attributesForPrimitives) {
128:                this .attributesForPrimitives = attributesForPrimitives;
129:                if (introspector != null) {
130:                    introspector.getConfiguration().setAttributesForPrimitives(
131:                            attributesForPrimitives);
132:                }
133:            }
134:
135:            /** 
136:             * Gets the XMLIntrospector that's using this digester.
137:             *
138:             * @return the introspector that is using me 
139:             */
140:            public XMLIntrospector getXMLIntrospector() {
141:                return introspector;
142:            }
143:
144:            /** 
145:             * Sets the introspector that is using me 
146:             * @param introspector the <code>XMLIntrospector</code> that using this for .betwixt 
147:             * digestion
148:             */
149:            public void setXMLIntrospector(XMLIntrospector introspector) {
150:                this .introspector = introspector;
151:            }
152:
153:            // Implementation methods
154:            //-------------------------------------------------------------------------        
155:            /** Reset configure for new digestion */
156:            protected void configure() {
157:                if (!configured) {
158:                    configured = true;
159:
160:                    // add the various rules
161:
162:                    addRule("info", new InfoRule());
163:                    addRuleSet(new CommonRuleSet());
164:
165:                }
166:
167:                // now initialize
168:                setAttributesForPrimitives(attributesForPrimitives);
169:                processedPropertyNameSet.clear();
170:            }
171:
172:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.