Source Code Cross Referenced for AbstractHessianInput.java in  » EJB-Server-resin-3.1.5 » hessian » com » caucho » hessian » io » 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 » EJB Server resin 3.1.5 » hessian » com.caucho.hessian.io 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2001-2004 Caucho Technology, Inc.  All rights reserved.
003:         *
004:         * The Apache Software License, Version 1.1
005:         *
006:         * Redistribution and use in source and binary forms, with or without
007:         * modification, are permitted provided that the following conditions
008:         * are met:
009:         *
010:         * 1. Redistributions of source code must retain the above copyright
011:         *    notice, this list of conditions and the following disclaimer.
012:         *
013:         * 2. Redistributions in binary form must reproduce the above copyright
014:         *    notice, this list of conditions and the following disclaimer in
015:         *    the documentation and/or other materials provided with the
016:         *    distribution.
017:         *
018:         * 3. The end-user documentation included with the redistribution, if
019:         *    any, must include the following acknowlegement:
020:         *       "This product includes software developed by the
021:         *        Caucho Technology (http://www.caucho.com/)."
022:         *    Alternately, this acknowlegement may appear in the software itself,
023:         *    if and wherever such third-party acknowlegements normally appear.
024:         *
025:         * 4. The names "Burlap", "Resin", and "Caucho" must not be used to
026:         *    endorse or promote products derived from this software without prior
027:         *    written permission. For written permission, please contact
028:         *    info@caucho.com.
029:         *
030:         * 5. Products derived from this software may not be called "Resin"
031:         *    nor may "Resin" appear in their names without prior written
032:         *    permission of Caucho Technology.
033:         *
034:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
035:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
036:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
037:         * DISCLAIMED.  IN NO EVENT SHALL CAUCHO TECHNOLOGY OR ITS CONTRIBUTORS
038:         * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
039:         * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
040:         * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
041:         * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
042:         * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
043:         * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
044:         * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
045:         *
046:         * @author Scott Ferguson
047:         */
048:
049:        package com.caucho.hessian.io;
050:
051:        import java.io.IOException;
052:        import java.io.InputStream;
053:        import java.io.Reader;
054:
055:        /**
056:         * Abstract base class for Hessian requests.  Hessian users should only
057:         * need to use the methods in this class.
058:         *
059:         * <pre>
060:         * AbstractHessianInput in = ...; // get input
061:         * String value;
062:         *
063:         * in.startReply();         // read reply header
064:         * value = in.readString(); // read string value
065:         * in.completeReply();      // read reply footer
066:         * </pre>
067:         */
068:        abstract public class AbstractHessianInput {
069:            private HessianRemoteResolver resolver;
070:
071:            /**
072:             * Initialize the Hessian stream with the underlying input stream.
073:             */
074:            public void init(InputStream is) {
075:            }
076:
077:            /**
078:             * Returns the call's method
079:             */
080:            abstract public String getMethod();
081:
082:            /**
083:             * Sets the resolver used to lookup remote objects.
084:             */
085:            public void setRemoteResolver(HessianRemoteResolver resolver) {
086:                this .resolver = resolver;
087:            }
088:
089:            /**
090:             * Sets the resolver used to lookup remote objects.
091:             */
092:            public HessianRemoteResolver getRemoteResolver() {
093:                return resolver;
094:            }
095:
096:            /**
097:             * Sets the serializer factory.
098:             */
099:            public void setSerializerFactory(SerializerFactory ser) {
100:            }
101:
102:            /**
103:             * Reads the call
104:             *
105:             * <pre>
106:             * c major minor
107:             * </pre>
108:             */
109:            abstract public int readCall() throws IOException;
110:
111:            /**
112:             * For backward compatibility with HessianSkeleton
113:             */
114:            public void skipOptionalCall() throws IOException {
115:            }
116:
117:            /**
118:             * Reads a header, returning null if there are no headers.
119:             *
120:             * <pre>
121:             * H b16 b8 value
122:             * </pre>
123:             */
124:            abstract public String readHeader() throws IOException;
125:
126:            /**
127:             * Starts reading the call
128:             *
129:             * <p>A successful completion will have a single value:
130:             *
131:             * <pre>
132:             * m b16 b8 method
133:             * </pre>
134:             */
135:            abstract public String readMethod() throws IOException;
136:
137:            /**
138:             * Starts reading the call, including the headers.
139:             *
140:             * <p>The call expects the following protocol data
141:             *
142:             * <pre>
143:             * c major minor
144:             * m b16 b8 method
145:             * </pre>
146:             */
147:            abstract public void startCall() throws IOException;
148:
149:            /**
150:             * Completes reading the call
151:             *
152:             * <p>The call expects the following protocol data
153:             *
154:             * <pre>
155:             * Z
156:             * </pre>
157:             */
158:            abstract public void completeCall() throws IOException;
159:
160:            /**
161:             * Reads a reply as an object.
162:             * If the reply has a fault, throws the exception.
163:             */
164:            abstract public Object readReply(Class expectedClass)
165:                    throws Throwable;
166:
167:            /**
168:             * Starts reading the reply
169:             *
170:             * <p>A successful completion will have a single value:
171:             *
172:             * <pre>
173:             * r
174:             * v
175:             * </pre>
176:             */
177:            abstract public void startReply() throws Throwable;
178:
179:            /**
180:             * Completes reading the call
181:             *
182:             * <p>A successful completion will have a single value:
183:             *
184:             * <pre>
185:             * z
186:             * </pre>
187:             */
188:            abstract public void completeReply() throws IOException;
189:
190:            /**
191:             * Reads a boolean
192:             *
193:             * <pre>
194:             * T
195:             * F
196:             * </pre>
197:             */
198:            abstract public boolean readBoolean() throws IOException;
199:
200:            /**
201:             * Reads a null
202:             *
203:             * <pre>
204:             * N
205:             * </pre>
206:             */
207:            abstract public void readNull() throws IOException;
208:
209:            /**
210:             * Reads an integer
211:             *
212:             * <pre>
213:             * I b32 b24 b16 b8
214:             * </pre>
215:             */
216:            abstract public int readInt() throws IOException;
217:
218:            /**
219:             * Reads a long
220:             *
221:             * <pre>
222:             * L b64 b56 b48 b40 b32 b24 b16 b8
223:             * </pre>
224:             */
225:            abstract public long readLong() throws IOException;
226:
227:            /**
228:             * Reads a double.
229:             *
230:             * <pre>
231:             * D b64 b56 b48 b40 b32 b24 b16 b8
232:             * </pre>
233:             */
234:            abstract public double readDouble() throws IOException;
235:
236:            /**
237:             * Reads a date.
238:             *
239:             * <pre>
240:             * T b64 b56 b48 b40 b32 b24 b16 b8
241:             * </pre>
242:             */
243:            abstract public long readUTCDate() throws IOException;
244:
245:            /**
246:             * Reads a string encoded in UTF-8
247:             *
248:             * <pre>
249:             * s b16 b8 non-final string chunk
250:             * S b16 b8 final string chunk
251:             * </pre>
252:             */
253:            abstract public String readString() throws IOException;
254:
255:            /**
256:             * Reads an XML node encoded in UTF-8
257:             *
258:             * <pre>
259:             * x b16 b8 non-final xml chunk
260:             * X b16 b8 final xml chunk
261:             * </pre>
262:             */
263:            abstract public org.w3c.dom.Node readNode() throws IOException;
264:
265:            /**
266:             * Starts reading a string.  All the characters must be read before
267:             * calling the next method.  The actual characters will be read with
268:             * the reader's read() or read(char [], int, int).
269:             *
270:             * <pre>
271:             * s b16 b8 non-final string chunk
272:             * S b16 b8 final string chunk
273:             * </pre>
274:             */
275:            abstract public Reader getReader() throws IOException;
276:
277:            /**
278:             * Starts reading a byte array using an input stream.  All the bytes
279:             * must be read before calling the following method.
280:             *
281:             * <pre>
282:             * b b16 b8 non-final binary chunk
283:             * B b16 b8 final binary chunk
284:             * </pre>
285:             */
286:            abstract public InputStream readInputStream() throws IOException;
287:
288:            /**
289:             * Reads a byte array.
290:             *
291:             * <pre>
292:             * b b16 b8 non-final binary chunk
293:             * B b16 b8 final binary chunk
294:             * </pre>
295:             */
296:            abstract public byte[] readBytes() throws IOException;
297:
298:            /**
299:             * Reads an arbitrary object from the input stream.
300:             *
301:             * @param expectedClass the expected class if the protocol doesn't supply it.
302:             */
303:            abstract public Object readObject(Class expectedClass)
304:                    throws IOException;
305:
306:            /**
307:             * Reads an arbitrary object from the input stream.
308:             */
309:            abstract public Object readObject() throws IOException;
310:
311:            /**
312:             * Reads a remote object reference to the stream.  The type is the
313:             * type of the remote interface.
314:             *
315:             * <code><pre>
316:             * 'r' 't' b16 b8 type url
317:             * </pre></code>
318:             */
319:            abstract public Object readRemote() throws IOException;
320:
321:            /**
322:             * Reads a reference
323:             *
324:             * <pre>
325:             * R b32 b24 b16 b8
326:             * </pre>
327:             */
328:            abstract public Object readRef() throws IOException;
329:
330:            /**
331:             * Adds an object reference.
332:             */
333:            abstract public int addRef(Object obj) throws IOException;
334:
335:            /**
336:             * Sets an object reference.
337:             */
338:            abstract public void setRef(int i, Object obj) throws IOException;
339:
340:            /**
341:             * Resets the references for streaming.
342:             */
343:            public void resetReferences() {
344:            }
345:
346:            /**
347:             * Reads the start of a list
348:             */
349:            abstract public int readListStart() throws IOException;
350:
351:            /**
352:             * Reads the length of a list.
353:             */
354:            abstract public int readLength() throws IOException;
355:
356:            /**
357:             * Reads the start of a map
358:             */
359:            abstract public int readMapStart() throws IOException;
360:
361:            /**
362:             * Reads an object type.
363:             */
364:            abstract public String readType() throws IOException;
365:
366:            /**
367:             * Returns true if the data has ended.
368:             */
369:            abstract public boolean isEnd() throws IOException;
370:
371:            /**
372:             * Read the end byte
373:             */
374:            abstract public void readEnd() throws IOException;
375:
376:            /**
377:             * Read the end byte
378:             */
379:            abstract public void readMapEnd() throws IOException;
380:
381:            /**
382:             * Read the end byte
383:             */
384:            abstract public void readListEnd() throws IOException;
385:
386:            public void close() throws IOException {
387:            }
388:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.