Source Code Cross Referenced for Loader.java in  » ESB » open-esb » com » sun » jbi » internal » security » util » 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 » ESB » open esb » com.sun.jbi.internal.security.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * BEGIN_HEADER - DO NOT EDIT
003:         *
004:         * The contents of this file are subject to the terms
005:         * of the Common Development and Distribution License
006:         * (the "License").  You may not use this file except
007:         * in compliance with the License.
008:         *
009:         * You can obtain a copy of the license at
010:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011:         * See the License for the specific language governing
012:         * permissions and limitations under the License.
013:         *
014:         * When distributing Covered Code, include this CDDL
015:         * HEADER in each file and include the License file at
016:         * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017:         * If applicable add the following below this CDDL HEADER,
018:         * with the fields enclosed by brackets "[]" replaced with
019:         * your own identifying information: Portions Copyright
020:         * [year] [name of copyright owner]
021:         */
022:
023:        /*
024:         * @(#)Loader.java
025:         * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026:         *
027:         * END_HEADER - DO NOT EDIT
028:         */
029:        /**
030:         * Loader.java
031:         *
032:         * SUN PROPRIETARY/CONFIDENTIAL.
033:         * This software is the proprietary information of Sun Microsystems, Inc.
034:         * Use is subject to license terms.
035:         *
036:         */package com.sun.jbi.internal.security.util;
037:
038:        import java.io.File;
039:        import java.io.FileInputStream;
040:        import java.io.InputStream;
041:        import java.io.Reader;
042:
043:        import javax.xml.parsers.DocumentBuilder;
044:        import javax.xml.parsers.DocumentBuilderFactory;
045:        import javax.xml.parsers.ParserConfigurationException;
046:
047:        import org.w3c.dom.Document;
048:        import org.xml.sax.SAXException;
049:        import org.xml.sax.InputSource;
050:
051:        /**
052:         * This class is a helper class which aids in converting
053:         * a DOM Document to a File and vice-versa.
054:         *
055:         * @author Sun Microsystems, Inc.
056:         */
057:        public class Loader {
058:
059:            /** Schema Language. */
060:            private static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
061:
062:            /** W3C Schema. */
063:            private static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
064:
065:            /** Schema Source. */
066:            private static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
067:
068:            /**
069:             * Given a filename load an XML document into
070:             * a Document object and return it.
071:             * 
072:             * @param filename is the String filename of the XML file
073:             * references, if this paramter is null the XML parsers default resolution is used.
074:             * @param validate indicates that the document is to be validated.
075:             * @param schemaFiles are the schema files to be used if validation is to be done, 
076:             * this parameter can be null if validate = false.
077:             * @param handler is the ErrorHandler
078:             * @throws java.io.FileNotFoundException if the file with name filename is not found.
079:             * @throws java.io.IOException on IO errors
080:             * @throws SAXException on XML parsing errors.
081:             * @throws ParserConfigurationException if the XML Parser is not configured correctly.
082:             * @return the XML Document object 
083:             */
084:            public Document load(String filename, boolean validate,
085:                    org.xml.sax.ErrorHandler handler, String[] schemaFiles)
086:                    throws java.io.IOException, java.io.FileNotFoundException,
087:                    SAXException, ParserConfigurationException {
088:
089:                return load(new FileInputStream(new File(filename)), validate,
090:                        handler, schemaFiles);
091:
092:            };
093:
094:            /**
095:             * Given a Inputstream load an XML document into
096:             * a Document object and return it.
097:             * 
098:             * @param istr is a stream to the input XML file.
099:             * @param validate if true indicates that the document is to be validated
100:             * against it's schema.
101:             * @param handler is the ErrorHandler which is to be delegated XML parsing Error
102:             * handling tasks.
103:             * @param schemaFiles are the schema files to be used if validation is to be done, 
104:             * this parameter can be null if validate = false.
105:             * @return the XML Document object 
106:             * @throws SAXException on XML Parsing errors.
107:             * @throws ParserConfigurationException if the parser is not configured correctly. 
108:             * @throws java.io.IOException on IO Errors.
109:             */
110:            public Document load(InputStream istr, boolean validate,
111:                    org.xml.sax.ErrorHandler handler, String[] schemaFiles)
112:                    throws java.io.IOException, SAXException,
113:                    ParserConfigurationException {
114:
115:                return load(new InputSource(istr), validate, handler,
116:                        schemaFiles);
117:            };
118:
119:            /**
120:             * Given a Inputstream load an XML document into
121:             * a Document object and return it.
122:             * 
123:             * @param reader is a reader to the input XML file
124:             * @param validate if true indicates that the document is to be validated
125:             * against it's schema.
126:             * @param handler is the ErrorHandler which is to be delegated XML parsing Error
127:             * handling tasks.
128:             * @param schemaFiles are the schema file to be used if validation is to be done, 
129:             * this parameter can be null if validate = false.
130:             * @return the XML Document object 
131:             * @throws SAXException on XML Parsing errors.
132:             * @throws ParserConfigurationException if the parser is not configured correctly. 
133:             * @throws java.io.IOException on IO Errors.
134:             */
135:            public Document load(Reader reader, boolean validate,
136:                    org.xml.sax.ErrorHandler handler, String[] schemaFiles)
137:                    throws java.io.IOException, SAXException,
138:                    ParserConfigurationException {
139:
140:                return load(new InputSource(reader), validate, handler,
141:                        schemaFiles);
142:            };
143:
144:            /**
145:             * Given a Inputstream load an XML document into
146:             * a Document object and return it.
147:             * 
148:             * @param ipsrc is a SAX InputSource to the XML file
149:             * @param validate if true indicates that the document is to be validated
150:             * against it's schema.
151:             * @param handler is the ErrorHandler which is to be delegated XML parsing Error
152:             * handling tasks.
153:             * @param schemaFiles are the schema file to be used if validation is to be done, 
154:             * this parameter can be null if validate = false.
155:             * @return the XML Document object 
156:             * @throws SAXException on XML Parsing errors.
157:             * @throws ParserConfigurationException if the parser is not configured correctly. 
158:             * @throws java.io.IOException on IO Errors.
159:             */
160:            public Document load(InputSource ipsrc, boolean validate,
161:                    org.xml.sax.ErrorHandler handler, String[] schemaFiles)
162:                    throws java.io.IOException, SAXException,
163:                    ParserConfigurationException {
164:
165:                DocumentBuilderFactory docFactory = DocumentBuilderFactory
166:                        .newInstance();
167:                docFactory.setValidating(validate);
168:                docFactory.setNamespaceAware(true);
169:
170:                if (validate) {
171:                    docFactory.setAttribute(JAXP_SCHEMA_LANGUAGE,
172:                            W3C_XML_SCHEMA);
173:                    docFactory.setAttribute(JAXP_SCHEMA_SOURCE, schemaFiles);
174:                }
175:
176:                DocumentBuilder bldr = docFactory.newDocumentBuilder();
177:                if (handler != null) {
178:                    bldr.setErrorHandler(handler);
179:                }
180:
181:                return bldr.parse(ipsrc);
182:            };
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.