geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bschucha...@apache.org
Subject [27/37] incubator-geode git commit: GEODE-287: Remove old gfsh code
Date Tue, 01 Sep 2015 16:49:05 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/function/command/which.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/function/command/which.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/function/command/which.java
deleted file mode 100644
index df8bcf4..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/function/command/which.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.function.command;
-
-import java.util.HashMap;
-import java.util.TreeMap;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.tools.gfsh.aggregator.AggregateResults;
-import com.gemstone.gemfire.internal.tools.gfsh.app.ServerExecutable;
-import com.gemstone.gemfire.internal.tools.gfsh.app.function.GfshData;
-import com.gemstone.gemfire.internal.tools.gfsh.util.RegionUtil;
-
-public class which implements ServerExecutable
-{
-	private byte code = AggregateResults.CODE_NORMAL;
-	private String codeMessage = null;
-	
-	static String major;
-	static String minor;
-	static String update;
-	static String build;
-	
-	static {
-		determineGemFireVersion();
-	}
-	
-	private static void determineGemFireVersion()
-	{
-		String gemfireVersion = GemFireVersion.getGemFireVersion();
-		String split[] = gemfireVersion.split("\\.");
-		
-		for (int i = 0;i < split.length; i++) {
-			switch (i) {
-			case 0:
-				major = split[i];
-				break;
-			case 1:
-				minor = split[i];
-				break;
-			case 2:
-				update = split[i];
-				break;
-			case 3:
-				build = split[i];
-				break;
-			}
-		}
-	}
-	
-	public Object execute(String command, String regionPath, Object arg) throws Exception
-	{
-		GfshData data = new GfshData(null);
-		Cache cache = CacheFactory.getAnyInstance();
-		
-		Object args[] = (Object[])arg;
-		if (args.length < 0) {
-			code = AggregateResults.CODE_ERROR;
-			codeMessage = "Key not specified";
-			return data;
-		}
-		Object key = args[0];
-		boolean recursive = false;
-		if (args.length > 1) {
-			recursive = (Boolean)args[1];
-		}		
-		
-		try {
-			TreeMap<String, Object> map = new TreeMap();
-			
-			if (recursive == false) {	
-				
-				// Find the value from the partitioned region
-				if (regionPath == null || regionPath.equals("/")) {
-					code = AggregateResults.CODE_ERROR;
-					codeMessage = "Invalid region path " + regionPath;
-					return data;
-				}
-				Region region = cache.getRegion(regionPath);
-				if (region == null) {
-					code = AggregateResults.CODE_ERROR;
-					codeMessage = "Undefined region " + regionPath;
-					return data;
-				}
-				
-				Object value;
-				DistributedMember primaryMember = null;
-				if (region instanceof PartitionedRegion) {
-					PartitionedRegion pr = (PartitionedRegion)region;
-					Region localRegion = PartitionRegionHelper.getLocalData((PartitionedRegion)region);
-					value = localRegion.get(key);
-					primaryMember = PartitionRegionHelper.getPrimaryMemberForKey(region, key);
-					
-					// 6.0 - Note that this may or may not work
-//					int bucketId = PartitionedRegionHelper.getHashKey(pr, Operation.GET, key, null);
-					
-					// 6.5
-					int bucketId = pr.getKeyInfo(key).getBucketId();
-					
-					DistributedMember member = cache.getDistributedSystem().getDistributedMember();
-					boolean isPrimary = member == primaryMember;
-					HashMap<String, Object> prInfoMap = new HashMap<String, Object>();
-					prInfoMap.put("BucketId", bucketId);
-					prInfoMap.put("IsPrimary", isPrimary);
-					data.setUserData(prInfoMap);
-				} else {
-					value = region.get(key);
-				}
-				if (value != null) {
-					map.put(regionPath, value);
-				}
-				
-			} else {
-				
-				// Recursively find the keys starting from the specified region path.
-				String regionPaths[] = RegionUtil.getAllRegionPaths(cache, true);
-				for (int i = 0; i < regionPaths.length; i++) {
-					if (regionPaths[i].startsWith(regionPath)) {
-						Object value = null;
-						Region region = cache.getRegion(regionPaths[i]);
-												
-						if (region instanceof PartitionedRegion) {
-							PartitionedRegion pr = (PartitionedRegion)region;
-							Region localRegion = PartitionRegionHelper.getLocalData(pr);
-							value = localRegion.get(key);
-						} else {
-							value = region.get(key);
-						}
-						if (value != null) {
-							map.put(regionPaths[i], value);
-						}
-					}
-				}
-				
-			}
-		
-			data.setDataObject(map);
-			
-		} catch (Exception ex) {
-			code = AggregateResults.CODE_ERROR;
-			codeMessage = ex.getMessage();
-		}
-		return data;
-	}
-
-	public byte getCode()
-	{
-		return code;
-	}
-	
-	public String getCodeMessage()
-	{
-		return codeMessage;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ClassFinder.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ClassFinder.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ClassFinder.java
deleted file mode 100644
index b9a062f..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ClassFinder.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.misc.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import com.gemstone.gemfire.internal.ClassPathLoader;
-
-public class ClassFinder
-{
-
-	/**
-	 * Returns all classes that are in the specified package. Use this method to find
-	 * inflated classes, i.e., classes that are kept in a directory. Use
-	 * getClasses(String jarPath, String packageName) if the classes are in a jar file.
-	 * 
-	 * @param packageName
-	 *            The base package
-	 * @return The classes
-	 * @throws ClassNotFoundException Thrown if unable to load a class
-	 * @throws IOException Thrown if error occurs while reading the jar file
-	 */
-	public static Class[] getClasses(String packageName) throws ClassNotFoundException, IOException
-	{
-		ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-//		assert classLoader != null;
-		String path = packageName.replace('.', '/');
-		Enumeration resources = classLoader.getResources(path);
-		List dirs = new ArrayList();
-		while (resources.hasMoreElements()) {
-			URL resource = (URL)resources.nextElement();
-			dirs.add(new File(resource.getFile()));
-		}
-		ArrayList classes = new ArrayList();
-		for (Iterator iterator = dirs.iterator(); iterator.hasNext();) {
-			File directory = (File)iterator.next();
-			classes.addAll(findClasses(directory, packageName));
-		}
-		return (Class[])classes.toArray(new Class[classes.size()]);
-	}
-
-	/**
-	 * Returns all classes found in the specified directory.
-	 * 
-	 * @param directory
-	 *            The base directory
-	 * @param packageName
-	 *            The package name for classes found inside the base directory
-	 * @return The classes 
-	 * @throws ClassNotFoundException Thrown if unable to load a class
-	 */
-	public static List findClasses(File directory, String packageName) throws ClassNotFoundException
-	{
-		List classes = new ArrayList();
-		if (!directory.exists()) {
-			return classes;
-		}
-		File[] files = directory.listFiles();
-		for (int i = 0; i < files.length; i++) {
-			File file = files[i];
-			if (file.isDirectory()) {
-//				assert !file.getName().contains(".");
-				classes.addAll(findClasses(file, packageName + "." + file.getName()));
-			} else if (file.getName().endsWith(".class")) {
-				classes
-						.add(Class
-								.forName(packageName + '.' + file.getName().substring(0, file.getName().length() - 6)));
-			}
-		}
-		return classes;
-	}
-
-	/**
-	 * Returns all classes that are in the specified jar and package name.
-	 * @param jarPath The absolute or relative jar path.
-	 * @param packageName The package name.
-	 * @return Returns all classes that are in the specified jar and package name.
-	 * @throws ClassNotFoundException Thrown if unable to load a class
-	 * @throws IOException Thrown if error occurs while reading the jar file
-	 */
-	public static Class[] getClasses(String jarPath, String packageName) throws ClassNotFoundException, IOException
-	{
-		String[] classNames = getClassNames(jarPath, packageName);
-		Class classes[] = new Class[classNames.length];
-		for (int i = 0; i < classNames.length; i++) {
-			String className = (String)classNames[i];
-			classes[i] = Class.forName(className);
-		}
-		return classes;
-	}
-	
-	/**
-	 * Returns all names of classes that are defined in the specified jar and package name.
-	 * @param jarPath The absolute or relative jar path.
-	 * @param packageName The package name.
-	 * @return Returns all names of classes that are defined in the specified jar and package name.
-	 * @throws IOException Thrown if error occurs while reading the jar file
-	 */
-	public static String[] getClassNames(String jarPath, String packageName) throws IOException
-	{
-		if (jarPath == null) {
-			return new String[0];
-		}
-		
-		File file;
-		if (jarPath.startsWith("/") || jarPath.indexOf(':') >= 0) {
-			// absolute path
-			file = new File(jarPath);
-		} else {
-			// relative path
-			String workingDir = System.getProperty("user.dir");
-			file = new File(workingDir + "/" + jarPath);
-		}
-		
-		ArrayList arrayList = new ArrayList();
-		packageName = packageName.replaceAll("\\.", "/");
-		JarInputStream jarFile = new JarInputStream(new FileInputStream(file));
-		JarEntry jarEntry;
-		while (true) {
-			jarEntry = jarFile.getNextJarEntry();
-			if (jarEntry == null) {
-				break;
-			}
-			String name = jarEntry.getName();
-			if (name.startsWith(packageName) && (name.endsWith(".class"))) {
-				int endIndex = name.length() - 6;
-				name = name.replaceAll("/", "\\.");
-				name = name.substring(0, endIndex);
-				arrayList.add(name);
-			}
-		}
-		jarFile.close();
-
-		return (String[])arrayList.toArray(new String[0]);
-	}
-	
-	/**
-	 * Returns all classes that are in the specified jar.
-	 * @param jarPath The absolute or relative jar path.
-	 * @return Returns all classes that are in the specified jar
-	 * @throws ClassNotFoundException Thrown if unable to load a class
-	 * @throws IOException Thrown if error occurs while reading the jar file
-	 */
-	public static Class[] getAllClasses(String jarPath) throws ClassNotFoundException, IOException
-	{
-		String[] classNames = getAllClassNames(jarPath);
-		Class classes[] = new Class[classNames.length];
-		for (int i = 0; i < classNames.length; i++) {
-			String className = (String)classNames[i];
-			classes[i] = ClassPathLoader.getLatest().forName(className);
-		}
-		return classes;
-	}
-	
-	/**
-	 * Returns all names of classes that are defined in the specified jar.
-	 * @param jarPath The absolute or relative jar path.
-	 * @return Returns all names of classes that are defined in the specified jar.
-	 * @throws IOException Thrown if error occurs while reading the jar file
-	 */
-	public static String[] getAllClassNames(String jarPath) throws IOException
-	{
-		if (jarPath == null) {
-			return new String[0];
-		}
-		
-		jarPath = jarPath.trim();
-		if (jarPath.length() == 0) {
-			return new String[0];
-		}
-		
-		File file;
-		if (jarPath.startsWith("/") || jarPath.indexOf(':') >= 0) {
-			// absolute path
-			file = new File(jarPath);
-		} else {
-			// relative path
-			String workingDir = System.getProperty("user.dir");
-			file = new File(workingDir + "/" + jarPath);
-		}
-		
-		ArrayList arrayList = new ArrayList();
-		JarInputStream jarFile = new JarInputStream(new FileInputStream(file));
-		JarEntry jarEntry;
-		while (true) {
-			jarEntry = jarFile.getNextJarEntry();
-			if (jarEntry == null) {
-				break;
-			}
-			String name = jarEntry.getName();
-			if (name.endsWith(".class")) {
-				int endIndex = name.length() - 6;
-				name = name.replaceAll("/", "\\.");
-				name = name.substring(0, endIndex);
-				arrayList.add(name);
-			}
-		}
-		jarFile.close();
-
-		return (String[])arrayList.toArray(new String[0]);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/DataSerializerEx.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/DataSerializerEx.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/DataSerializerEx.java
deleted file mode 100644
index 6c77ddf..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/DataSerializerEx.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.misc.util;
-
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.zip.DataFormatException;
-import java.util.zip.Deflater;
-import java.util.zip.Inflater;
-
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.internal.DSCODE;
-
-public abstract class DataSerializerEx extends DataSerializer
-{
-	/**
-	 * Writes the specified byte array to the output stream. This method is 
-	 * not thread safe.
-	 * 
-	 * @param array The byte array to compress
-	 * @param buffer The byte array buffer used as input to the deflater. This
-	 *               buffer must have enough space to hold the compressed data.
-	 * @param compressor java.util.Deflater. 
-	 * @param output The data output stream.
-	 * @throws IOException Thrown if unable to write to the output stream.
-	 */
-	public static void writeByteArray(byte array[], byte buffer[], Deflater compressor, DataOutput output) throws IOException
-	{
-		// Compress the bytes
-		 compressor.setInput(array);
-		 compressor.finish();
-		 int compressedDataLength = compressor.deflate(buffer);
-		 DataSerializer.writeByteArray(buffer, compressedDataLength, output);
-	}
-	
-	/**
-	 * Reads byte array from the input stream. This method is not thread safe.
-	 * 
-	 * @param buffer The buffer to hold the decompressed data. This buffer
-	 *               must be large enough to hold the decompressed data.
-	 * @param decompressor java.util.Inflater
-	 * @param input The data input stream.
-	 * @return Returns the actual byte array (not compressed) read from the 
-	 *         input stream.
-	 * @throws IOException Thrown if unable to read from the input stream or
-	 *                     unable to decompress the data.
-	 */
-	public static byte[] readByteArray(byte buffer[], Inflater decompressor, DataInput input) throws IOException
-	{
-		byte compressedBuffer[] = DataSerializer.readByteArray(input);	
-		// Decompress the bytes
-		decompressor.setInput(compressedBuffer, 0, compressedBuffer.length);
-		byte retval[] = null;
-		try {
-			int resultLength = decompressor.inflate(buffer);
-			retval = new byte[resultLength];
-			System.arraycopy(compressedBuffer, 0, retval, 0, resultLength);
-		} catch (DataFormatException e) {
-			throw new IOException("Unable to decompress the byte array due to a data format error. " + e.getMessage());
-		}
-		return retval;
-	}
-	
-	/**
-	 * Reads UTF string from the input. This method is analogous to 
-	 * DataInput.readUTF() except that it supports null string.
-	 * @param input The data input stream.
-	 * @return Returns null or non-null string value.
-	 * @throws IOException Thrown if unable to read from the input stream.
-	 */
-	public static String readUTF(DataInput input) throws IOException
-	{
-		byte header = input.readByte();
-		if (header == DSCODE.NULL_STRING) {
-			return null;
-		} 
-		return input.readUTF();
-	}
-	
-	/**
-	 * Writes the specified sting value to the output stream. This method
-	 * is analogous to DataOutput.writeUTF() except that it supports null
-	 * string.
-	 * @param value The string value to write to the output stream.
-	 * @param output The data output stream.
-	 * @throws IOException Thrown if unable to write to the output stream. 
-	 */
-	public static void writeUTF(String value, DataOutput output) throws IOException
-	{
-		if (value == null) {
-			output.writeByte(DSCODE.NULL_STRING);
-		} else {
-			output.writeByte(DSCODE.STRING);
-			output.writeUTF(value);
-		}		
-	}
-}
- 
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherListener.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherListener.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherListener.java
deleted file mode 100644
index 9e0a9d5..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherListener.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.misc.util;
-
-/**
- * @author Dae Song Park
- * @since 1.0
- */
-public interface QueueDispatcherListener
-{
-    void objectDispatched(Object obj);
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherThread.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherThread.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherThread.java
deleted file mode 100644
index c206d4d..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/QueueDispatcherThread.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.misc.util;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Collections;
-
-
-/**
- * <p>Title:</p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2004</p>
- * <p>Company: GemStone Systems, Inc.</p>
- * @author Dae Song Park
- * @version 1.0
- */
-public class QueueDispatcherThread extends Thread
-{
-    private List list = Collections.synchronizedList(new LinkedList());
-    private QueueDispatcherListener queueDispatcherListener;
-    private boolean shouldRun = true;
-
-    public QueueDispatcherThread()
-    {
-        setDaemon(true);
-    }
-
-    public synchronized void enqueue(Object obj)
-    {
-        list.add(obj);
-        this.notify();
-    }
-
-    public synchronized Object dequeue() throws InterruptedException
-    {
-        while (list.size() == 0) {
-            this.wait(1000);
-        }
-        return list.remove(0);
-    }
-
-    public int size()
-    {
-        return list.size();
-    }
-
-    public boolean isEmpty()
-    {
-        return list.size() == 0;
-    }
-
-    public void setQueueDispatcherListener(QueueDispatcherListener listener)
-    {
-        this.queueDispatcherListener = listener;
-    }
-
-    public QueueDispatcherListener getQueueDispatcherListener()
-    {
-        return queueDispatcherListener;
-    }
-
-    public synchronized void run()
-    {
-        while (shouldRun) {
-            try {
-            	while (list.size() == 0 && shouldRun) {
-                    this.wait(1000);
-                }
-            	int size = list.size();
-            	if (size > 0) {
-            		for (int i = 0; i < size; i++) {
-            			Object obj = list.remove(0);
-		                if (queueDispatcherListener != null) {
-		                    queueDispatcherListener.objectDispatched(obj);
-		                }
-            		}
-            	}
-            } catch (InterruptedException ex) {
-                // ignore for the time being
-            }
-        }
-    }
-
-    public void terminate()
-    {
-        shouldRun = false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ReflectionUtil.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ReflectionUtil.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ReflectionUtil.java
deleted file mode 100644
index bf12eb7..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/ReflectionUtil.java
+++ /dev/null
@@ -1,303 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.misc.util;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Collection;
-import java.util.Map;
-import java.util.TreeMap;
-
-
-
-public class ReflectionUtil
-{
-	/**
-     * Returns the values of all the public members in the specified object.
-     * The returned value has the format: member1 = value1, member2 = value2, ...
-     */
-	public static String toStringPublicMembers(Object object)
-    {
-        if (object == null) {
-            return null;
-        }
-
-        String retval = "";
-        Class cls = object.getClass();
-        Field fields[] = cls.getFields();
-        String name;
-        Object value;
-        try {
-            for (int i = 0; i < fields.length; i++) {
-                name = fields[i].getName();
-                value = fields[i].get(object);
-                if (value instanceof byte[]) {
-                    value = new String((byte[])value);
-                } else if (value instanceof Byte) {
-                    value = ((Byte)value).toString();
-                }
-                retval += name + " = " + value + ", ";
-            }
-        } catch (IllegalAccessException ex) {
-            ex.printStackTrace();
-        }
-
-        // Remove the trailing ", ".
-        if (retval.length() > 0) {
-            retval = retval.substring(0, retval.length() - 2);
-        }
-        return retval;
-    }
-
-    public static String toStringGetters(Object object)
-    {
-        if (object == null) {
-            return null;
-        }
-
-        String retval = "";
-        Class cls = object.getClass();
-        Method methods[] = cls.getMethods();
-        Method method;
-        Class retType;
-        String name;
-        Object value;
-        try {
-            for (int i = 0; i < methods.length; i++) {
-                method = methods[i];
-                name = method.getName();
-                if (name.length() <= 3 || name.startsWith("get") == false) {
-                    continue;
-                }
-                if ((method.getModifiers() & Modifier.STATIC) > 0) {
-                	continue;
-                }
-                if (name.equals("getClass")) {
-                	continue;
-                }
-                retType = method.getReturnType();
-                if (retType == Void.TYPE) {
-                    continue;
-                } 
-                try {
-                    value = method.invoke(object, (Object[])null);
-                    if (value instanceof byte[]) {
-                        value = new String((byte[])value);
-                    } else if (value instanceof Byte) {
-                        value = ((Byte)value).toString();
-                    }
-                    retval += name.substring(3) + " = " + value + ", ";
-                } catch (Exception ex) {
-                }
-            }
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-
-        // Remove the trailing ", ".
-        if (retval.length() > 0) {
-            retval = retval.substring(0, retval.length() - 2);
-        }
-        return retval;
-    }
-    
-    public static String toStringGettersAnd(Object object)
-    {
-        if (object == null) {
-            return null;
-        }
-
-        String retval = "";
-        Class cls = object.getClass();
-        Method methods[] = cls.getMethods();
-        Method method;
-        Class retType;
-        String name;
-        Object value;
-        try {
-            for (int i = 0; i < methods.length; i++) {
-                method = methods[i];
-                name = method.getName();
-                if (name.length() <= 3 || name.startsWith("get") == false) {
-                    continue;
-                }
-                if ((method.getModifiers() & Modifier.STATIC) > 0) {
-                	continue;
-                }
-                if (name.equals("getClass")) {
-                	continue;
-                }
-                retType = method.getReturnType();
-                if (retType == Void.TYPE) {
-                    continue;
-                } 
-                try {
-                    value = method.invoke(object, (Object[])null);
-                    if (value instanceof byte[]) {
-                        value = new String((byte[])value);
-                    } else if (value instanceof Byte) {
-                        value = ((Byte)value).toString();
-                    }
-                    if (value instanceof String) {
-                    	retval += name.substring(3) + "='" + value + "' and ";
-                    } else {
-                    	retval += name.substring(3) + "=" + value + " and ";
-                    }
-                } catch (Exception ex) {
-                }
-            }
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-
-        // Remove the trailing " and ".
-        if (retval.length() > 0) {
-            retval = retval.substring(0, retval.length() - 5);
-        }
-        return retval;
-    }
-    
-    public static String toStringSetters(Object object)
-    {
-        if (object == null) {
-            return null;
-        }
-
-        String retval = "";
-        Class cls = object.getClass();
-        Method methods[] = cls.getMethods();
-        Method method;
-        String name;
-        try {
-            for (int i = 0; i < methods.length; i++) {
-                method = methods[i];
-                name = method.getName();
-                if (name.length() <= 3 || name.startsWith("set") == false) {
-                    continue;
-                }
-                retval += name + ", ";
-            }
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-
-        // Remove the trailing ", ".
-        if (retval.length() > 0) {
-            retval = retval.substring(0, retval.length() - 2);
-        }
-        return retval;
-    }
-    
-    public static Method[] getAllSetters(Class cls)
-    {
-        Map map = getAllSettersMap(cls);
-        if (map == null) {
-        	return null;
-        }
-        Collection col = map.values();
-        return (Method[])col.toArray(new Method[0]);
-    }
-    
-    public static Map getAllSettersMap(Class cls)
-    {
-        if (cls == null) {
-            return null;
-        }
-        Method methods[] = cls.getMethods();
-        TreeMap map = new TreeMap();
-        Method method;
-        String name;
-        try {
-            for (int i = 0; i < methods.length; i++) {
-                method = methods[i];
-                name = method.getName();
-                if (name.length() <= 3 || name.startsWith("set") == false) {
-                    continue;
-                }
-               if (method.getParameterTypes().length == 1) {
-            	   map.put(method.getName(), method);
-               }
-            }
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-
-        return map;
-    }
-    
-    
-    public static Method[] getAllGetters(Class cls)
-    {
-		Map map = getAllGettersMap(cls);
-		if (map == null) {
-			return null;
-		}
-		Collection col = map.values();
-        return (Method[])col.toArray(new Method[0]);
-    }
-    
-    /**
-     * Returns Map<String, Method>
-     * @param cls
-     */
-    public static Map getAllGettersMap(Class cls)
-    {
-        if (cls == null) {
-            return null;
-        }
-        Method methods[] = cls.getMethods();
-        Method method;
-        Class retType;
-        String name;
-        TreeMap map = new TreeMap();
-        try {
-            for (int i = 0; i < methods.length; i++) {
-                method = methods[i];
-                name = method.getName();
-                if (name.length() <= 3 || name.startsWith("get") == false) {
-                    continue;
-                }
-                if ((method.getModifiers() & Modifier.STATIC) > 0) {
-                	continue;
-                }
-                if (name.equals("getClass")) {
-                	continue;
-                }
-                retType = method.getReturnType();
-                if (retType == Void.TYPE) {
-                    continue;
-                } 
-               if (method.getParameterTypes().length == 0) {
-            	   map.put(name, method);
-               }
-            }
-
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-
-        return map;
-    }
-    
-    /**
-     * 
-     * @param cls
-     * @return setter map
-     * @deprecated
-     *///FIXME: java docs @return, check if this is used?
-    public static Map getSetterMap(Class cls)
-    {
-    	TreeMap map = new TreeMap();
-    	Method methods[] = getAllSetters(cls);
-    	String memberName;
-    	for (int i = 0; i < methods.length; i++) {
-    		memberName = methods[i].getName();
-    		memberName = memberName.substring(3);
-    		map.put(memberName, methods[i]);
-    	}
-    	return map;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/StringUtil.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/StringUtil.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/StringUtil.java
deleted file mode 100644
index 2d97aef..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/StringUtil.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.misc.util;
-
-public class StringUtil
-{
-    /**
-     * Returns the short name of the fully-qualified class name.
-     * @param className The fully-qualified class name.
-     */
-    public static String getShortClassName(String className)
-    {
-        if (className == null) {
-            return null;
-        }
-        String shortName = null;
-        int index = className.lastIndexOf('.');
-        if (index == -1 || index >= className.length()-1) {
-            shortName = className;
-        } else {
-            shortName = className.substring(index+1);
-        }
-        return shortName;
-    }
-
-    /**
-     * Returns the short class name of the specified object.
-     * @param obj   The object from which its short name is to be derived.
-     */
-    public static String getShortClassName(Object obj)
-    {
-        if (obj == null) {
-            return null;
-        }
-        return getShortClassName(obj.getClass().getName());
-    }
-
-    /**
-     * Trims the matching character found in the left end of the string.
-     * @param str   The string to trim.
-     * @param c     The character remove.
-     */
-    public static String trimLeft(String str, char c)
-    {
-        int len = str.length();
-        int index = 0;
-        while (index < len && str.charAt(index++) == c);
-        index--;
-        if (index < 0) {
-            return "";
-        } else if (index < len) {
-            return str.substring(index);
-        } else {
-            return str;
-        }
-    }
-
-    /**
-     * Trims the matching character found in right end of the string.
-     * @param str   The string to trim.
-     * @param c     The character remove.
-     */
-    public static String trimRight(String str, char c)
-    {
-        int len = str.length();
-        int index = len - 1;
-        while (index >= 0 && str.charAt(index--) == c);
-        index++;
-        if (index > len - 1) {
-            return str;
-        } else if (index >= 0) {
-            return str.substring(0, index + 1);
-        } else  {
-            return "";
-        }
-    }
-
-    /**
-     * Trims all of the matching character in the string.
-     * @param str   The string to trim.
-     * @param c     The character remove.
-     */
-    public static String trim(String str, char c)
-    {
-        return trimRight(trimLeft(str, c), c);
-    }
-
-    /**
-     * Replaces the all of the matching oldValue in the string with the newValue.
-     * @param str   The string to replace matching substring.
-     * @param oldValue  The old value to match and replace.
-     * @param newValue  The new value to replace the old value with.
-     */
-    public static String replace(String str, String oldValue, String newValue)
-    {
-        if (str == null || oldValue == null || newValue == null) {
-            return null;
-        }
-
-        int index = str.indexOf(oldValue);
-        if (index != -1) {
-            int oldValueLen = oldValue.length();
-            int newValueLen = newValue.length();
-            String head;
-            String tail = str;
-            StringBuffer buffer = new StringBuffer(str.length() + newValueLen);
-            do {
-                head = tail.substring(0, index);
-                buffer.append(head);
-                buffer.append(newValue);
-                tail = tail.substring(index+oldValueLen);
-                index = tail.indexOf(oldValue);
-            } while (index != -1);
-            buffer.append(tail);
-
-            str = buffer.toString();
-        }
-
-        return str;
-    }
-    
-    public static String getLeftPaddedString(String value, int maxSize, char pad)
-	{
-		int diff = maxSize - value.length();
-		StringBuffer buffer = new StringBuffer(maxSize);
-		for (int i = 0; i < diff; i++) {
-			buffer.append(pad);
-		}
-		buffer.append(value);
-		return buffer.toString();
-	}
-	
-    public static String getRightPaddedString(String value, int maxSize, char pad)
-	{
-		int diff = maxSize - value.length();
-		StringBuffer buffer = new StringBuffer(maxSize);
-		buffer.append(value);
-		for (int i = 0; i < diff; i++) {
-			buffer.append(pad);
-		}
-		return buffer.toString();
-	}
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/SystemClassPathManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/SystemClassPathManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/SystemClassPathManager.java
deleted file mode 100644
index 0149aa8..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/misc/util/SystemClassPathManager.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.misc.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.internal.tools.gfsh.app.pogo.KeyType;
-import com.gemstone.gemfire.internal.tools.gfsh.app.pogo.KeyTypeManager;
-
-/**
- * SystemClassPathManager assigns the class path to the system class loader 
- * in runtime.
- * @author dpark
- *
- */
-public class SystemClassPathManager
-{
-	private static final Class[] parameters = new Class[] { URL.class };
-
-	public static void addFile(String s) throws IOException
-	{
-		File f = new File(s);
-		addFile(f);
-	}
-
-	public static void addFile(File f) throws IOException
-	{
-		addURL(f.toURI().toURL());
-	}
-
-	public static void addURL(URL u) throws IOException
-	{
-
-		URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
-		Class sysclass = URLClassLoader.class;
-
-		try {
-			Method method = sysclass.getDeclaredMethod("addURL", parameters);
-			method.setAccessible(true);
-			method.invoke(sysloader, new Object[] { u });
-		      } catch (VirtualMachineError e) {
-		        SystemFailure.initiateFailure(e);
-		        throw e;
-		      } catch (Throwable t) {
-		        SystemFailure.checkFailure();
-			t.printStackTrace();
-			throw new IOException("Error, could not add URL to system classloader");
-		}
-
-	}
-	
-	/**
-	 * Includes all of the jar files in the specified directory in the
-	 * class path. It first includes the latest dated jar files that end
-	 * with the extension '.vyyyyMMddHHmm.jar'. For example, if there are 
-	 * 'foo.v201010231217' and 'foo.v201010221011' then only the formal is 
-	 * added in the class path since it has the latest version date.
-	 * <p>
-	 * Once all of the date-versioned jar files are added, it then proceed
-	 * to add the rest of the jar files in sorted order.
-	 * <p>
-	 * It also auto registers versioned classes such as MapLite's KeyType.
-	 * 
-	 * @param dirPath The absolute or relative directory path.
-	 */
-	public static void addJarsInDir(String dirPath)
-	{
-		if (dirPath == null) {
-			return;
-		}
-		
-		File classDirFile = new File(dirPath);
-		classDirFile.mkdirs();
-		
-		ArrayList<String> jarList = new ArrayList();
-		File[] files = classDirFile.listFiles();
-		for (File file : files) {
-			if (file.isFile()) {
-				String fileName = file.getName();
-				jarList.add(file.getAbsolutePath());
-			}
-		}
-		
-		// Register the latest files only
-		Collections.sort(jarList);
-		String prevFileNameNoDate = "";
-		ArrayList<File> datedFiles = new ArrayList();
-		ArrayList<File> notDatedFiles = new ArrayList();
-		for (int i = jarList.size() - 1; i >= 0; i--) {
-			String filePath = jarList.get(i);
-			if (filePath.endsWith(".jar") == false) {
-				continue;
-			}
-			File file = new File(filePath);
-			String fileName = file.getName();
-			String nameNoExtension = fileName.substring(0, fileName.lastIndexOf(".jar"));
-			int index = nameNoExtension.lastIndexOf(".v");
-			if (index == -1) {
-				// not dated
-				notDatedFiles.add(file);
-				continue;
-			}
-			String fileNameNoDate = nameNoExtension.substring(0, index);
-			if (fileNameNoDate.equals(prevFileNameNoDate) == false) {
-				try {
-					SystemClassPathManager.addFile(file);
-					datedFiles.add(file);
-				} catch (IOException e) {
-					CacheFactory.getAnyInstance().getLogger().error(e);
-				}
-				prevFileNameNoDate = fileNameNoDate;
-			}
-		}
-		
-		// Add the not dated files - dated files take precedence
-		Collections.sort(notDatedFiles);
-		for (File file : notDatedFiles) {
-			try {
-				SystemClassPathManager.addFile(file);
-			} catch (IOException e) {
-				CacheFactory.getAnyInstance().getLogger().error(e);
-			}
-		}
-		
-		// Register KeyTypes for dated classes
-		registerKeyType(datedFiles);
-		
-		// Register KeyTypes for not dated classes
-		registerKeyType(notDatedFiles);
-		
-		// for gc
-		datedFiles.clear();
-		datedFiles = null;
-		notDatedFiles.clear();
-		notDatedFiles = null;
-		jarList.clear();
-		jarList = null;
-	}
-	
-	private static void registerKeyType(List<File> files)
-	{
-		for (File file : files) {
-			try {
-				Class[] classes = ClassFinder.getAllClasses(file.getAbsolutePath());
-				for (int j = 0; j < classes.length; j++) {
-					Class<?> cls = classes[j];
-					if (KeyType.class.isAssignableFrom(cls) && 
-						cls.getSimpleName().matches(".*_v\\d++$")) 
-					{
-						try {
-							Method method = cls.getMethod("getKeyType", (Class[])null);
-							KeyType keyType = (KeyType)method.invoke(cls, (Object[])null);
-							KeyTypeManager.registerSingleKeyType(keyType);
-						} catch (Exception ex) {
-							// ignore
-						}
-					}
-				}
-			} catch (Exception ex) {
-				// ignore
-			}
-		}	
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/InvalidKeyException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/InvalidKeyException.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/InvalidKeyException.java
deleted file mode 100644
index c8a098f..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/InvalidKeyException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.pogo;
-
-import com.gemstone.gemfire.GemFireException;
-
-/**
- * InvalidKeyException is a runtime exception thrown if the key type 
- * is invalid. This can occur when the incorrect type value is put in
- * the message (MapLite) class.
- *   
- * @author dpark
- *
- */
-public class InvalidKeyException extends GemFireException
-{
-	private static final long serialVersionUID = 1L;
-
-	/**
-	 * Creates a new <code>InvalidKeyException</code> with the specified 
-	 * message.
-	 */
-	public InvalidKeyException(String message)
-	{
-		super(message);
-	}
-
-	/**
-	 * Creates a new <code>InvalidKeyException</code> wit the specified
-	 * message and exception.
-	 */
-	public InvalidKeyException(String message, Throwable ex)
-	{
-		super(message, ex);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyType.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyType.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyType.java
deleted file mode 100644
index 054488a..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyType.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.pogo;
-
-import java.util.Set;
-
-/**
- * KeyType represents the schema definitions for predefining keys for
- * lightweight self-describing message classes such as MapLite provided
- * in this package. 
- * @author dpark
- *
- */
-public interface KeyType
-{
-	/**
-	 * Return the universal ID that uniquely represents the key type across
-	 * space and time. The underlying message class implementation must 
-	 * guarantee the uniqueness of this ID to properly marshal objects 
-	 * crossing network and language boundaries. This ID is static and
-	 * permanent for the life of the key type class. 
-	 */
-	public Object getId();
-	
-	/**
-	 * Returns the version number.
-	 */
-	public int getVersion();
-	
-	/**
-	 * Returns the key count.
-	 */
-	public int getKeyCount();
-	
-	/**
-	 * Returns the index of the key.
-	 */
-	public int getIndex();
-	
-	/**
-	 * Returns the name of the key.
-	 */
-	public String getName();
-	
-	/**
-	 * Returns the class of the key.
-	 */
-	public Class getType();
-	
-	/**
-	 * Returns the entire keys.
-	 */
-	public KeyType[] getValues();
-	
-	/**
-	 * Returns the entire keys of the specified version.
-	 * @param version The version number.
-	 */
-	public KeyType[] getValues(int version);
-
-	/**
-	 * Returns the key of the specified key name.
-	 * @param name The key name.
-	 */
-	public KeyType getKeyType(String name);
-	
-	/**
-	 * Returns true if delta propagation is enabled.
-	 */
-	public boolean isDeltaEnabled();
-	
-	/**
-	 * Returns true if the key value is to be kept serialized until
-	 * it is accessed. This applies per key instance.
-	 */
-	public boolean isKeyKeepSerialized();
-	
-	/**
-	 * Returns true if the network payload is to be compressed.
-	 */
-	public boolean isCompressionEnabled();
-	
-	/**
-	 * Returns true if any of the key values is to be kept serialized.
-	 */
-	public boolean isPayloadKeepSerialized();
-	
-	/**
-	 * Returns the key name set.
-	 */
-	public Set<String> getNameSet();
-	
-	/**
-	 * Returns true if the specified key is defined.
-	 * @param name The key to check.
-	 */
-	public boolean containsKey(String name);
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyTypeManager.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyTypeManager.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyTypeManager.java
deleted file mode 100644
index 5794c88..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/KeyTypeManager.java
+++ /dev/null
@@ -1,199 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.pogo;
-
-import java.lang.reflect.Field;
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.gemstone.gemfire.DataSerializable;
-import com.gemstone.gemfire.Instantiator;
-
-/**
- * KeyTypeManager manages the key type classes for the process life time.
- * Each key type class requires registration through KeyTypeManager in
- * order to activate them within the process boundary. Using a key type 
- * without registering may fail as the underlying marshaling mechanism is 
- * maybe unable to properly map the key type.
- * 
- * @author dpark
- *
- */
-public class KeyTypeManager
-{
-	
-	/**
-	 * Map of key types.
-	 */
-	private static ConcurrentHashMap<UUID, Map<Integer, KeyType>> uuidMap = new ConcurrentHashMap<UUID, Map<Integer, KeyType>>();
-	
-	/**
-	 * Registers the specified key type. It assumes that all of the KeyType
-	 * version classes are in the "pogo" sub-package as the specified KeyType.
-	 * @param keyTypeName The fully qualified KeyType class name without
-	 *                      the version number, i.e., com.foo.orders.FOrder 
-	 *                      as opposed to com.foo.orders.pogo.FOrder_v1.
-	 */
-//FindBugs - private method never called
-//	private static void registerKeyType(String keyTypeName)
-//	{
-//		if (keyTypeName == null) {
-//			return;
-//		}
-//		Class cls;
-//		try {
-//			cls = Class.forName(keyTypeName);
-//			KeyType keyType = (KeyType)cls.newInstance();
-//			registerKeyType(keyType);
-//		} catch (Exception e) {
-//			// ignore
-//		}
-//	}
-	
-	/**
-	 * Registers the specified key type and all of the previous versions.
-	 * A key type must be registered before it can be used by the application.
-	 * @param keyType The key type to register.
-	 */
-	public static void registerKeyType(KeyType keyType)
-	{
-		if (keyType == null) {
-			return;
-		}
-		
-		registerSingleKeyType(keyType);
-		
-		Package pkg = keyType.getClass().getPackage();
-		String keyTypeName;
-		if (pkg == null) {
-			keyTypeName = "pogo." + keyType.getClass().getSimpleName();
-		} else {
-			keyTypeName = pkg.getName() + ".pogo." + keyType.getClass().getSimpleName();
-		}
-		
-		int version = keyType.getVersion();
-		do {
-			try {
-				Class cls = Class.forName(keyTypeName + "_v" + version);
-				if (cls.isEnum() == false) {
-					break;
-				}
-				Object[] consts = cls.getEnumConstants();
-				if (consts != null && consts.length > 0 && consts[0] instanceof KeyType) {
-					KeyType ft = (KeyType)consts[0];
-					registerSingleKeyType(ft);
-				}
-			} catch (ClassNotFoundException e) {
-				break;
-			}
-			version--;
-			
-		} while (true);
-	}
-	
-	/**
-	 * Registers the specified key type only. It will not register the 
-	 * previous versions.
-	 * @param keyType The key type to register
-	 */
-	public static void registerSingleKeyType(KeyType keyType)
-	{
-		if (keyType == null) {
-			return;
-		}
-		Map<Integer, KeyType> map = uuidMap.get(keyType.getId());
-		if (map == null) {
-			map = new TreeMap<Integer, KeyType>();
-			uuidMap.put((UUID)keyType.getId(), map);
-		}
-		map.put(keyType.getVersion(), keyType);
-	}
-	
-	/**
-	 * Returns true if the specified key type has been registered previously.
-	 * @param keyType The key type to check.
-	 */
-	public static boolean isRegistered(KeyType keyType)
-	{
-		if (keyType == null) {
-			return false;
-		}
-		Map<Integer, KeyType> map = uuidMap.get(keyType.getId());
-		if (map == null) {
-			return false;
-		}
-		return map.get(keyType.getVersion()) != null;
-	}
-	
-	/**
-	 * Loads a new key type. The main key type points to this key
-	 * type.
-	 * Experimental - NOT USED
-	 * @param keyType
-	 */
-	private static void loadKeyType(KeyType keyType)
-	{
-		registerKeyType(keyType);
-		Package pkg = keyType.getClass().getPackage();
-		String keyTypeName = pkg.getName() + keyType.getClass().getSimpleName();
-		try {
-			Class cls = Class.forName(keyTypeName);
-			Field field = cls.getField("VERSION");
-			field.setInt(field, keyType.getVersion());
-		} catch (ClassNotFoundException e) {
-			return;
-		} catch (NoSuchFieldException e) {
-			return;
-		} catch (IllegalAccessException e) {
-			return;
-		}
-	}
-	
-	/**
-	 * Returns the key type of the specified UUID most significant bits,
-	 * least significant bits and version.
-	 * 
-	 * @param uuidMostSigBits The most significant bits.
-	 * @param uuidLeastSigBits The least significant bits.
-	 * @param version The version number.
-	 * @return Returns the key type of the specified UUID most significant
-	 *         bits, least significant bits and version. It returns null if 
-	 *         the key type is not found.
-	 */
-	public static KeyType getKeyType(long uuidMostSigBits, long uuidLeastSigBits, int version)
-	{
-		return getKeyType(new UUID(uuidMostSigBits, uuidLeastSigBits), version);
-	}
-	
-	/**
-	 * Returns the key type of the specified UUID and version.
-	 * @param uuid The UUID representing the key type.
-	 * @param version The version number.
-	 * @return Returns the key type of the specified UUID and version. It
-	 *         returns null if the key type is not found.
-	 */
-	public static KeyType getKeyType(UUID uuid, int version)
-	{
-		Map<Integer, KeyType> map = uuidMap.get(uuid);
-		if (map == null) {
-			return null;
-		}
-		return map.get(version);
-	}
-	
-	/**
-	 * Returns the entire key type instances of the specified version.
-	 * @param keyType The key type.
-	 * @param version The version number.
-	 * @return Returns the entire key type instances of the specified version.
-	 *         It returns null if the key types are not found.
-	 */
-	public static KeyType[] getValues(KeyType keyType, int version)
-	{
-		KeyType ft = getKeyType((UUID)keyType.getId(), version);
-		if (ft == null) {
-			return null;
-		}
-		return ft.getValues();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/49d99d4e/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/MapLite.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/MapLite.java b/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/MapLite.java
deleted file mode 100644
index b792147..0000000
--- a/gemfire-core/src/main/java/com/gemstone/gemfire/internal/tools/gfsh/app/pogo/MapLite.java
+++ /dev/null
@@ -1,1136 +0,0 @@
-package com.gemstone.gemfire.internal.tools.gfsh.app.pogo;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInput;
-import java.io.DataInputStream;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.UUID;
-
-import com.gemstone.gemfire.DataSerializable;
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.Delta;
-import com.gemstone.gemfire.InvalidDeltaException;
-import com.gemstone.gemfire.internal.HeapDataOutputStream;
-import com.gemstone.gemfire.internal.Version;
-
-/**
- * MapLite is a GemFire data class for efficiently storing and retrieving data
- * to/from GemFire data fabrics. It is a lightweight map class designed for
- * delivering self-describing messages over the network without the cost of
- * embedded keys in the wire format. MapLite achieves this by predefining the
- * keys in the form of enum (and String) constants and deploying them as part of
- * the application binary classes. The enum key classes are automatically
- * versioned and generated using the provided IDE plug-in, ensuring full
- * compatibility and coexistence with other versions.
- * <p>
- * In addition to the code generator, MapLite includes the following GemFire
- * cache optimization and operational features while maintaining the same level
- * of self-describing message accessibility.
- * <p>
- * <ul>
- * <li>MapLite is fully POGO compliant.</li>
- * <li>MapLite implements {@link java.util.Map}.</li>
- * <li>MapLite and POGO are in general significantly lighter than POJO and
- * {@link HashMap}. Its wire format is compact and does not require class
- * reflection.</li>
- * <li>MapLite and POGO are faster than POJO and HashMap. Its smaller payload
- * size means it is serialized and delivered faster.</li>
- * <li>MapLite lookup is faster than HashMap. MapLite keeps values internally
- * indexed in an array for faster access.</li>
- * <li>MapLite fully supports GemFire delta propagation.
- * <li>MapLite fully supports selective key inflation (SKI). With SKI, the
- * underlying POGO mechanism inflates only the values that are accessed by the
- * application. The rest of the values are kept deflated until they are
- * accessed. This reduces the memory footprint and eliminates the unnecessary
- * latency overhead introduced by the serialization and deserialization
- * operations.</li>
- * <li>MapLite fully supports the GemFire query service.</li>
- * <li>MapLite is fully integrated with the key class versioning mechanism,
- * which enables multiple versions of MapLite key sets to coexist in the fabric.
- * All versioned key classes are fully forward and backward compatible.</li>
- * <li>MapLite key classes are universally unique across space and time,
- * eradicating the class ID requirement.</li>
- * <li>MapLite is natively integrated with the GemFire command line tool, gfsh.</li>
- * <li>MapLite is language neutral.</li>
- * </ul>
- * <p>
- * <h3>Lighter and Faster</h3>
- * MapLite, in general, is significantly lighter than HashMap in terms of both
- * size and speed. The size of a typical serialized MapLite object is
- * considerably smaller than the counterpart HashMap object. Enum
- * {@link #get(KeyType)} calls are faster than
- * {@link HashMap#get(Object)} because the values are indexed in an
- * array, circumventing the more expensive hash lookup operation.
- * 
- * <h3>Map with enum KeyType Keys</h3>
- * MapLite implements Map and therefore has the same Map methods and behaves
- * exactly like Map. Unlike HashMap which also implements Map, a MapLite object
- * is restricted to a fixed set of predefined keys in an enum class that
- * implements the interface KeyType. This restriction effectively makes MapLite
- * lighter, faster, and more acquiescent than HashMap. It removes the keys from
- * the wire format and provides a valid key list for strict allowed key and type
- * checking.
- * 
- * <h3>Code Generator</h3>
- * Editing keys, although it can be done manually, is done via the provided IDE
- * plug-in which automatically generates a new version of the enum class. The
- * built-in versioning mechanism allows the new versioned enum class to be
- * deployed to the servers and clients during runtime without the requirement of
- * restarting them. The servers automatically load the new versioned class
- * making it immediately available to the application along with the previous
- * versions.
- * 
- * <h3>String Keys</h3>
- * In addition to the enum keys, MapLite also supports String keys. String keys
- * are costlier than enum keys but comparable to HashMap in terms of the put and
- * get speeds. One of the benefits of using String keys is the flexibility of
- * executing ad hoc queries. MapLite is fully compliant with the GemFire query
- * service, making it ideal for object-relational mapping.
- * 
- * <p>
- * <h3>Using MapLite</h3>
- * <ol>
- * <li>
- * Create a <code>{@link KeyType}</code> enum class using the code generator or
- * the provided example template.</li>
- * <li>
- * Register the new <code>KeyType</code> enum class using
- * <code>{@link KeyTypeManager}</code>.</li>
- * <li>
- * Use <code>KeyType</code> to create <code>MapLite</code> objects. Always use
- * {@link #MapLite(KeyType)} to create <code>MapLite</code> objects.</li>
- * <li>
- * Put the MapLite objects into cache regions</li>
- * <li>
- * Get the MapLite objects from cache regions</li>
- * <li>
- * Get values from the objects using <code>KeyType</code> or <code>String</code>
- * keys</li>
- * </ol>
- * 
- * <h3>Examples</h3>
- * 
- * <pre>
- * import com.gemstone.gemfire.internal.tools.gfsh.pogo.KeyTypeManager;
- * import com.gemstone.gemfire.internal.tools.gfsh.pogo.MapLite;
- * import gemfire.examples.model.Dummy;
- * import gemfre.examples.model.pogo.Dummy_v1;
- * import gemfire.examples.model.pogo.Dummy_v2;
- * 
- * . . .
- *  
- * // Register the Dummy key type. This also registers
- * // all of the versions in the sub-package pogo. This registration
- * // call is not is not required if the registration plug-in
- * // is included in the GemFire cache.xml file.
- * KeyTypeManager.registerKeyType(Dummy.getKeyType());
- * 
- * // Create a MapLite object using the latest Dummy version.
- * // Dummy is equivalent to Dummy_v2 assuming that Dummy_v2 is the
- * // latest version.
- * MapLite ml = new MapLite(Dummy.getKeyType());
- * 
- * // put data using the Dummy.Message enum constant
- * ml.put(Dummy.Message, "Hello, world.");
- * 
- * // put data using the string key "Dummy" which is equivalent to
- * // Dummy.Message
- * ml.put("Message", "Hello, world.");
- * 
- * // Get the value using the Dummy.Message enum constant
- * String message = (String) ml.get(Dummy.Message);
- * 
- * // Get the value using the versioned enum class Dummy_v2 which is
- * // equivalent to Dummy assuming Dummy_v2 is the latest version.
- * message = (String) ml.get(Dummy_v2.Message);
- * 
- * // Get the value using the previous versioned class Dummy_v1 which
- * // may or may not work depending on the changes made to version 2.
- * // If the Message key type has been changed then the type cast will
- * // fail.
- * message = (String) ml.get(Dummy_v1.Message);
- * 
- * // Get the value using the string key "Message".
- * message = (String) ml.get("Message");
- * </pre>
- * 
- * @author dpark
- * 
- */
-public class MapLite<V> implements DataSerializable, Delta, Map<String, V>, Cloneable
-{
-	private static final long serialVersionUID = 1L;
-
-	private static final int BIT_MASK_SIZE = 32; // int type
-
-	private KeyType keyType;
-	private Object[] values;
-	private int keyVersion;
-	private int[] dirtyFlags;
-	private byte flags;
-
-	// serialized values
-	private byte[] serializedBytes;
-
-	/**
-	 * <font COLOR="#ff0000"><strong>The use of this constructor is strongly
-	 * discouraged. Always use {@link #MapLite(KeyType)} wherever
-	 * possible.</strong></font>
-	 * <p>
-	 * The default constructor creates a new MapLite object with KeyType
-	 * undefined. Undefined KeyType may lead to undesired effects. The following
-	 * restriction applies when using this constructor:
-	 * 
-	 * <blockquote><i> {@link #put(KeyType, Object)} or {@link #get(KeyType)}
-	 * must be invoked once with a {@link KeyType} enum constant before the
-	 * MapLite object can be used. These methods implicitly initialize the
-	 * MapLite object with the specified key type. MapLite ignores String keys
-	 * until the key type has been assigned. </i></blockquote>
-	 * 
-	 * An exception to the above restriction is {@link #putAll(Map)} with the
-	 * argument type of MapLite. If MapLite is passed in, then putAll()
-	 * transforms this <i>empty</i> MapLite object into the passed-in MapLite
-	 * key type.
-	 * <p>
-	 * It is recommended that the overloaded constructor
-	 * {@link #MapLite(KeyType)} should always be used wherever possible. This
-	 * default constructor is primarily for satisfying Java serialization
-	 * restrictions in addition to handling special operations such as putAll().
-	 * 
-	 */
-	public MapLite()
-	{
-	}
-
-	/**
-	 * Creates a new MapLite object with the specified key type. Once created,
-	 * all subsequent operations must use the same <code>KeyType</code> enum
-	 * class. The key type is obtained from the <i>no-arg</i> static method,
-	 * <code>getKeyType()</code>, included in the generated key type class. For
-	 * example,
-	 * 
-	 * <pre>
-	 * MapLite ml = new MapLite(Dummy.getKeyType());
-	 * </pre>
-	 * 
-	 * @param keyType
-	 *            The key type enum constant to assign to MapLite.
-	 */
-	public MapLite(KeyType keyType)
-	{
-		init(keyType);
-	}
-
-	/**
-	 * Initializes the MapLite object by creating data structures for the
-	 * specified key type.
-	 * 
-	 * @param keyType
-	 *            The key type enum constant to assign to MapLite.
-	 */
-	private void init(KeyType keyType)
-	{
-		if (keyType == null) {
-			return;
-		}
-		this.keyType = keyType;
-		this.keyVersion = keyType.getVersion();
-		int count = keyType.getKeyCount();
-		this.values = new Object[count];
-		int dirtyFlagCount = calculateDirtyFlagCount();
-		this.dirtyFlags = new int[dirtyFlagCount];
-
-		if (KeyTypeManager.isRegistered(keyType) == false) {
-			KeyTypeManager.registerKeyType(keyType);
-		}
-	}
-
-	/**
-	 * Calculates the dirty flag count. The dirty flags are kept in an array of
-	 * integers. Each integer value represents 32 dirty flags.
-	 * 
-	 * @return Returns the dirty flag count.
-	 */
-	private int calculateDirtyFlagCount()
-	{
-		int count = keyType.getKeyCount();
-		int dirtyFlagCount = count / BIT_MASK_SIZE;
-		int reminder = count % BIT_MASK_SIZE;
-		if (reminder > 0) {
-			dirtyFlagCount++;
-		}
-		return dirtyFlagCount;
-	}
-
-	/**
-	 * Marks all keys dirty.
-	 */
-	private void dirtyAllKeys()
-	{
-		if (dirtyFlags != null) {
-			for (int i = 0; i < dirtyFlags.length; i++) {
-				dirtyFlags[i] = 0xFFFFFFFF;
-			}
-		}
-	}
-
-	/**
-	 * Clears the entire dirty flags.
-	 */
-	private void clearDirty()
-	{
-		if (dirtyFlags != null) {
-			for (int i = 0; i < dirtyFlags.length; i++) {
-				dirtyFlags[i] = 0x0;
-			}
-		}
-	}
-
-	/**
-	 * Returns the key type constant used to initialize this object.
-	 */
-	public KeyType getKeyType()
-	{
-		return keyType;
-	}
-
-	/**
-	 * Returns the value of the specified key type. If the default constructor
-	 * {@link #MapLite()} is used to create this object then this method
-	 * implicitly initializes itself with the specified key type if it has not
-	 * been initialized previously.
-	 * 
-	 * @param keyType
-	 *            The key type constant to lookup the mapped value.
-	 * @return Returns the mapped value. It returns null if the value does not
-	 *         exist or it was explicitly set to null.
-	 */
-	public V get(KeyType keyType)
-	{
-		if (keyType == null) {
-			return null;
-		}
-
-		// Initialization is not thread safe.
-		// It allows the use of the default constructor but at
-		// the expense of the lack of thread safety.
-		if (values == null && keyType != null) {
-			init(keyType);
-		}
-
-		return (V) values[keyType.getIndex()];
-	}
-
-	/**
-	 * Puts the specified value mapped by the specified key type into this
-	 * object. If the default constructor {@link #MapLite()} is used to create
-	 * this object then this method implicitly initializes itself with the
-	 * specified key type if it has not been initialized previously.
-	 * <p>
-	 * Note that for MapLite to be language neutral, the value type must 
-	 * be a valid POGO type. It must be strictly enforced by the application.
-	 * For Java only applications, any Serializable objects are valid.
-	 * 
-	 * @param keyType
-	 *            The key type constant to lookup the mapped value.
-	 * @param value
-	 *            The value to put into the MapLite object.
-	 * @return Returns the old value. It returns null if the old value does not
-	 *         exist or has been explicitly set to null.
-	 * @throws InvalidKeyException
-	 *             A runtime exception thrown if the passed in value type does
-	 *             not match the key type.
-	 */
-	public V put(KeyType keyType, V value) throws InvalidKeyException
-	{
-		if (keyType == null) {
-			return null;
-		}
-
-		// Initialization is not thread safe.
-		// It allows the use of the default constructor but at
-		// the expense of the lack of thread safety.
-		if (values == null) {
-			init(keyType);
-		}
-		
-		V oldVal = (V) values[keyType.getIndex()];
-		values[keyType.getIndex()] = value;
-		
-		setDirty(keyType, dirtyFlags);
-		return oldVal;
-	}
-
-	/**
-	 * Returns the mapped value for the specified key. It uses the String value
-	 * of the key, i.e., key.toString(), to lookup the mapped value.
-	 * 
-	 * @param key
-	 *            The key object.
-	 */
-	public V get(Object key)
-	{
-		if (keyType == null || key == null) {
-			return null;
-		}
-		deserialize();
-		KeyType keyType = this.keyType.getKeyType(key.toString());
-		if (keyType == null) {
-			return null;
-		}
-		return get(keyType);
-	}
-
-	/**
-	 * Puts the specified value mapped by the specified key into this object.
-	 * Unlike {@link #put(KeyType, Object)}, this method will not implicitly
-	 * initialize this object if the default constructor is used. If this object
-	 * has not bee initialized, then it throws a runtime exception
-	 * InvalidKeyException.
-	 * 
-	 * @param key
-	 *            The key object.
-	 * @param value
-	 *            The value to put into the MapLite object.
-	 * @return Returns the old value.
-	 */
-	public V put(String key, V value) throws InvalidKeyException
-	{
-		if (keyType == null) {
-			if (value == null) {
-				throw new InvalidKeyException("KeyType undefined due to the use of the MapLite default constructor. "
-						+ "Use MapLite(KeyType) to register the key type.");
-			} else {
-				throw new InvalidKeyException("Invalid " + value.getClass().getName()
-						+ ". KeyType undefined due to the use of the default constructor.");
-			}
-		}
-		deserialize();
-		KeyType keyType = this.keyType.getKeyType(key.toString());
-		if (keyType == null) {
-			return null;
-		}
-		return put(keyType, value);
-	}
-
-	/**
-	 * Returns true if GemFire delta propagation is enabled and there are
-	 * changes in values.
-	 */
-	public boolean hasDelta()
-	{
-		if (keyType.isDeltaEnabled()) {
-			return isDirty();
-		}
-		return false;
-	}
-
-	/**
-	 * Returns true if there are changes made in values.
-	 */
-	public boolean isDirty()
-	{
-		for (int i = 0; i < dirtyFlags.length; i++) {
-			if ((dirtyFlags[i] & 0xFFFFFFFF) != 0) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * Sets the specified key type dirty.
-	 * 
-	 * @param keyType
-	 *            The key type to set dirty.
-	 * @param flags
-	 *            The flags that contain the key type.
-	 */
-	private void setDirty(KeyType keyType, int flags[])
-	{
-		int index = keyType.getIndex();
-		setDirty(index, flags);
-	}
-
-	/**
-	 * Sets the specified contiguous bit of the flags. A contiguous bit is the
-	 * bit number of the contiguous array integers. For example, if the flags
-	 * array size is 2 then the contiguous bit of 32 represents the first bit of
-	 * the flags[1] integer, 33 represents the second bit, and etc.
-	 * 
-	 * @param contiguousBit
-	 *            The contiguous bit position.
-	 * @param flags
-	 *            The bit flags.
-	 */
-	private void setDirty(int contiguousBit, int flags[])
-	{
-		int dirtyFlagsIndex = contiguousBit / BIT_MASK_SIZE;
-		int bit = contiguousBit % BIT_MASK_SIZE;
-		flags[dirtyFlagsIndex] |= 1 << bit;
-	}
-
-	/**
-	 * Returns true if the specified key type is dirty.
-	 * 
-	 * @param keyType
-	 *            The key type to check.
-	 * @param flags
-	 *            The flags that contain the key type.
-	 */
-//FindBugs - private method never called
-//	private boolean isBitDirty(KeyType keyType, int flags[])
-//	{
-//		int index = keyType.getIndex();
-//		int dirtyFlagsIndex = index / BIT_MASK_SIZE;
-//		int bit = index % BIT_MASK_SIZE;
-//		return isBitDirty(flags[dirtyFlagsIndex], bit);
-//	}
-
-	/**
-	 * Returns true if the specified contiguous bit of the flags is set. A
-	 * contiguous bit the bit number of the contiguous array integers. For
-	 * example, if the flags array size is 2 then the contiguous bit of 32
-	 * represents the first bit of the flags[1] integer, 33 represents the
-	 * second bit, and etc.
-	 * 
-	 * @param contiguousBit
-	 *            The contiguous bit position
-	 * @param flags
-	 *            The bit flags
-	 */
-//FindBugs - private method never called
-//	private boolean isDirty(int contiguousBit, int flags[])
-//	{
-//		int dirtyFlagsIndex = contiguousBit / BIT_MASK_SIZE;
-//		int bit = contiguousBit % BIT_MASK_SIZE;
-//		return isBitDirty(flags[dirtyFlagsIndex], bit);
-//	}
-
-	/**
-	 * Returns true if the specified flag bit id dirty.
-	 * 
-	 * @param flag
-	 *            The flag to check.
-	 * @param bit
-	 *            The bit to compare.
-	 * @return true if the specified flag bit id dirty.
-	 */
-	private boolean isBitDirty(int flag, int bit)
-	{
-		return ((flag >> bit) & 1) == 1;
-	}
-
-	/**
-	 * Returns true if the any of the flag bits is dirty.
-	 * 
-	 * @param flag
-	 *            The flag to check.
-	 */
-	private boolean isDirty(int flag)
-	{
-		return (flag & 0xFFFFFFFF) != 0;
-	}
-
-	/**
-	 * Deserializes (inflates) the serialized bytes if has not been done.
-	 */
-	private void deserialize()
-	{
-		byte[] byteArray = serializedBytes;
-		if (byteArray != null) {
-			KeyType[] keyTypeValues = keyType.getValues(keyVersion);
-			ByteArrayInputStream bais = new ByteArrayInputStream(byteArray);
-			DataInputStream dis = new DataInputStream(bais);
-			try {
-				for (int i = 0; i < keyTypeValues.length; i++) {
-					if (keyTypeValues[i].isKeyKeepSerialized()) {
-						// deserialized values
-						values[i] = readValue(keyTypeValues, i, dis);
-					}
-				}
-				dis.close();
-				serializedBytes = null;
-			} catch (IOException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			} catch (ClassNotFoundException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
-
-	/**
-	 * Reads the value at for the specified key type index.
-	 * 
-	 * @param keyTypes
-	 *            The entire key types that represent the MapLite values.
-	 * @param index
-	 *            The index of the key to read.
-	 * @param input
-	 *            The input stream.
-	 * @return Returns the read value.
-	 * @throws IOException
-	 *             Thrown if an IO error encountered.
-	 * @throws ClassNotFoundException
-	 */
-	private Object readValue(KeyType[] keyTypes, int index, DataInput input) throws IOException, ClassNotFoundException
-	{
-		return MapLiteSerializer.read(keyTypes[index].getType(), input);
-	}
-
-	/**
-	 * Reads MapLite contents in the specified input stream.
-	 * 
-	 * @param input
-	 *            The input stream.
-	 * @throws IOException
-	 *             Thrown if an IO error encountered.
-	 * @throws ClassNotFoundException
-	 *             Thrown if the input stream contains the wrong class type.
-	 *             This should never occur with MapLite.
-	 */
-	public void fromData(DataInput input) throws IOException, ClassNotFoundException
-	{
-		flags = MapLiteSerializer.readByte(input);
-		long mostSigBits = input.readLong();
-		long leastSigBits = input.readLong();
-		keyVersion = DataSerializer.readUnsignedShort(input);
-		keyType = KeyTypeManager.getKeyType(mostSigBits, leastSigBits, keyVersion);
-		init(keyType);
-		values = new Object[keyType.getKeyCount()];
-		KeyType[] keyTypeValues = keyType.getValues(keyVersion);
-		if (keyType.isPayloadKeepSerialized()) {
-			// need not to lock since fromData is invoked only
-			// once by GemFire
-			serializedBytes = DataSerializer.readByteArray(input);
-			byte[] deserializedBytes = DataSerializer.readByteArray(input);
-			ByteArrayInputStream bais = new ByteArrayInputStream(deserializedBytes);
-			DataInputStream dis = new DataInputStream(bais);
-			for (int i = 0; i < keyTypeValues.length; i++) {
-				if (keyTypeValues[i].isKeyKeepSerialized() == false) {
-					// deserialized values
-					values[i] = readValue(keyTypeValues, i, dis);
-				}
-			}
-			dis.close();
-		} else {
-			for (int i = 0; i < keyTypeValues.length; i++) {
-				values[i] = readValue(keyTypeValues, i, input);
-			}
-		}
-	}
-
-	/**
-	 * Writes the value of the specified index to the output stream.
-	 * 
-	 * @param keyTypes
-	 *            The entire key types that represent the MapLite values.
-	 * @param index
-	 *            The index of the key to write.
-	 * @param output
-	 *            The output stream.
-	 * @throws IOException
-	 *             Thrown if an IO error encountered.
-	 */
-	private void writeValue(KeyType[] keyTypes, int index, DataOutput output) throws IOException
-	{
-		try {
-			MapLiteSerializer.write(keyTypes[index].getType(), values[index], output);
-		} catch (Exception ex) {
-			throw new InvalidKeyException(ex.getMessage() + keyTypes.getClass() + " index=" + keyTypes[index].getName(), ex);
-		}
-	}
-
-	/**
-	 * Writes the MapLite contents to the specified output stream.
-	 * 
-	 * @param output
-	 *            The output stream.
-	 * @throws IOException
-	 *             Thrown if an IO error encountered.
-	 */
-	public void toData(DataOutput output) throws IOException
-	{
-		MapLiteSerializer.writeByte(flags, output);
-		output.writeLong(((UUID) keyType.getId()).getMostSignificantBits());
-		output.writeLong(((UUID) keyType.getId()).getLeastSignificantBits());
-		DataSerializer.writeUnsignedShort(keyType.getVersion(), output);
-		KeyType[] keyTypeValues = keyType.getValues(keyVersion);
-		if (keyType.isPayloadKeepSerialized()) {
-			// assign byteArray to serializedBytes beforehand to
-			// handle race condition
-			byte[] byteArray = serializedBytes;
-			if (byteArray != null) {
-				DataSerializer.writeByteArray(byteArray, output);
-				HeapDataOutputStream hdos2 = new HeapDataOutputStream(Version.CURRENT);
-				for (int i = 0; i < keyTypeValues.length; i++) {
-					if (keyTypeValues[i].isKeyKeepSerialized() == false) {
-						// keep it separate in deserialized array.
-						// this array is always deserialized
-						writeValue(keyTypeValues, i, hdos2);
-					}
-				}
-				DataSerializer.writeByteArray(hdos2.toByteArray(), output);
-				hdos2.close();
-			} else {
-				HeapDataOutputStream hdos = new HeapDataOutputStream(Version.CURRENT);
-				HeapDataOutputStream hdos2 = new HeapDataOutputStream(Version.CURRENT);
-				for (int i = 0; i < keyTypeValues.length; i++) {
-					if (keyTypeValues[i].isKeyKeepSerialized()) {
-						// serialize in the normal array
-						// the normal array is deserialized only when the
-						// one of its keys is accessed.
-						writeValue(keyTypeValues, i, hdos);
-					} else {
-						// keep it separate in deserialized array.
-						// this array is always deserialized
-						writeValue(keyTypeValues, i, hdos2);
-					}
-				}
-				DataSerializer.writeByteArray(hdos.toByteArray(), output);
-				DataSerializer.writeByteArray(hdos2.toByteArray(), output);
-				hdos.close();
-				hdos2.close();
-			}
-		} else {
-			for (int i = 0; i < keyTypeValues.length; i++) {
-				writeValue(keyTypeValues, i, output);
-			}
-		}
-		clearDirty();
-	}
-
-	/**
-	 * Reads deltas from the specified input stream.
-	 * 
-	 * @param input
-	 *            The input stream.
-	 * @throws IOException
-	 *             Thrown if an IO error encountered.
-	 * @throws InvalidDeltaException
-	 *             Thrown if the received deltas cannot be properly applied.
-	 */
-	public void fromDelta(DataInput input) throws IOException, InvalidDeltaException
-	{
-		KeyType[] keyTypeValues = keyType.getValues();
-		int bitCount = keyTypeValues.length;
-		int dirtyFlagCount = dirtyFlags.length;
-
-		int dirtyFlagsToApply[] = new int[dirtyFlagCount];
-		for (int i = 0; i < dirtyFlagCount; i++) {
-			dirtyFlagsToApply[i] = input.readInt();
-			// CacheFactory.getAnyInstance().getLogger().info("dirty = " +
-			// dirtyFlagsToApply[i]);
-		}
-
-		try {
-			int count = BIT_MASK_SIZE; // int
-			for (int i = 0; i < dirtyFlagsToApply.length; i++) {
-				int dirty = dirtyFlagsToApply[i]; // received dirty
-				int userDirty = dirtyFlags[i]; // app dirty
-				if (i == dirtyFlagsToApply.length - 1) {
-					count = bitCount % BIT_MASK_SIZE;
-					if (count == 0 && bitCount != 0) {
-						count = BIT_MASK_SIZE;
-					}
-				}
-
-				// Compare both the current bit and the received bit.
-				// The app might be modifying the object. If so, keep the
-				// user modified data and discard the change received.
-				int startIndex = i * BIT_MASK_SIZE;
-				for (int j = 0; j < count; j++) {
-					if (isBitDirty(dirty, j)) {
-						int index = startIndex + j;
-						Object value = MapLiteSerializer.readObject(input);
-						// Set the new value only if the app has not set the
-						// value
-						if (isBitDirty(userDirty, j) == false) {
-							values[index] = value;
-						}
-						// CacheFactory.getAnyInstance().getLogger().info("bit set = "
-						// + j + ", index = " + index);
-					}
-				}
-			}
-		} catch (ClassNotFoundException ex) {
-			// ignore
-		}
-	}
-
-	/**
-	 * Writes deltas to the specified output stream.
-	 * 
-	 * @param output
-	 *            The output stream.
-	 * @throws IOException
-	 *             Thrown if an IO error encountered.
-	 */
-	public void toDelta(DataOutput output) throws IOException
-	{
-		KeyType[] keyTypeValues = keyType.getValues();
-		int bitCount = keyTypeValues.length;
-
-		for (int i = 0; i < dirtyFlags.length; i++) {
-			output.writeInt(dirtyFlags[i]);
-			// System.out.println("dirty = " + dirtyFlags[i]);
-		}
-
-		int count = BIT_MASK_SIZE;
-
-		for (int i = 0; i < dirtyFlags.length; i++) {
-			int dirty = dirtyFlags[i];
-			if (isDirty(dirty) == false) {
-				continue;
-			}
-			if (i == dirtyFlags.length - 1) {
-				count = bitCount % BIT_MASK_SIZE;
-				if (count == 0 && bitCount != 0) {
-					count = BIT_MASK_SIZE;
-				}
-			}
-			int startIndex = i * BIT_MASK_SIZE;
-			for (int j = 0; j < count; j++) {
-				if (isBitDirty(dirty, j)) {
-					int index = startIndex + j;
-					MapLiteSerializer.writeObject(values[index], output);
-				}
-			}
-		}
-		clearDirty();
-	}
-
-	/**
-	 * Returns the key type ID that is universally unique. This call is
-	 * equivalent to <code>getKeyType().getId()</code>.
-	 */
-	public Object getId()
-	{
-		if (keyType == null) {
-			return null;
-		}
-		return keyType.getId();
-	}
-
-	/**
-	 * Returns the key type version. There are one or more key type versions per
-	 * ID. This method call is equivalent to invoking
-	 * <code>getKeyType().getVersion()</code>.
-	 */
-	public int getKeyTypeVersion()
-	{
-		if (keyType == null) {
-			return 0;
-		}
-		return keyType.getVersion();
-	}
-
-	/**
-	 * Returns the simple (short) class name of the key type. It returns null if
-	 * the key type is not defined.
-	 */
-	public String getName()
-	{
-		if (keyType == null) {
-			return null;
-		}
-		return (String) keyType.getClass().getSimpleName();
-	}
-
-	/**
-	 * Returns the fully qualified class name of the key type. It returns null
-	 * if the key type is not defined.
-	 */
-	public String getKeyTypeName()
-	{
-		if (keyType == null) {
-			return null;
-		}
-		return (String) keyType.getClass().getSimpleName();
-	}
-
-	/**
-	 * Returns all of the keys that map non-null values. It returns an empty set
-	 * if this object has not been initialized, i.e., KeyType is undefined.
-	 */
-	public Set<String> keySet()
-	{
-		TreeSet<String> retSet = new TreeSet<String>();
-		if (keyType != null) {
-
-			Set<String> set = (Set<String>) keyType.getNameSet();
-			for (String key : set) {
-				if (get(key) != null) {
-					retSet.add(key);
-				}
-			}
-		}
-		return retSet;
-	}
-
-	/**
-	 * Returns the entire collection of non-null values.
-	 */
-	public Collection<V> values()
-	{
-		ArrayList list = new ArrayList(values.length + 1);
-		for (int i = 0; i < values.length; i++) {
-			if (values[i] != null) {
-				list.add(values[i]);
-			}
-		}
-		return Collections.unmodifiableCollection(list);
-	}
-
-	/**
-	 * Returns the (string key, value) paired entry set that contains only
-	 * non-null values.
-	 */
-	public Set<Map.Entry<String, V>> entrySet()
-	{
-		if (keyType == null) {
-			return null;
-		}
-		HashMap<String, V> map = new HashMap(keyType.getKeyCount() + 1, 1f);
-		for (KeyType ft : keyType.getValues()) {
-			Object value = get(ft);
-			if (value != null) {
-				map.put((String) ft.getName(), get(ft));
-			}
-		}
-		return Collections.unmodifiableMap(map).entrySet();
-	}
-
-	/**
-	 * Clears the MapLite values. All non-null values are set to null and dirty.
-	 */
-	public void clear()
-	{
-		if (values != null) {
-			for (int i = 0; i < values.length; i++) {
-				if (values[i] != null) {
-					setDirty(i, dirtyFlags);
-				}
-			}
-			values = new Object[values.length];
-		}
-	}
-
-	/**
-	 * Returns true if the specified key maps a non-null value. It uses
-	 * key.toString() to search the key.
-	 * 
-	 * @param key
-	 *            The key to check.
-	 */
-	public boolean containsKey(Object key)
-	{
-		if (keyType == null) {
-			return false;
-		}
-		return get(key) != null;
-	}
-
-	/**
-	 * Returns true if the specified value exists in this object. It returns
-	 * null if the specified value is null and the MapLite object contains one
-	 * or more null values.
-	 * 
-	 * @param value
-	 *            The value to search.
-	 */
-	public boolean containsValue(Object value)
-	{
-		if (keyType == null) {
-			return false;
-		}
-		for (int i = 0; i < values.length; i++) {
-			if (values[i] == value) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * Returns true if there are no values stored in this object. A null value
-	 * is considered no value.
-	 */
-	public boolean isEmpty()
-	{
-		if (keyType == null || values == null) {
-			return true;
-		}
-		for (int i = 0; i < values.length; i++) {
-			if (values[i] != null) {
-				return false;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * Puts all entries found in the specified map into this MapLite object. The
-	 * specified map is handled based on its type as follows:
-	 * 
-	 * <ul>
-	 * <li>If the specified map is null then it is ignored.</li>
-	 * 
-	 * <li>If the specified map is MapLite and this object has not assigned
-	 * KeyType then this method shallow-copies the entire map image into this
-	 * object. As a result, MapLite object effectively becomes a clone of the
-	 * specified map with all of the keys marked dirty.</li>
-	 * 
-	 * <li>If the specified map is MapLite and this object has the same KeyType
-	 * as the map then the above bullet also applies.</li>
-	 * 
-	 * <li>If the specified map is Map or MapLite with a KeyType that is
-	 * different from this object then this method shallow-copies only the valid
-	 * keys and values. All invalid keys and values are ignored. The valid keys
-	 * must have the same key names defined in this object's KeyType. Similarly,
-	 * the valid values must have the same types defined in this object's
-	 * KeyType. All valid keys are marked dirty.</li>
-	 * </ul>
-	 * <p>
-	 * Note that the last bullet transforms any Map objects into MapLite
-	 * objects.
-	 * 
-	 * @param map
-	 *            Mappings to be stored in this MapLite object. If it is null
-	 *            then it is silently ignored.
-	 */
-	public void putAll(Map<? extends String, ? extends V> map)
-	{
-		if (map == null) {
-			return;
-		}
-
-		// if key type is not defined
-		if (keyType == null) {
-			if (map instanceof MapLite) {
-				MapLite ml = (MapLite) map;
-				if (ml.getKeyType() == null) {
-					return;
-				}
-				init(ml.getKeyType());
-				System.arraycopy(ml.values, 0, values, 0, values.length);
-				dirtyAllKeys();
-				return;
-			} else {
-				return;
-			}
-		}
-
-		// if key type is defined
-		if (map instanceof MapLite) {
-			MapLite ml = (MapLite) map;
-			if (keyType == ml.getKeyType()) {
-				System.arraycopy(ml.values, 0, values, 0, values.length);
-				dirtyAllKeys();
-				return;
-			}
-		}
-
-		// If Map or MapLite with a different KeyType - key must be string
-		Set<? extends Map.Entry<? extends String, ? extends V>> set = map.entrySet();
-		for (Map.Entry<? extends String, ? extends V> entry : set) {
-			KeyType keyType = this.keyType.getKeyType(entry.getKey());
-			if (keyType == null) {
-				continue;
-			}
-			if (entry.getValue() != null && keyType.getType() != entry.getValue().getClass()) {
-				continue;
-			}
-			put(keyType, entry.getValue());
-		}
-	}
-
-	/**
-	 * Removes the specified key's value. This method removes only the value
-	 * that the key maps to. The keys are never removed.
-	 * 
-	 * @param key
-	 *            The key of the value to remove.
-	 */
-	public V remove(Object key)
-	{
-		if (keyType == null || key == null) {
-			return null;
-		}
-
-		KeyType keyType = this.keyType.getKeyType(key.toString());
-		if (keyType == null) {
-			return null;
-		}
-
-		V oldVal = (V) values[keyType.getIndex()];
-
-		if (oldVal != null) {
-			// if (this.keyType.isDeltaEnabled()) {
-			setDirty(keyType, dirtyFlags);
-			// }
-		}
-		// TODO: take care of initial values for primitives
-		values[keyType.getIndex()] = null;
-		return oldVal;
-	}
-
-	/**
-	 * Returns the count of the non-null values.
-	 */
-	public int size()
-	{
-		if (keyType == null) {
-			return 0;
-		}
-		int count = 0;
-		for (int i = 0; i < values.length; i++) {
-			if (values[i] != null) {
-				count++;
-			}
-		}
-		return count;
-	}
-
-	/**
-	 * Returns the count of all keys defined by the key type. This method call
-	 * is equivalent to invoking
-	 * <code>{@link #getKeyType()}.getKeyCount()</code>. It returns 0 if MapLite
-	 * is not initialized, i.e., key type is not defined.
-	 */
-	public int getKeyCount()
-	{
-		if (keyType == null) {
-			return 0;
-		}
-		return keyType.getKeyCount();
-	}
-
-	/**
-	 * Clones this object by shallow-copying values. The returned object is the
-	 * exact image of this object including deltas and serialized values.
-	 */
-	public Object clone()
-	{
-		if (keyType == null) {
-			return new MapLite();
-		}
-		MapLite ml = new MapLite(keyType);
-		System.arraycopy(values, 0, ml.values, 0, values.length);
-		System.arraycopy(dirtyFlags, 0, ml.dirtyFlags, 0, dirtyFlags.length);
-		if (serializedBytes != null) {
-			System.arraycopy(serializedBytes, 0, ml.serializedBytes, 0, serializedBytes.length);
-		}
-		return ml;
-	}
-}



Mime
View raw message