Source Code Cross Referenced for DSchemaBuilderImpl.java in  » 6.0-JDK-Modules » jaxb-xjc » org » kohsuke » rngom » digested » 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 » 6.0 JDK Modules » jaxb xjc » org.kohsuke.rngom.digested 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.kohsuke.rngom.digested;
002:
003:        import org.kohsuke.rngom.ast.builder.BuildException;
004:        import org.kohsuke.rngom.ast.builder.DataPatternBuilder;
005:        import org.kohsuke.rngom.ast.builder.ElementAnnotationBuilder;
006:        import org.kohsuke.rngom.ast.builder.Grammar;
007:        import org.kohsuke.rngom.ast.builder.NameClassBuilder;
008:        import org.kohsuke.rngom.ast.builder.SchemaBuilder;
009:        import org.kohsuke.rngom.ast.builder.Scope;
010:        import org.kohsuke.rngom.ast.om.ParsedPattern;
011:        import org.kohsuke.rngom.ast.util.LocatorImpl;
012:        import org.kohsuke.rngom.nc.NameClass;
013:        import org.kohsuke.rngom.nc.NameClassBuilderImpl;
014:        import org.kohsuke.rngom.parse.Context;
015:        import org.kohsuke.rngom.parse.IllegalSchemaException;
016:        import org.kohsuke.rngom.parse.Parseable;
017:        import org.w3c.dom.Document;
018:
019:        import javax.xml.parsers.DocumentBuilderFactory;
020:        import javax.xml.parsers.ParserConfigurationException;
021:        import java.util.List;
022:
023:        /**
024:         * Parses as {@link Parseable} into a {@link DPattern}.
025:         *
026:         * @author Kohsuke Kawaguchi (kk@kohsuke.org)
027:         */
028:        public class DSchemaBuilderImpl
029:                implements 
030:                SchemaBuilder<NameClass, DPattern, ElementWrapper, LocatorImpl, Annotation, CommentListImpl> {
031:
032:            private final NameClassBuilder ncb = new NameClassBuilderImpl();
033:
034:            /**
035:             * Used to parse annotations.
036:             */
037:            private final Document dom;
038:
039:            public DSchemaBuilderImpl() {
040:                try {
041:                    DocumentBuilderFactory dbf = DocumentBuilderFactory
042:                            .newInstance();
043:                    dbf.setNamespaceAware(true);
044:                    this .dom = dbf.newDocumentBuilder().newDocument();
045:                } catch (ParserConfigurationException e) {
046:                    // impossible
047:                    throw new InternalError(e.getMessage());
048:                }
049:            }
050:
051:            public NameClassBuilder getNameClassBuilder() throws BuildException {
052:                return ncb;
053:            }
054:
055:            static DPattern wrap(DPattern p, LocatorImpl loc, Annotation anno) {
056:                p.location = loc;
057:                if (anno != null)
058:                    p.annotation = anno.getResult();
059:                return p;
060:            }
061:
062:            static DContainerPattern addAll(DContainerPattern parent,
063:                    List<DPattern> children) {
064:                for (DPattern c : children)
065:                    parent.add(c);
066:                return parent;
067:            }
068:
069:            static DUnaryPattern addBody(DUnaryPattern parent,
070:                    ParsedPattern _body, LocatorImpl loc) {
071:                parent.setChild((DPattern) _body);
072:                return parent;
073:            }
074:
075:            public DPattern makeChoice(List<DPattern> patterns,
076:                    LocatorImpl loc, Annotation anno) throws BuildException {
077:                return wrap(addAll(new DChoicePattern(), patterns), loc, anno);
078:            }
079:
080:            public DPattern makeInterleave(List<DPattern> patterns,
081:                    LocatorImpl loc, Annotation anno) throws BuildException {
082:                return wrap(addAll(new DInterleavePattern(), patterns), loc,
083:                        anno);
084:            }
085:
086:            public DPattern makeGroup(List<DPattern> patterns, LocatorImpl loc,
087:                    Annotation anno) throws BuildException {
088:                return wrap(addAll(new DGroupPattern(), patterns), loc, anno);
089:            }
090:
091:            public DPattern makeOneOrMore(DPattern p, LocatorImpl loc,
092:                    Annotation anno) throws BuildException {
093:                return wrap(addBody(new DOneOrMorePattern(), p, loc), loc, anno);
094:            }
095:
096:            public DPattern makeZeroOrMore(DPattern p, LocatorImpl loc,
097:                    Annotation anno) throws BuildException {
098:                return wrap(addBody(new DZeroOrMorePattern(), p, loc), loc,
099:                        anno);
100:            }
101:
102:            public DPattern makeOptional(DPattern p, LocatorImpl loc,
103:                    Annotation anno) throws BuildException {
104:                return wrap(addBody(new DOptionalPattern(), p, loc), loc, anno);
105:            }
106:
107:            public DPattern makeList(DPattern p, LocatorImpl loc,
108:                    Annotation anno) throws BuildException {
109:                return wrap(addBody(new DListPattern(), p, loc), loc, anno);
110:            }
111:
112:            public DPattern makeMixed(DPattern p, LocatorImpl loc,
113:                    Annotation anno) throws BuildException {
114:                return wrap(addBody(new DMixedPattern(), p, loc), loc, anno);
115:            }
116:
117:            public DPattern makeEmpty(LocatorImpl loc, Annotation anno) {
118:                return wrap(new DEmptyPattern(), loc, anno);
119:            }
120:
121:            public DPattern makeNotAllowed(LocatorImpl loc, Annotation anno) {
122:                return wrap(new DNotAllowedPattern(), loc, anno);
123:            }
124:
125:            public DPattern makeText(LocatorImpl loc, Annotation anno) {
126:                return wrap(new DTextPattern(), loc, anno);
127:            }
128:
129:            public DPattern makeAttribute(NameClass nc, DPattern p,
130:                    LocatorImpl loc, Annotation anno) throws BuildException {
131:                return wrap(addBody(new DAttributePattern(nc), p, loc), loc,
132:                        anno);
133:            }
134:
135:            public DPattern makeElement(NameClass nc, DPattern p,
136:                    LocatorImpl loc, Annotation anno) throws BuildException {
137:                return wrap(addBody(new DElementPattern(nc), p, loc), loc, anno);
138:            }
139:
140:            public DataPatternBuilder makeDataPatternBuilder(
141:                    String datatypeLibrary, String type, LocatorImpl loc)
142:                    throws BuildException {
143:                return new DataPatternBuilderImpl(datatypeLibrary, type, loc);
144:            }
145:
146:            public DPattern makeValue(String datatypeLibrary, String type,
147:                    String value, Context c, String ns, LocatorImpl loc,
148:                    Annotation anno) throws BuildException {
149:                return wrap(new DValuePattern(datatypeLibrary, type, value, c
150:                        .copy(), ns), loc, anno);
151:            }
152:
153:            public Grammar makeGrammar(Scope parent) {
154:                return new GrammarBuilderImpl(new DGrammarPattern(), parent,
155:                        this );
156:            }
157:
158:            public DPattern annotate(DPattern p, Annotation anno)
159:                    throws BuildException {
160:                // TODO: not sure when this is used
161:                return p;
162:            }
163:
164:            public DPattern annotateAfter(DPattern p, ElementWrapper e)
165:                    throws BuildException {
166:                // TODO
167:                return p;
168:            }
169:
170:            public DPattern commentAfter(DPattern p, CommentListImpl comments)
171:                    throws BuildException {
172:                // TODO
173:                return p;
174:            }
175:
176:            public DPattern makeExternalRef(
177:                    Parseable current,
178:                    String uri,
179:                    String ns,
180:                    Scope<DPattern, ElementWrapper, LocatorImpl, Annotation, CommentListImpl> scope,
181:                    LocatorImpl loc, Annotation anno) throws BuildException,
182:                    IllegalSchemaException {
183:                // TODO
184:                return null;
185:            }
186:
187:            public LocatorImpl makeLocation(String systemId, int lineNumber,
188:                    int columnNumber) {
189:                return new LocatorImpl(systemId, lineNumber, columnNumber);
190:            }
191:
192:            public Annotation makeAnnotations(CommentListImpl comments,
193:                    Context context) {
194:                return new Annotation();
195:            }
196:
197:            public ElementAnnotationBuilder makeElementAnnotationBuilder(
198:                    String ns, String localName, String prefix,
199:                    LocatorImpl loc, CommentListImpl comments, Context context) {
200:                String qname;
201:                if (prefix == null)
202:                    qname = localName;
203:                else
204:                    qname = prefix + ':' + localName;
205:                return new ElementAnnotationBuilderImpl(dom.createElementNS(ns,
206:                        qname));
207:            }
208:
209:            public CommentListImpl makeCommentList() {
210:                return null;
211:            }
212:
213:            public DPattern makeErrorPattern() {
214:                return new DNotAllowedPattern();
215:            }
216:
217:            public boolean usesComments() {
218:                return false;
219:            }
220:
221:            public DPattern expandPattern(DPattern p) throws BuildException,
222:                    IllegalSchemaException {
223:                return p;
224:            }
225:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.