Source Code Cross Referenced for CustomerFormatHandler.java in  » Web-Services » wsif » com » myeis » services » myeis » myeis » 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 » Web Services » wsif » com.myeis.services.myeis.myeis 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.myeis.services.myeis.myeis;
002:
003:        import java.io.*;
004:        import com.myeis.services.*;
005:        import org.apache.wsif.providers.jca.WSIFFormatHandler_JCA;
006:        import javax.xml.transform.Transformer;
007:        import javax.xml.transform.TransformerFactory;
008:        import javax.xml.transform.sax.SAXSource;
009:        import org.xml.sax.XMLReader;
010:        import org.xml.sax.Attributes;
011:        import org.xml.sax.ContentHandler;
012:        import org.xml.sax.InputSource;
013:        import org.xml.sax.helpers.AttributesImpl;
014:
015:        public class CustomerFormatHandler implements  WSIFFormatHandler_JCA {
016:            private Customer fieldCustomer = null;
017:
018:            public void read(InputStream inputStream) throws IOException {
019:                try {
020:                    ObjectInputStream objectInputStream = new ObjectInputStream(
021:                            inputStream);
022:                    Object obj = (Object) objectInputStream.readObject();
023:                    if (obj instanceof  Customer) {
024:                        this .fieldCustomer = (Customer) obj;
025:                    } else if (obj instanceof  com.myeis.services.internal.CustomerDataObject) {
026:                        com.myeis.services.internal.CustomerDataObject aCustomer = (com.myeis.services.internal.CustomerDataObject) obj;
027:                        this .fieldCustomer = new Customer();
028:                        this .fieldCustomer.setLastName(aCustomer.getLastName());
029:                        this .fieldCustomer.setFirstName(aCustomer
030:                                .getFirstName());
031:                        this .fieldCustomer.setNumber(aCustomer.getNumber());
032:                    }
033:                } catch (ClassNotFoundException e) {
034:                    e.printStackTrace();
035:                    throw new IOException("class not found !");
036:                }
037:            }
038:
039:            public void write(OutputStream outputStream) throws IOException {
040:                ObjectOutputStream objectOutputStream = new ObjectOutputStream(
041:                        outputStream);
042:                objectOutputStream.writeObject(this .fieldCustomer);
043:                objectOutputStream.flush();
044:            }
045:
046:            public void setObjectPart(Object objectPart) {
047:                this .fieldCustomer = (Customer) objectPart;
048:            }
049:
050:            public Object getObjectPart() {
051:                return this .fieldCustomer;
052:            }
053:
054:            public Object getObjectPart(Class sourceClass) {
055:                try {
056:                    if (sourceClass.isAssignableFrom(Class
057:                            .forName("javax.xml.transform.sax.SAXSource"))) {
058:                        SAXSource saxSource = new SAXSource(new InputSource());
059:                        XMLReader reader = new ContentReader();
060:                        saxSource.setXMLReader(reader);
061:                        return saxSource;
062:                    }
063:                } catch (Throwable e) {
064:                }
065:                return null;
066:            }
067:
068:            public Object getElement(String elementName) {
069:                return null;
070:            }
071:
072:            public void setElement(String elementName, Object element) {
073:            }
074:
075:            public Object getElement(String name, int index) {
076:                return null;
077:            }
078:
079:            public void setElement(String name, int index, Object value) {
080:            }
081:
082:            public javax.xml.namespace.QName getPartQName() {
083:                return null;
084:            }
085:
086:            public void setPartQName(javax.xml.namespace.QName qname) {
087:            }
088:
089:            public void setInteractionSpec(
090:                    javax.resource.cci.InteractionSpec arg0) {
091:                return;
092:            }
093:
094:            public class ContentReader implements  org.xml.sax.XMLReader {
095:                private ContentHandler fieldContentHandler = null;
096:
097:                public org.xml.sax.ContentHandler getContentHandler() {
098:                    return null;
099:                }
100:
101:                public org.xml.sax.DTDHandler getDTDHandler() {
102:                    return null;
103:                }
104:
105:                public org.xml.sax.EntityResolver getEntityResolver() {
106:                    return null;
107:                }
108:
109:                public org.xml.sax.ErrorHandler getErrorHandler() {
110:                    return null;
111:                }
112:
113:                public boolean getFeature(String name)
114:                        throws org.xml.sax.SAXNotSupportedException,
115:                        org.xml.sax.SAXNotRecognizedException {
116:                    return false;
117:                }
118:
119:                public Object getProperty(String name)
120:                        throws org.xml.sax.SAXNotSupportedException,
121:                        org.xml.sax.SAXNotRecognizedException {
122:                    return null;
123:                }
124:
125:                public void setDTDHandler(org.xml.sax.DTDHandler handler) {
126:                }
127:
128:                public void setEntityResolver(
129:                        org.xml.sax.EntityResolver resolver) {
130:                }
131:
132:                public void setErrorHandler(org.xml.sax.ErrorHandler handler) {
133:                }
134:
135:                public void setFeature(String name, boolean value)
136:                        throws org.xml.sax.SAXNotSupportedException,
137:                        org.xml.sax.SAXNotRecognizedException {
138:                }
139:
140:                public void setProperty(String name, Object value)
141:                        throws org.xml.sax.SAXNotSupportedException,
142:                        org.xml.sax.SAXNotRecognizedException {
143:                }
144:
145:                public void parse(String systemId) throws java.io.IOException,
146:                        org.xml.sax.SAXException {
147:                }
148:
149:                public void parse(org.xml.sax.InputSource input)
150:                        throws java.io.IOException, org.xml.sax.SAXException {
151:                    try {
152:                        Attributes attributes = new AttributesImpl();
153:                        this .fieldContentHandler.startDocument();
154:                        this .fieldContentHandler.startElement("", "number",
155:                                "number", attributes);
156:                        this .fieldContentHandler.characters(fieldCustomer
157:                                .getNumber().toCharArray(), 0, fieldCustomer
158:                                .getNumber().length());
159:                        this .fieldContentHandler.endElement("", "number",
160:                                "number");
161:                        this .fieldContentHandler.startElement("", "firstName",
162:                                "firstName", attributes);
163:                        this .fieldContentHandler.characters(fieldCustomer
164:                                .getFirstName().toCharArray(), 0, fieldCustomer
165:                                .getFirstName().length());
166:                        this .fieldContentHandler.endElement("", "firstName",
167:                                "firstName");
168:                        this .fieldContentHandler.startElement("", "lastName",
169:                                "lastName", attributes);
170:                        this .fieldContentHandler.characters(fieldCustomer
171:                                .getLastName().toCharArray(), 0, fieldCustomer
172:                                .getLastName().length());
173:                        this .fieldContentHandler.endElement("", "lastName",
174:                                "lastName");
175:                        this .fieldContentHandler.endDocument();
176:                    } catch (Exception e) {
177:                        e.printStackTrace();
178:                    }
179:                }
180:
181:                public void setContentHandler(org.xml.sax.ContentHandler handler) {
182:                    this.fieldContentHandler = handler;
183:                }
184:            }
185:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.