KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > exchange > simple > PacketBodyImpl


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.exchange.simple;
14
15 import info.magnolia.exchange.PacketBody;
16 import info.magnolia.exchange.PacketIOException;
17 import info.magnolia.exchange.PacketType;
18
19 import java.io.InputStream JavaDoc;
20 import java.util.Calendar JavaDoc;
21
22 import org.apache.log4j.Logger;
23
24
25 /**
26  * Date: May 4, 2004 Time: 5:10:21 PM
27  * @author Sameer Charles
28  */

29 public class PacketBodyImpl implements PacketBody {
30
31     private static Logger log = Logger.getLogger(PacketBodyImpl.class);
32
33     private int type;
34
35     private Object JavaDoc data;
36
37     public PacketBodyImpl() {
38     }
39
40     public void setType(int type) {
41         this.type = type;
42     }
43
44     public int getType() {
45         return this.type;
46     }
47
48     public void setLength(long size) {
49         log.debug("Method not implemented ( setlength() )"); //$NON-NLS-1$
50
}
51
52     public long getLength() {
53         log.debug("Method not implemented ( getlength() )"); //$NON-NLS-1$
54
return 0;
55     }
56
57     public void setBody(String JavaDoc data) {
58         log.debug("Method not implemented ( setBody(String) )"); //$NON-NLS-1$
59
}
60
61     public void setBody(InputStream JavaDoc data) throws PacketIOException {
62         log.debug("Method not implemented ( setBody(InputStream) )"); //$NON-NLS-1$
63
}
64
65     public void setBody(Long JavaDoc data) throws PacketIOException {
66         log.debug("Method not implemented ( setBody(Long) )"); //$NON-NLS-1$
67
}
68
69     public void setBody(Double JavaDoc data) throws PacketIOException {
70         log.debug("Method not implemented ( setBody(Double) )"); //$NON-NLS-1$
71
}
72
73     public void setBody(Calendar JavaDoc data) throws PacketIOException {
74         log.debug("Method not implemented ( setBody(Calendar) )"); //$NON-NLS-1$
75
}
76
77     public void setBody(Boolean JavaDoc data) throws PacketIOException {
78         log.debug("Method not implemented ( setBody(Boolean) )"); //$NON-NLS-1$
79
}
80
81     public void setBody(Object JavaDoc data) throws PacketIOException {
82         if (data == null) {
83             throw (new IllegalArgumentException JavaDoc());
84         }
85         this.setType(PacketType.OBJECT);
86         this.data = data;
87     }
88
89     public Object JavaDoc getObject() {
90         return this.data;
91     }
92
93     public String JavaDoc toString() {
94         return this.data.toString();
95     }
96 }
97
Popular Tags