001: /**
002: * $RCSfile$
003: * $Revision: $
004: * $Date: $
005: *
006: * Copyright (C) 2007 Jive Software. All rights reserved.
007: *
008: * This software is published under the terms of the GNU Public License (GPL),
009: * a copy of which is included in this distribution.
010: */package org.jivesoftware.util.cache;
011:
012: import java.io.*;
013: import java.util.*;
014:
015: /**
016: * Dummy implementation that does nothing. The open source version of the server uses this
017: * strategy.
018: *
019: * @author Gaston Dombiak
020: */
021: public class DummyExternalizableUtil implements
022: ExternalizableUtilStrategy {
023: /**
024: * Writes a Map of String key and value pairs. This method handles the
025: * case when the Map is <tt>null</tt>.
026: *
027: * @param out the output stream.
028: * @param stringMap the Map of String key/value pairs.
029: * @throws java.io.IOException if an error occurs.
030: */
031: public void writeStringMap(DataOutput out,
032: Map<String, String> stringMap) throws IOException {
033: // Do nothing
034: }
035:
036: /**
037: * Reads a Map of String key and value pairs. This method will return
038: * <tt>null</tt> if the Map written to the stream was <tt>null</tt>.
039: *
040: * @param in the input stream.
041: * @return a Map of String key/value pairs.
042: * @throws IOException if an error occurs.
043: */
044: public Map<String, String> readStringMap(DataInput in)
045: throws IOException {
046: // Do nothing
047: return Collections.emptyMap();
048: }
049:
050: /**
051: * Writes a Map of Long key and Integer value pairs. This method handles
052: * the case when the Map is <tt>null</tt>.
053: *
054: * @param out the output stream.
055: * @param map the Map of Long key/Integer value pairs.
056: * @throws IOException if an error occurs.
057: */
058: public void writeLongIntMap(DataOutput out, Map<Long, Integer> map)
059: throws IOException {
060: // Do nothing
061: }
062:
063: /**
064: * Reads a Map of Long key and Integer value pairs. This method will return
065: * <tt>null</tt> if the Map written to the stream was <tt>null</tt>.
066: *
067: * @param in the input stream.
068: * @return a Map of Long key/Integer value pairs.
069: * @throws IOException if an error occurs.
070: */
071: public Map readLongIntMap(DataInput in) throws IOException {
072: // Do nothing
073: return Collections.emptyMap();
074: }
075:
076: /**
077: * Writes a List of Strings. This method handles the case when the List is
078: * <tt>null</tt>.
079: *
080: * @param out the output stream.
081: * @param stringList the List of Strings.
082: * @throws IOException if an error occurs.
083: */
084: public void writeStringList(DataOutput out, List stringList)
085: throws IOException {
086: // Do nothing
087: }
088:
089: /**
090: * Reads a List of Strings. This method will return <tt>null</tt> if the List
091: * written to the stream was <tt>null</tt>.
092: *
093: * @param in the input stream.
094: * @return a List of Strings.
095: * @throws IOException if an error occurs.
096: */
097: public List<String> readStringList(DataInput in) throws IOException {
098: // Do nothing
099: return Collections.emptyList();
100: }
101:
102: /**
103: * Writes an array of long values. This method handles the case when the
104: * array is <tt>null</tt>.
105: *
106: * @param out the output stream.
107: * @param array the array of long values.
108: * @throws IOException if an error occurs.
109: */
110: public void writeLongArray(DataOutput out, long[] array)
111: throws IOException {
112: // Do nothing
113: }
114:
115: /**
116: * Reads an array of long values. This method will return <tt>null</tt> if
117: * the array written to the stream was <tt>null</tt>.
118: *
119: * @param in the input stream.
120: * @return an array of long values.
121: * @throws IOException if an error occurs.
122: */
123: public long[] readLongArray(DataInput in) throws IOException {
124: // Do nothing
125: return new long[] {};
126: }
127:
128: public void writeLong(DataOutput out, long value) {
129: // Do nothing
130: }
131:
132: public long readLong(DataInput in) {
133: // Do nothing
134: return 0;
135: }
136:
137: public void writeBoolean(DataOutput out, boolean value) {
138: // Do nothing
139: }
140:
141: public boolean readBoolean(DataInput in) {
142: // Do nothing
143: return false;
144: }
145:
146: public void writeByteArray(DataOutput out, byte[] value)
147: throws IOException {
148: // Do nothing
149: }
150:
151: public byte[] readByteArray(DataInput in) throws IOException {
152: // Do nothing
153: return new byte[0];
154: }
155:
156: public void writeSerializable(DataOutput out, Serializable value)
157: throws IOException {
158: // Do nothing
159: }
160:
161: public Serializable readSerializable(DataInput in)
162: throws IOException {
163: // Do nothing
164: return null;
165: }
166:
167: public void writeSafeUTF(DataOutput out, String value) {
168: // Do nothing
169: }
170:
171: public String readSafeUTF(DataInput in) {
172: // Do nothing
173: return "";
174: }
175:
176: public void writeExternalizableCollection(DataOutput out,
177: Collection<? extends Externalizable> value)
178: throws IOException {
179: // Do nothing
180: }
181:
182: public int readExternalizableCollection(DataInput in,
183: Collection<? extends Externalizable> value,
184: ClassLoader loader) throws IOException {
185: // Do nothing
186: return 0;
187: }
188:
189: public void writeExternalizableMap(DataOutput out,
190: Map<String, ? extends Externalizable> map)
191: throws IOException {
192: // Do nothing
193: }
194:
195: public int readExternalizableMap(DataInput in,
196: Map<String, ? extends Externalizable> map,
197: ClassLoader loader) throws IOException {
198: // Do nothing
199: return 0;
200: }
201:
202: public void writeStringsMap(DataOutput out,
203: Map<String, Set<String>> map) throws IOException {
204: // Do nothing
205: }
206:
207: public int readStringsMap(DataInput in, Map<String, Set<String>> map)
208: throws IOException {
209: // Do nothing
210: return 0;
211: }
212:
213: public void writeStrings(DataOutput out,
214: Collection<String> collection) throws IOException {
215: // Do nothing
216: }
217:
218: public int readStrings(DataInput in, Collection<String> collection)
219: throws IOException {
220: // Do nothing
221: return 0;
222: }
223:
224: public void writeInt(DataOutput out, int value) {
225: // Do nothing
226: }
227:
228: public int readInt(DataInput in) {
229: // Do nothing
230: return 0;
231: }
232: }
|