Source Code Cross Referenced for JivanSimpleXMLObjectImpl.java in  » J2EE » Enhydra-Application-Framework » org » enhydra » util » jivan » 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 » J2EE » Enhydra Application Framework » org.enhydra.util.jivan 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Enhydra Java Application Server Project
003:         *
004:         * The contents of this file are subject to the Enhydra Public License
005:         * Version 1.1 (the "License"); you may not use this file except in
006:         * compliance with the License. You may obtain a copy of the License on
007:         * the Enhydra web site ( http://www.enhydra.org/ ).
008:         *
009:         * Software distributed under the License is distributed on an "AS IS"
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
011:         * the License for the specific terms governing rights and limitations
012:         * under the License.
013:         *
014:         * The Developer of the Enhydra Application Server is Together Austria.
015:         * All Rights Reserved.
016:         *
017:         */
018:        package org.enhydra.util.jivan;
019:
020:        import java.io.ByteArrayOutputStream;
021:        import java.io.IOException;
022:
023:        import org.enhydra.util.dom.SimpleXMLObjectImpl;
024:        import org.jivan.html.document.DocumentManager;
025:        import org.jivan.html.dom.HTMLDocumentCEImpl;
026:        import org.w3c.dom.Document;
027:
028:        /**
029:         * <p>Title: JivanSimpleXMLObjectImpl</p>
030:         * <p>Description: This class represents implementation of XMLObject interface.
031:         * Its main purpose is to provide the way for creation of XMLObject object by
032:         * passed Jivan org.w3c.dom.Document Jivan implementation. The XMLCObject
033:         * created by this manner can be used in already existing writeDOM() methods of
034:         * ServletHttpPresentationResponse object to perform http response. Note that
035:         * this class was tested only in in http response, not in DOM manipulation, and
036:         * some methods throw an exception
037:         * because they are not implemented.</p>
038:         * <p>Copyright: Copyright (c) 2004</p>
039:         * <p>Company: Together</p>
040:         * @author Vladimir Radisic
041:         * @version 1.0
042:         */
043:        public class JivanSimpleXMLObjectImpl extends SimpleXMLObjectImpl {
044:
045:            public JivanSimpleXMLObjectImpl() {
046:                super ();
047:            }
048:
049:            /**
050:             * Set the Jivan implemented DOM document associated with this object and
051:             * optional encoding. Note that if argument 'document' is not of type
052:             * org.jivan.html.dom.HTMLDocumentCEImpl, the ClassCastException will be
053:             * thrown.
054:             * @param document org.w3c.dom.Document implementation which should be
055:             * associated with this object,
056:             * @param mimeType The MIME type associated with the document.
057:             * @param encoding The encoding associated with the document.
058:             */
059:            public void setDocument(Document document, String mimeType,
060:                    String encoding) {
061:                if (document != null
062:                        && document instanceof  org.jivan.html.dom.HTMLDocumentCEImpl) {
063:                    super .setDocument(document, mimeType, encoding);
064:                } else
065:                    throw new java.lang.ClassCastException(
066:                            "Document must be the org.jivan.html.dom.HTMLDocumentCEImpl implementation!");
067:            }
068:
069:            /**
070:             * Set the Jivan implemented DOM document associated with this object and
071:             * optional encoding. The MIME type is set to default value ('text/html').
072:             * Note that if argument 'document' is not of type
073:             * org.jivan.html.dom.HTMLDocumentCEImpl, the ClassCastException will be
074:             * thrown.
075:             * @param document org.w3c.dom.Document implementation which should be
076:             * associated with this object,
077:             * @param encoding The encoding associated with the document.
078:             */
079:            public void setDocument(Document document, String encoding) {
080:                this .setDocument(document, "text/html", encoding);
081:            }
082:
083:            /**
084:             * Set the Jivan implemented DOM document associated with this object and
085:             * optional encoding. The MIME type is set to default value ('text/html'),
086:             * and encoding is also set to default value ('UTF-8'). Note that if argument
087:             * 'document' is not of type org.jivan.html.dom.HTMLDocumentCEImpl, the
088:             * ClassCastException will be thrown.
089:             * @param document org.w3c.dom.Document implementation which should be
090:             * associated with this object,
091:             */
092:            public void setDocument(Document document) {
093:                this .setDocument(document, "text/html", "UTF-8");
094:            }
095:
096:            /**
097:             * Set the Jivan implemented DOM document associated with this object via
098:             * corresponding DocumentManager and optional encoding.
099:             * @param docMan appropriate DocumentManager object which contains the desired
100:             * Jivan Document implementation (org.jivan.html.dom.HTMLDocumentCEImpl).
101:             * @param mimeType The MIME type associated with the document.
102:             * @param encoding The encoding associated with the document.
103:             */
104:            public void setDocument(DocumentManager docMan, String mimeType,
105:                    String encoding) {
106:                Document temp = docMan.getDocument();
107:                this .setDocument(temp, mimeType, encoding);
108:            }
109:
110:            /**
111:             * Set the Jivan implemented DOM document associated with this object via
112:             * corresponding DocumentManager and optional encoding. The MIME type is set
113:             * to default value ('text/html').
114:             * @param docMan appropriate DocumentManager object which contains the desired
115:             * Jivan Document implementation (org.jivan.html.dom.HTMLDocumentCEImpl).
116:             * @param encoding The encoding associated with the document.
117:             */
118:            public void setDocument(DocumentManager docMan, String encoding) {
119:                Document temp = docMan.getDocument();
120:                this .setDocument(temp, "text/html", encoding);
121:            }
122:
123:            /**
124:             * Set the Jivan implemented DOM document associated with this object via
125:             * corresponding DocumentManager and optional encoding. The MIME type is set
126:             * to default value ('text/html'), and encoding is also set to default value
127:             * ('UTF-8').
128:             * @param docMan appropriate DocumentManager object which contains the desired
129:             * Jivan Document implementation (org.jivan.html.dom.HTMLDocumentCEImpl).
130:             */
131:            public void setDocument(DocumentManager docMan) {
132:                Document temp = docMan.getDocument();
133:                this .setDocument(temp, "text/html", "UTF-8");
134:            }
135:
136:            /**
137:             * Transforms Jivan Document DOM object to byte array. This will be done by
138:             * using corresponding DocumentManager and its serialize() method
139:             * @return DOM represented as byte array.
140:             * @throws IOException
141:             */
142:            public byte[] toByteDocument() throws IOException {
143:                HTMLDocumentCEImpl doc = (HTMLDocumentCEImpl) super 
144:                        .getDocument();
145:                DocumentManager dm = doc.getDocman();
146:
147:                ByteArrayOutputStream bos = new ByteArrayOutputStream();
148:                dm.serialize(bos);
149:                bos.flush();
150:                byte[] retArray = bos.toByteArray();
151:                bos.close();
152:
153:                return retArray;
154:            }
155:
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.