Source Code Cross Referenced for SchemaCompiler.java in  » 6.0-JDK-Modules » jaxb-xjc » com » sun » tools » xjc » api » 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 » com.sun.tools.xjc.api 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         * 
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         * 
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common Development
008:         * and Distribution License("CDDL") (collectively, the "License").  You
009:         * may not use this file except in compliance with the License. You can obtain
010:         * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
011:         * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
012:         * language governing permissions and limitations under the License.
013:         * 
014:         * When distributing the software, include this License Header Notice in each
015:         * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
016:         * Sun designates this particular file as subject to the "Classpath" exception
017:         * as provided by Sun in the GPL Version 2 section of the License file that
018:         * accompanied this code.  If applicable, add the following below the License
019:         * Header, with the fields enclosed by brackets [] replaced by your own
020:         * identifying information: "Portions Copyrighted [year]
021:         * [name of copyright owner]"
022:         * 
023:         * Contributor(s):
024:         * 
025:         * If you wish your version of this file to be governed by only the CDDL or
026:         * only the GPL Version 2, indicate your decision by adding "[Contributor]
027:         * elects to include this software in this distribution under the [CDDL or GPL
028:         * Version 2] license."  If you don't indicate a single choice of license, a
029:         * recipient has the option to distribute your version of this file under
030:         * either the CDDL, the GPL Version 2 or to extend the choice of license to
031:         * its licensees as provided above.  However, if you add GPL Version 2 code
032:         * and therefore, elected the GPL Version 2 license, then the option applies
033:         * only if the new code is made subject to such option by the copyright
034:         * holder.
035:         */
036:        package com.sun.tools.xjc.api;
037:
038:        import javax.xml.stream.XMLStreamException;
039:        import javax.xml.stream.XMLStreamReader;
040:
041:        import com.sun.istack.NotNull;
042:        import com.sun.tools.xjc.Options;
043:
044:        import org.w3c.dom.Element;
045:        import org.xml.sax.ContentHandler;
046:        import org.xml.sax.EntityResolver;
047:        import org.xml.sax.InputSource;
048:
049:        /**
050:         * Schema-to-Java compiler.
051:         * 
052:         * <p>
053:         * The caller can parse multiple schema documents,
054:         * JAXB external binding files (or potentially WSDL
055:         * and JSR-109.next mapping files in the future).
056:         * 
057:         * <p>
058:         * All the errors found during this process will be sent
059:         * to the registered {@link ErrorListener}.
060:         * 
061:         * <p>
062:         * Once all the documents are parsed, call the {@link #bind()}
063:         * method to get the compiled {@link JAXBModel} object.
064:         * 
065:         * 
066:         * <h2>Tips: namespace URI -> package customization</h2>
067:         * <p>
068:         * The caller can feed the following synthesized schema
069:         * to achive the namespace URI -> Java package customization:
070:         * <pre><xmp>
071:         * <schema targetNamespace="xml.namespace.uri"
072:         *   xmlns="http://www.w3.org/2001/XMLSchema"
073:         *   xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
074:         *   jaxb:version="1.0">
075:         *   <annotation><appinfo>
076:         *     <jaxb:schemaBindings>
077:         *       <jaxb:package name="java.package.name"/>
078:         *     </jaxb:schemaBindings>
079:         *   </appinfo></annotation>
080:         * </schema>
081:         * </xmp></pre>
082:         * Feed this synthesized schema document for each namespace URI
083:         * you need to map.
084:         * 
085:         * @author
086:         *     Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
087:         */
088:        public interface SchemaCompiler {
089:            /**
090:             * Parses schemas or external bindings
091:             * through SAX events by feeding events into
092:             * SAX {@link ContentHandler}.
093:             * 
094:             * @param systemId
095:             *      The system ID of the document to be read in.
096:             * 
097:             * @see #parseSchema(String, XMLStreamReader)
098:             */
099:            ContentHandler getParserHandler(String systemId);
100:
101:            /**
102:             * Parses a schema or an external binding file
103:             * from an external source.
104:             * 
105:             * @param source
106:             *      Its system Id must be set to an absolute URI.
107:             */
108:            void parseSchema(InputSource source);
109:
110:            /**
111:             * Specifies the target spec version for this compilaion.
112:             *
113:             * @param version
114:             *      If null, XJC will generate the source code that
115:             *      takes advantage of the latest JAXB spec that it understands.
116:             * @since 2.1 EA2
117:             */
118:            void setTargetVersion(SpecVersion version);
119:
120:            /**
121:             * Parses a schema or an external binding file
122:             * from the specified DOM element.
123:             * 
124:             * <p>
125:             * The given DOM element is treated as if it's the root of a
126:             * virtual document.
127:             * 
128:             * <p>
129:             * XJC will not be able to print location information for
130:             * errors found in this document, since DOM doesn't have them.
131:             * For this reason, use of this method is strongly discouraged.
132:             * 
133:             * @param systemId
134:             *      We need an absolute system ID that uniquely designates the virtual
135:             *      document. This should be different from the system ID of
136:             *      the document which contains this element.
137:             *      <p>
138:             *      One way to do that is by adding a fragment identifier
139:             *      to the system ID of the document. For example, if the document
140:             *      is "foo.wsdl" and you are passing in its types section, you
141:             *      can use an unique identifier like "foo.wsdl#types"
142:             */
143:            void parseSchema(String systemId, Element element);
144:
145:            /**
146:             * Parses a schema or an external binding file
147:             * from the given source.
148:             * 
149:             * <p>
150:             * A stream reader must be pointing at the element or
151:             * at the start of the document.
152:             * XML is parsed until the corresponding end tag, then the
153:             * sub tree is processed as a schema document.
154:             * 
155:             * <p>
156:             * When this method returns successfully, the parser is at
157:             * the next token of the end element.
158:             * 
159:             * @param systemId
160:             *      The absolute system ID of the document that is being parsed.
161:             *      This information is necessary to avoid double-inclusion
162:             *      and etc.
163:             * 
164:             *      Note that {@link XMLStreamReader#getLocation()} only
165:             *      returns the system ID of the entity it is parsing, not
166:             *      necessarily the system ID of the document itself.
167:             * 
168:             * @throws XMLStreamException
169:             *      If an error happens while parsing a document.
170:             *      Note that not only the parser but also the XJC itself
171:             *      may throw this error (as a result of the additional validation
172:             *      for example.)
173:             */
174:            void parseSchema(String systemId, XMLStreamReader reader)
175:                    throws XMLStreamException;
176:
177:            void setErrorListener(ErrorListener errorListener);
178:
179:            void setEntityResolver(EntityResolver entityResolver);
180:
181:            /**
182:             * Sets the default Java package name into which the generated code will be placed.
183:             *
184:             * <p>
185:             * Customizations in the binding files/schemas will have precedence over this setting.
186:             * Set to null to use the default package name computation algorithm as specified by
187:             * the JAXB spec (which is the default behavior.)
188:             *
189:             * <p>
190:             * Initially this parameter is set to null.
191:             *
192:             * @param packageName
193:             *      Java pckage name such as "org.foo.bar". Use "" to represent the root package,
194:             *      and null to defer to the default computation algorithm.
195:             *
196:             * @see #forcePackageName(String)
197:             */
198:            void setDefaultPackageName(String packageName);
199:
200:            /**
201:             * Forces all the JAXB-generated classes to go into the specific package.
202:             *
203:             * <p>
204:             * This setting takes precedence over the {@link #setDefaultPackageName(String)}
205:             * or any of the customization found in the JAXB binding files. This method
206:             * is designed to implement the semantics of the command-line '-p' option.
207:             *
208:             * <p>
209:             * This somewhat ugly semantics actually have a long history now and too late
210:             * to change.
211:             *
212:             * @see #setDefaultPackageName(String)
213:             */
214:            void forcePackageName(String packageName);
215:
216:            /**
217:             * Sets the {@link ClassNameAllocator} to be used for the binding operation.
218:             *
219:             * <p>
220:             * This mechanism would allow the caller to participate in the binding operation.
221:             *
222:             * @see ClassNameAllocator
223:             */
224:            void setClassNameAllocator(ClassNameAllocator allocator);
225:
226:            /**
227:             * Clears all the schema files parsed so far.
228:             *
229:             * @since 2.1.1
230:             */
231:            void resetSchema();
232:
233:            /**
234:             * Obtains the compiled schema object model.
235:             * 
236:             * Once this method is called, no other method should be
237:             * invoked on the {@link SchemaCompiler}.
238:             * 
239:             * @return
240:             *      null if the compilation fails. The errors should have been
241:             *      delivered to the registered error handler in such a case.
242:             */
243:            S2JJAXBModel bind();
244:
245:            /**
246:             * Allows the calling code to tweak more schema compilation details.
247:             *
248:             * <p>
249:             * The caller can use this method to obtain an {@link Options} instance,
250:             * then tweak settings on it. The updated settings will be used when the
251:             * {@link #bind()} method is invoked.
252:             *
253:             * @since 2.0.2
254:             * @deprecated
255:             *      This method is not really "deprecated" (in the sense of being removed
256:             *      from future versions), but the JAXB team is not committed to evolve
257:             *      {@link Options} class in the compatible fashion. So please don't
258:             *      use this method unless you know what you're doing.
259:             */
260:            @NotNull
261:            Options getOptions();
262:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.