zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject [23/44] zookeeper git commit: ZOOKEEPER-3030: MAVEN MIGRATION 3.4 - Step 1.3 - move contrib directories
Date Tue, 07 Aug 2018 09:43:09 GMT
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManagerImpl.java
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManagerImpl.java b/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManagerImpl.java
deleted file mode 100644
index d8194d5..0000000
--- a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorManagerImpl.java
+++ /dev/null
@@ -1,884 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.inspector.manager;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.Watcher.Event.EventType;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.ZooDefs.Perms;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager;
-import org.apache.zookeeper.inspector.encryption.DataEncryptionManager;
-import org.apache.zookeeper.inspector.logger.LoggerFactory;
-import org.apache.zookeeper.retry.ZooKeeperRetry;
-
-/**
- * A default implementation of {@link ZooInspectorManager} for connecting to
- * zookeeper instances
- */
-public class ZooInspectorManagerImpl implements ZooInspectorManager {
-    private static final String A_VERSION = "ACL Version";
-    private static final String C_TIME = "Creation Time";
-    private static final String C_VERSION = "Children Version";
-    private static final String CZXID = "Creation ID";
-    private static final String DATA_LENGTH = "Data Length";
-    private static final String EPHEMERAL_OWNER = "Ephemeral Owner";
-    private static final String M_TIME = "Last Modified Time";
-    private static final String MZXID = "Modified ID";
-    private static final String NUM_CHILDREN = "Number of Children";
-    private static final String PZXID = "Node ID";
-    private static final String VERSION = "Data Version";
-    private static final String ACL_PERMS = "Permissions";
-    private static final String ACL_SCHEME = "Scheme";
-    private static final String ACL_ID = "Id";
-    private static final String SESSION_STATE = "Session State";
-    private static final String SESSION_ID = "Session ID";
-    /**
-     * The key used for the connect string in the connection properties file
-     */
-    public static final String CONNECT_STRING = "hosts";
-    /**
-     * The key used for the session timeout in the connection properties file
-     */
-    public static final String SESSION_TIMEOUT = "timeout";
-    /**
-     * The key used for the data encryption manager in the connection properties
-     * file
-     */
-    public static final String DATA_ENCRYPTION_MANAGER = "encryptionManager";
-    /**
-     * The key used for the authentication scheme in the connection properties file
-     */
-    public static final String AUTH_SCHEME_KEY = "authScheme";
-    /**
-     * The key used for the authentication data in the connection properties file
-     */
-    public static final String AUTH_DATA_KEY = "authData";
-
-    private static final File defaultNodeViewersFile = new File(
-            "./config/defaultNodeVeiwers.cfg");
-    private static final File defaultConnectionFile = new File(
-            "./config/defaultConnectionSettings.cfg");
-
-    private DataEncryptionManager encryptionManager;
-    private String connectString;
-    private int sessionTimeout;
-    private ZooKeeper zooKeeper;
-    private final Map<String, NodeWatcher> watchers = new HashMap<String, NodeWatcher>();
-    protected boolean connected = true;
-    private Properties lastConnectionProps;
-    private String defaultEncryptionManager;
-    private String defaultTimeout;
-    private String defaultHosts;
-    private String defaultAuthScheme;
-    private String defaultAuthValue;
-
-    /**
-     * @throws IOException
-     *             - thrown if the default connection settings cannot be loaded
-     * 
-     */
-    public ZooInspectorManagerImpl() throws IOException {
-        loadDefaultConnectionFile();
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorManager#connect(java
-     * .util.Properties)
-     */
-    public boolean connect(Properties connectionProps) {
-        try {
-            if (this.zooKeeper == null) {
-                String connectString = connectionProps
-                        .getProperty(CONNECT_STRING);
-                String sessionTimeout = connectionProps
-                        .getProperty(SESSION_TIMEOUT);
-                String encryptionManager = connectionProps
-                        .getProperty(DATA_ENCRYPTION_MANAGER);
-                String authScheme = connectionProps
-                        .getProperty(AUTH_SCHEME_KEY);
-                String authData = connectionProps
-                        .getProperty(AUTH_DATA_KEY);
-
-                if (connectString == null || sessionTimeout == null) {
-                    throw new IllegalArgumentException(
-                            "Both connect string and session timeout are required.");
-                }
-                if (encryptionManager == null) {
-                    this.encryptionManager = new BasicDataEncryptionManager();
-                } else {
-                    Class<?> clazz = Class.forName(encryptionManager);
-
-                    if (Arrays.asList(clazz.getInterfaces()).contains(
-                            DataEncryptionManager.class)) {
-                        this.encryptionManager = (DataEncryptionManager) Class
-                                .forName(encryptionManager).newInstance();
-                    } else {
-                        throw new IllegalArgumentException(
-                                "Data encryption manager must implement DataEncryptionManager interface");
-                    }
-                }
-                this.connectString = connectString;
-                this.sessionTimeout = Integer.valueOf(sessionTimeout);
-                this.zooKeeper = new ZooKeeperRetry(connectString, Integer
-                        .valueOf(sessionTimeout), new Watcher() {
-
-                    public void process(WatchedEvent event) {
-                        if (event.getState() == KeeperState.Expired) {
-                            connected = false;
-                        }
-                    }
-                });
-                if (authData != null && authData.length() > 0){
-                    this.zooKeeper.addAuthInfo(authScheme, authData.getBytes());
-                }
-                ((ZooKeeperRetry) this.zooKeeper).setRetryLimit(10);
-                connected = ((ZooKeeperRetry) this.zooKeeper).testConnection();
-            }
-        } catch (Exception e) {
-            connected = false;
-            e.printStackTrace();
-        }
-        if (!connected){
-        	disconnect();
-        }
-        return connected;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorManager#disconnect()
-     */
-    public boolean disconnect() {
-        try {
-            if (this.zooKeeper != null) {
-                this.zooKeeper.close();
-                this.zooKeeper = null;
-                connected = false;
-                removeWatchers(this.watchers.keySet());
-                return true;
-            }
-        } catch (Exception e) {
-            LoggerFactory.getLogger().error(
-                    "Error occurred while disconnecting from ZooKeeper server",
-                    e);
-        }
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * getChildren(java.lang.String)
-     */
-    public List<String> getChildren(String nodePath) {
-        if (connected) {
-            try {
-
-                return zooKeeper.getChildren(nodePath, false);
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred retrieving children of node: "
-                                + nodePath, e);
-            }
-        }
-        return null;
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#getData
-     * (java.lang.String)
-     */
-    public String getData(String nodePath) {
-        if (connected) {
-            try {
-                if (nodePath.length() == 0) {
-                    nodePath = "/";
-                }
-                Stat s = zooKeeper.exists(nodePath, false);
-                if (s != null) {
-                    return this.encryptionManager.decryptData(zooKeeper
-                            .getData(nodePath, false, s));
-                }
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred getting data for node: " + nodePath, e);
-            }
-        }
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * getNodeChild(java.lang.String, int)
-     */
-    public String getNodeChild(String nodePath, int childIndex) {
-        if (connected) {
-            try {
-                Stat s = zooKeeper.exists(nodePath, false);
-                if (s != null) {
-                    return this.zooKeeper.getChildren(nodePath, false).get(
-                            childIndex);
-                }
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred retrieving child " + childIndex
-                                + " of node: " + nodePath, e);
-            }
-        }
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * getNodeIndex(java.lang.String)
-     */
-    public int getNodeIndex(String nodePath) {
-        if (connected) {
-            int index = nodePath.lastIndexOf("/");
-            if (index == -1
-                    || (!nodePath.equals("/") && nodePath.charAt(nodePath
-                            .length() - 1) == '/')) {
-                throw new IllegalArgumentException("Invalid node path: "
-                        + nodePath);
-            }
-            String parentPath = nodePath.substring(0, index);
-            String child = nodePath.substring(index + 1);
-            if (parentPath != null && parentPath.length() > 0) {
-                List<String> children = this.getChildren(parentPath);
-                if (children != null) {
-                    return children.indexOf(child);
-                }
-            }
-        }
-        return -1;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#getACLs
-     * (java.lang.String)
-     */
-    public List<Map<String, String>> getACLs(String nodePath) {
-        List<Map<String, String>> returnACLs = new ArrayList<Map<String, String>>();
-        if (connected) {
-            try {
-                if (nodePath.length() == 0) {
-                    nodePath = "/";
-                }
-                Stat s = zooKeeper.exists(nodePath, false);
-                if (s != null) {
-                    List<ACL> acls = zooKeeper.getACL(nodePath, s);
-                    for (ACL acl : acls) {
-                        Map<String, String> aclMap = new LinkedHashMap<String, String>();
-                        aclMap.put(ACL_SCHEME, acl.getId().getScheme());
-                        aclMap.put(ACL_ID, acl.getId().getId());
-                        StringBuilder sb = new StringBuilder();
-                        int perms = acl.getPerms();
-                        boolean addedPerm = false;
-                        if ((perms & Perms.READ) == Perms.READ) {
-                            sb.append("Read");
-                            addedPerm = true;
-                        }
-                        if (addedPerm) {
-                            sb.append(", ");
-                        }
-                        if ((perms & Perms.WRITE) == Perms.WRITE) {
-                            sb.append("Write");
-                            addedPerm = true;
-                        }
-                        if (addedPerm) {
-                            sb.append(", ");
-                        }
-                        if ((perms & Perms.CREATE) == Perms.CREATE) {
-                            sb.append("Create");
-                            addedPerm = true;
-                        }
-                        if (addedPerm) {
-                            sb.append(", ");
-                        }
-                        if ((perms & Perms.DELETE) == Perms.DELETE) {
-                            sb.append("Delete");
-                            addedPerm = true;
-                        }
-                        if (addedPerm) {
-                            sb.append(", ");
-                        }
-                        if ((perms & Perms.ADMIN) == Perms.ADMIN) {
-                            sb.append("Admin");
-                            addedPerm = true;
-                        }
-                        aclMap.put(ACL_PERMS, sb.toString());
-                        returnACLs.add(aclMap);
-                    }
-                }
-            } catch (InterruptedException e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred retrieving ACLs of node: " + nodePath,
-                        e);
-            } catch (KeeperException e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred retrieving ACLs of node: " + nodePath,
-                        e);
-            }
-        }
-        return returnACLs;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * getNodeMeta(java.lang.String)
-     */
-    public Map<String, String> getNodeMeta(String nodePath) {
-        Map<String, String> nodeMeta = new LinkedHashMap<String, String>();
-        if (connected) {
-            try {
-                if (nodePath.length() == 0) {
-                    nodePath = "/";
-                }
-                Stat s = zooKeeper.exists(nodePath, false);
-                if (s != null) {
-                    nodeMeta.put(A_VERSION, String.valueOf(s.getAversion()));
-                    nodeMeta.put(C_TIME, String.valueOf(s.getCtime()));
-                    nodeMeta.put(C_VERSION, String.valueOf(s.getCversion()));
-                    nodeMeta.put(CZXID, String.valueOf(s.getCzxid()));
-                    nodeMeta
-                            .put(DATA_LENGTH, String.valueOf(s.getDataLength()));
-                    nodeMeta.put(EPHEMERAL_OWNER, String.valueOf(s
-                            .getEphemeralOwner()));
-                    nodeMeta.put(M_TIME, String.valueOf(s.getMtime()));
-                    nodeMeta.put(MZXID, String.valueOf(s.getMzxid()));
-                    nodeMeta.put(NUM_CHILDREN, String.valueOf(s
-                            .getNumChildren()));
-                    nodeMeta.put(PZXID, String.valueOf(s.getPzxid()));
-                    nodeMeta.put(VERSION, String.valueOf(s.getVersion()));
-                }
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred retrieving meta data for node: "
-                                + nodePath, e);
-            }
-        }
-        return nodeMeta;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * getNumChildren(java.lang.String)
-     */
-    public int getNumChildren(String nodePath) {
-        if (connected) {
-            try {
-                Stat s = zooKeeper.exists(nodePath, false);
-                if (s != null) {
-                    return s.getNumChildren();
-                }
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred getting the number of children of node: "
-                                + nodePath, e);
-            }
-        }
-        return -1;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * hasChildren(java.lang.String)
-     */
-    public boolean hasChildren(String nodePath) {
-        return getNumChildren(nodePath) > 0;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * isAllowsChildren(java.lang.String)
-     */
-    public boolean isAllowsChildren(String nodePath) {
-        if (connected) {
-            try {
-                Stat s = zooKeeper.exists(nodePath, false);
-                if (s != null) {
-                    return s.getEphemeralOwner() == 0;
-                }
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred determining whether node is allowed children: "
-                                + nodePath, e);
-            }
-        }
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorReadOnlyManager#
-     * getSessionMeta()
-     */
-    public Map<String, String> getSessionMeta() {
-        Map<String, String> sessionMeta = new LinkedHashMap<String, String>();
-        try {
-            if (zooKeeper != null) {
-
-                sessionMeta.put(SESSION_ID, String.valueOf(zooKeeper
-                        .getSessionId()));
-                sessionMeta.put(SESSION_STATE, String.valueOf(zooKeeper
-                        .getState().toString()));
-                sessionMeta.put(CONNECT_STRING, this.connectString);
-                sessionMeta.put(SESSION_TIMEOUT, String
-                        .valueOf(this.sessionTimeout));
-            }
-        } catch (Exception e) {
-            LoggerFactory.getLogger().error(
-                    "Error occurred retrieving session meta data.", e);
-        }
-        return sessionMeta;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorNodeTreeManager#createNode
-     * (java.lang.String, java.lang.String)
-     */
-    public boolean createNode(String parent, String nodeName) {
-        if (connected) {
-            try {
-                String[] nodeElements = nodeName.split("/");
-                for (String nodeElement : nodeElements) {
-                    String node = parent + "/" + nodeElement;
-                    Stat s = zooKeeper.exists(node, false);
-                    if (s == null) {
-                        zooKeeper.create(node, this.encryptionManager
-                                .encryptData(null), Ids.OPEN_ACL_UNSAFE,
-                                CreateMode.PERSISTENT);
-                        parent = node;
-                    }
-                }
-                return true;
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred creating node: " + parent + "/"
-                                + nodeName, e);
-            }
-        }
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorNodeTreeManager#deleteNode
-     * (java.lang.String)
-     */
-    public boolean deleteNode(String nodePath) {
-        if (connected) {
-            try {
-                Stat s = zooKeeper.exists(nodePath, false);
-                if (s != null) {
-                    List<String> children = zooKeeper.getChildren(nodePath,
-                            false);
-                    for (String child : children) {
-                        String node = nodePath + "/" + child;
-                        deleteNode(node);
-                    }
-                    zooKeeper.delete(nodePath, -1);
-                }
-                return true;
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred deleting node: " + nodePath, e);
-            }
-        }
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorNodeManager#setData
-     * (java.lang.String, java.lang.String)
-     */
-    public boolean setData(String nodePath, String data) {
-        if (connected) {
-            try {
-                zooKeeper.setData(nodePath, this.encryptionManager
-                        .encryptData(data), -1);
-                return true;
-            } catch (Exception e) {
-                LoggerFactory.getLogger().error(
-                        "Error occurred setting data for node: " + nodePath, e);
-            }
-        }
-        return false;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorManager#
-     * getConnectionPropertiesTemplate()
-     */
-    public Pair<Map<String, List<String>>, Map<String, String>> getConnectionPropertiesTemplate() {
-        Map<String, List<String>> template = new LinkedHashMap<String, List<String>>();
-        template.put(CONNECT_STRING, Arrays
-                .asList(new String[] { defaultHosts }));
-        template.put(SESSION_TIMEOUT, Arrays
-                .asList(new String[] { defaultTimeout }));
-        template.put(DATA_ENCRYPTION_MANAGER, Arrays
-                .asList(new String[] { defaultEncryptionManager }));
-        template.put(AUTH_SCHEME_KEY, Arrays
-                .asList(new String[] { defaultAuthScheme }));
-        template.put(AUTH_DATA_KEY, Arrays
-                .asList(new String[] { defaultAuthValue }));
-        Map<String, String> labels = new LinkedHashMap<String, String>();
-        labels.put(CONNECT_STRING, "Connect String");
-        labels.put(SESSION_TIMEOUT, "Session Timeout");
-        labels.put(DATA_ENCRYPTION_MANAGER, "Data Encryption Manager");
-        labels.put(AUTH_SCHEME_KEY, "Authentication Scheme");
-        labels.put(AUTH_DATA_KEY, "Authentication Data");
-        return new Pair<Map<String, List<String>>, Map<String, String>>(
-                template, labels);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorManager#addWatchers
-     * (java.util.Collection,
-     * org.apache.zookeeper.inspector.manager.NodeListener)
-     */
-    public void addWatchers(Collection<String> selectedNodes,
-            NodeListener nodeListener) {
-        // add watcher for each node and add node to collection of
-        // watched nodes
-        if (connected) {
-            for (String node : selectedNodes) {
-                if (!watchers.containsKey(node)) {
-                    try {
-                        watchers.put(node, new NodeWatcher(node, nodeListener,
-                                zooKeeper));
-                    } catch (Exception e) {
-                        LoggerFactory.getLogger().error(
-                                "Error occurred adding node watcher for node: "
-                                        + node, e);
-                    }
-                }
-            }
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.zookeeper.inspector.manager.ZooInspectorManager#removeWatchers
-     * (java.util.Collection)
-     */
-    public void removeWatchers(Collection<String> selectedNodes) {
-        // remove watcher for each node and remove node from
-        // collection of watched nodes
-        if (connected) {
-            for (String node : selectedNodes) {
-                if (watchers.containsKey(node)) {
-                    NodeWatcher watcher = watchers.remove(node);
-                    if (watcher != null) {
-                        watcher.stop();
-                    }
-                }
-            }
-        }
-    }
-
-    /**
-     * A Watcher which will re-add itself every time an event is fired
-     * 
-     */
-    public class NodeWatcher implements Watcher {
-
-        private final String nodePath;
-        private final NodeListener nodeListener;
-        private final ZooKeeper zookeeper;
-        private boolean closed = false;
-
-        /**
-         * @param nodePath
-         *            - the path to the node to watch
-         * @param nodeListener
-         *            the {@link NodeListener} for this node
-         * @param zookeeper
-         *            - a {@link ZooKeeper} to use to access zookeeper
-         * @throws InterruptedException
-         * @throws KeeperException
-         */
-        public NodeWatcher(String nodePath, NodeListener nodeListener,
-                ZooKeeper zookeeper) throws KeeperException,
-                InterruptedException {
-            this.nodePath = nodePath;
-            this.nodeListener = nodeListener;
-            this.zookeeper = zookeeper;
-            Stat s = zooKeeper.exists(nodePath, this);
-            if (s != null) {
-                zookeeper.getChildren(nodePath, this);
-            }
-        }
-
-        public void process(WatchedEvent event) {
-            if (!closed) {
-                try {
-                    if (event.getType() != EventType.NodeDeleted) {
-
-                        Stat s = zooKeeper.exists(nodePath, this);
-                        if (s != null) {
-                            zookeeper.getChildren(nodePath, this);
-                        }
-                    }
-                } catch (Exception e) {
-                    LoggerFactory.getLogger().error(
-                            "Error occurred re-adding node watcherfor node "
-                                    + nodePath, e);
-                }
-                nodeListener.processEvent(event.getPath(), event.getType()
-                        .name(), null);
-            }
-        }
-
-        /**
-		 * 
-		 */
-        public void stop() {
-            this.closed = true;
-        }
-
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorManager#
-     * loadNodeViewersFile(java.io.File)
-     */
-    public List<String> loadNodeViewersFile(File selectedFile)
-            throws IOException {
-        List<String> result = new ArrayList<String>();
-        if (defaultNodeViewersFile.exists()) {
-            FileReader reader = new FileReader(selectedFile);
-            try {
-                BufferedReader buff = new BufferedReader(reader);
-                try {
-                    while (buff.ready()) {
-                        String line = buff.readLine();
-                        if (line != null && line.length() > 0 && !line.startsWith("#")) {
-                            result.add(line);
-                        }
-                    }
-                } finally {
-                    buff.close();
-                }
-            } finally {
-                reader.close();
-            }
-        }
-        return result;
-    }
-
-    private void loadDefaultConnectionFile() throws IOException {
-        if (defaultConnectionFile.exists()) {
-            Properties props = new Properties();
-
-            FileReader reader = new FileReader(defaultConnectionFile);
-            try {
-                props.load(reader);
-            } finally {
-                reader.close();
-            }
-            defaultEncryptionManager = props
-                    .getProperty(DATA_ENCRYPTION_MANAGER) == null ? "org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager"
-                    : props.getProperty(DATA_ENCRYPTION_MANAGER);
-            defaultTimeout = props.getProperty(SESSION_TIMEOUT) == null ? "5000"
-                    : props.getProperty(SESSION_TIMEOUT);
-            defaultHosts = props.getProperty(CONNECT_STRING) == null ? "localhost:2181"
-                    : props.getProperty(CONNECT_STRING);
-            defaultAuthScheme = props.getProperty(AUTH_SCHEME_KEY) == null ? ""
-                    : props.getProperty(AUTH_SCHEME_KEY);
-            defaultAuthValue = props.getProperty(AUTH_DATA_KEY) == null ? ""
-                    : props.getProperty(AUTH_DATA_KEY);
-        } else {
-            defaultEncryptionManager = "org.apache.zookeeper.inspector.encryption.BasicDataEncryptionManager";
-            defaultTimeout = "5000";
-            defaultHosts = "localhost:2181";
-            defaultAuthScheme = "";
-            defaultAuthValue = "";
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorManager#
-     * saveDefaultConnectionFile(java.util.Properties)
-     */
-    public void saveDefaultConnectionFile(Properties props) throws IOException {
-        File defaultDir = defaultConnectionFile.getParentFile();
-        if (!defaultDir.exists()) {
-            if (!defaultDir.mkdirs()) {
-                throw new IOException(
-                        "Failed to create configuration directory: "
-                                + defaultDir.getAbsolutePath());
-            }
-        }
-        if (!defaultConnectionFile.exists()) {
-            if (!defaultConnectionFile.createNewFile()) {
-                throw new IOException(
-                        "Failed to create default connection file: "
-                                + defaultConnectionFile.getAbsolutePath());
-            }
-        }
-        FileWriter writer = new FileWriter(defaultConnectionFile);
-        try {
-            props.store(writer, "Default connection for ZooInspector");
-        } finally {
-            writer.close();
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorManager#
-     * saveNodeViewersFile(java.io.File, java.util.List)
-     */
-    public void saveNodeViewersFile(File selectedFile,
-            List<String> nodeViewersClassNames) throws IOException {
-        if (!selectedFile.exists()) {
-            if (!selectedFile.createNewFile()) {
-                throw new IOException(
-                        "Failed to create node viewers configuration file: "
-                                + selectedFile.getAbsolutePath());
-            }
-        }
-        FileWriter writer = new FileWriter(selectedFile);
-        try {
-            BufferedWriter buff = new BufferedWriter(writer);
-            try {
-                for (String nodeViewersClassName : nodeViewersClassNames) {
-                    buff.append(nodeViewersClassName);
-                    buff.append("\n");
-                }
-            } finally {
-                buff.flush();
-                buff.close();
-            }
-        } finally {
-            writer.close();
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorManager#
-     * setDefaultNodeViewerConfiguration(java.io.File, java.util.List)
-     */
-    public void setDefaultNodeViewerConfiguration(
-            List<String> nodeViewersClassNames) throws IOException {
-        File defaultDir = defaultNodeViewersFile.getParentFile();
-        if (!defaultDir.exists()) {
-            if (!defaultDir.mkdirs()) {
-                throw new IOException(
-                        "Failed to create configuration directory: "
-                                + defaultDir.getAbsolutePath());
-            }
-        }
-        saveNodeViewersFile(defaultNodeViewersFile, nodeViewersClassNames);
-    }
-
-    public List<String> getDefaultNodeViewerConfiguration() throws IOException {
-        return loadNodeViewersFile(defaultNodeViewersFile);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorManager#
-     * getLastConnectionProps()
-     */
-    public Properties getLastConnectionProps() {
-        return this.lastConnectionProps;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @seeorg.apache.zookeeper.inspector.manager.ZooInspectorManager#
-     * setLastConnectionProps(java.util.Properties)
-     */
-    public void setLastConnectionProps(Properties connectionProps) {
-        this.lastConnectionProps = connectionProps;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeManager.java
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeManager.java b/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeManager.java
deleted file mode 100644
index 0c62547..0000000
--- a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeManager.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.inspector.manager;
-
-/**
- * A Manager for all interactions between the application and the nodes in a
- * Zookeeper instance
- * */
-public interface ZooInspectorNodeManager extends ZooInspectorReadOnlyManager {
-    /**
-     * @param nodePath
-     *            - the path to the node on which to set the data
-     * @param data
-     *            - the data to set on the this node
-     * @return true if the data for the node was successfully updated
-     */
-    public boolean setData(String nodePath, String data);
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeTreeManager.java
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeTreeManager.java b/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeTreeManager.java
deleted file mode 100644
index 9718c1d..0000000
--- a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorNodeTreeManager.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.inspector.manager;
-
-/**
- * A Manager for all interactions between the application and the node tree in a
- * Zookeeper instance
- */
-public interface ZooInspectorNodeTreeManager extends
-        ZooInspectorReadOnlyManager {
-
-    /**
-     * @param parent
-     *            - the parent node path for the node to add
-     * @param nodeName
-     *            - the name of the new node
-     * @return true if the node was successfully created
-     */
-    public abstract boolean createNode(String parent, String nodeName);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return true if the node was successfully deleted
-     */
-    public abstract boolean deleteNode(String nodePath);
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorReadOnlyManager.java
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorReadOnlyManager.java b/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorReadOnlyManager.java
deleted file mode 100644
index d9fdf5c..0000000
--- a/src/contrib/zooinspector/src/java/org/apache/zookeeper/inspector/manager/ZooInspectorReadOnlyManager.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.inspector.manager;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * A Manager for all read only interactions between the application and a node
- * in a Zookeeper instance
- */
-public interface ZooInspectorReadOnlyManager {
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return the data for the node
-     */
-    public abstract String getData(String nodePath);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return the metaData for the node
-     */
-    public abstract Map<String, String> getNodeMeta(String nodePath);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return the ACLs set on the node
-     */
-    public abstract List<Map<String, String>> getACLs(String nodePath);
-
-    /**
-     * @return the metaData for the current session
-     */
-    public abstract Map<String, String> getSessionMeta();
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return true if the node has children
-     */
-    public abstract boolean hasChildren(String nodePath);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return the index of the node within its siblings
-     */
-    public abstract int getNodeIndex(String nodePath);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return the number of children of the node
-     */
-    public abstract int getNumChildren(String nodePath);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @param childIndex
-     *            - the index to the node in the list of node children
-     * @return the path to the node for the child of the nodePath at childIndex
-     */
-    public abstract String getNodeChild(String nodePath, int childIndex);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return true if the node allows children nodes
-     */
-    public abstract boolean isAllowsChildren(String nodePath);
-
-    /**
-     * @param nodePath
-     *            - the path to the node to delete
-     * @return a {@link List} of the children of the node
-     */
-    public abstract List<String> getChildren(String nodePath);
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/src/java/org/apache/zookeeper/retry/ZooKeeperRetry.java
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/src/java/org/apache/zookeeper/retry/ZooKeeperRetry.java b/src/contrib/zooinspector/src/java/org/apache/zookeeper/retry/ZooKeeperRetry.java
deleted file mode 100644
index ce959a1..0000000
--- a/src/contrib/zooinspector/src/java/org/apache/zookeeper/retry/ZooKeeperRetry.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.zookeeper.retry;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.data.ACL;
-import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.inspector.logger.LoggerFactory;
-
-/**
- * A Class which extends {@link ZooKeeper} and will automatically retry calls to
- * zookeeper if a {@link KeeperException.ConnectionLossException} occurs
- */
-public class ZooKeeperRetry extends ZooKeeper {
-
-    private boolean closed = false;
-    private final Watcher watcher;
-    private int limit = -1;
-
-    /**
-     * @param connectString
-     * @param sessionTimeout
-     * @param watcher
-     * @throws IOException
-     */
-    public ZooKeeperRetry(String connectString, int sessionTimeout,
-            Watcher watcher) throws IOException {
-        super(connectString, sessionTimeout, watcher);
-        this.watcher = watcher;
-    }
-
-    /**
-     * @param connectString
-     * @param sessionTimeout
-     * @param watcher
-     * @param sessionId
-     * @param sessionPasswd
-     * @throws IOException
-     */
-    public ZooKeeperRetry(String connectString, int sessionTimeout,
-            Watcher watcher, long sessionId, byte[] sessionPasswd)
-            throws IOException {
-        super(connectString, sessionTimeout, watcher, sessionId, sessionPasswd);
-        this.watcher = watcher;
-    }
-
-    @Override
-    public synchronized void close() throws InterruptedException {
-        this.closed = true;
-        super.close();
-    }
-
-    @Override
-    public String create(String path, byte[] data, List<ACL> acl,
-            CreateMode createMode) throws KeeperException, InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.create(path, data, acl, createMode);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-                if (exists(path, false) != null) {
-                    return path;
-                }
-            } catch (KeeperException.NodeExistsException e) {
-                return path;
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    @Override
-    public void delete(String path, int version) throws InterruptedException,
-            KeeperException {
-        int count = 0;
-        do {
-            try {
-                super.delete(path, version);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-                if (exists(path, false) == null) {
-                    return;
-                }
-            } catch (KeeperException.NoNodeException e) {
-                break;
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-    }
-
-    @Override
-    public Stat exists(String path, boolean watch) throws KeeperException,
-            InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.exists(path, watch ? watcher : null);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    @Override
-    public Stat exists(String path, Watcher watcher) throws KeeperException,
-            InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.exists(path, watcher);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    @Override
-    public List<ACL> getACL(String path, Stat stat) throws KeeperException,
-            InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.getACL(path, stat);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    @Override
-    public List<String> getChildren(String path, boolean watch)
-            throws KeeperException, InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.getChildren(path, watch ? watcher : null);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return new ArrayList<String>();
-    }
-
-    @Override
-    public List<String> getChildren(String path, Watcher watcher)
-            throws KeeperException, InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.getChildren(path, watcher);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return new ArrayList<String>();
-    }
-
-    @Override
-    public byte[] getData(String path, boolean watch, Stat stat)
-            throws KeeperException, InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.getData(path, watch ? watcher : null, stat);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    @Override
-    public byte[] getData(String path, Watcher watcher, Stat stat)
-            throws KeeperException, InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.getData(path, watcher, stat);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    @Override
-    public Stat setACL(String path, List<ACL> acl, int aclVersion)
-            throws KeeperException, InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.setACL(path, acl, aclVersion);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-                Stat s = exists(path, false);
-                if (s != null) {
-                    if (getACL(path, s).equals(acl)) {
-                        return s;
-                    }
-                } else {
-                    return null;
-                }
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    @Override
-    public Stat setData(String path, byte[] data, int version)
-            throws KeeperException, InterruptedException {
-        int count = 0;
-        do {
-            try {
-                return super.setData(path, data, version);
-            } catch (KeeperException.ConnectionLossException e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-                Stat s = exists(path, false);
-                if (s != null) {
-                    if (getData(path, false, s) == data) {
-                        return s;
-                    }
-                } else {
-                    return null;
-                }
-            }
-        } while (!closed && (limit == -1 || count++ < limit));
-        return null;
-    }
-
-    /**
-     * @param limit
-     */
-    public void setRetryLimit(int limit) {
-        this.limit = limit;
-    }
-
-    /**
-     * @return true if successfully connected to zookeeper
-     */
-    public boolean testConnection() {
-        int count = 0;
-        do {
-            try {
-                return super.exists("/", null) != null;
-            } catch (Exception e) {
-                LoggerFactory.getLogger().warn(
-                        "ZooKeeper connection lost.  Trying to reconnect.");
-            }
-        } while (count++ < 5);
-        return false;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/zooInspector-dev.sh
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/zooInspector-dev.sh b/src/contrib/zooinspector/zooInspector-dev.sh
deleted file mode 100755
index 5047204..0000000
--- a/src/contrib/zooinspector/zooInspector-dev.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-         
-java -cp ../../../build/contrib/ZooInspector/zookeeper-dev-ZooInspector.jar:../../../build/lib/log4j-1.2.15.jar:lib/zookeeper-3.3.0.jar:lib/jtoaster-1.0.4.jar:lib org.apache.zookeeper.inspector.ZooInspector
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/zooInspector.cmd
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/zooInspector.cmd b/src/contrib/zooinspector/zooInspector.cmd
deleted file mode 100644
index 4fa3ab2..0000000
--- a/src/contrib/zooinspector/zooInspector.cmd
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-java -cp zookeeper-dev-ZooInspector.jar;lib/log4j-1.2.15.jar;lib/zookeeper-3.3.0.jar;lib/jToaster-1.0.4.jar;lib org.apache.zookeeper.inspector.ZooInspector
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/src/contrib/zooinspector/zooInspector.sh
----------------------------------------------------------------------
diff --git a/src/contrib/zooinspector/zooInspector.sh b/src/contrib/zooinspector/zooInspector.sh
deleted file mode 100755
index b35b4ca..0000000
--- a/src/contrib/zooinspector/zooInspector.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-java -cp lib/New.jar:zookeeper-dev-ZooInspector.jar:lib/log4j-1.2.15.jar:;lib/zookeeper-3.3.0.jar:lib/jToaster-1.0.4.jar:lib org.apache.zookeeper.inspector.ZooInspector

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/build-contrib.xml
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/build-contrib.xml b/zookeeper-contrib/build-contrib.xml
new file mode 100644
index 0000000..ed54b22
--- /dev/null
+++ b/zookeeper-contrib/build-contrib.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<!-- Imported by contrib/*/build.xml files to share generic targets. -->
+
+<project name="zookeeperbuildcontrib" xmlns:ivy="antlib:org.apache.ivy.ant">
+
+  <property name="name" value="${ant.project.name}"/>
+  <property name="version" value="dev"/>
+  <property name="root" value="${basedir}"/>
+
+  <property name="zk.root" location="${root}/../../"/>
+
+  <property name="src.dir"  location="${root}/src/main/java"/>
+  <property name="src.test" location="${root}/src/test"/>
+
+  <property name="lib.dir"  location="${zk.root}/src/java/lib"/>
+
+  <property name="build.dir" location="${zk.root}/build/contrib/${name}"/>
+  <property name="build.classes" location="${build.dir}/classes"/>
+  <property name="build.test" location="${build.dir}/test"/>
+
+  <property name="javac.deprecation" value="on"/>
+  <property name="javac.debug" value="on"/>
+
+  <property name="build.encoding" value="ISO-8859-1"/>
+
+  <property name="ivy.version" value="2.4.0"/>
+  <property name="ivy.url"
+            value="https://repo1.maven.org/maven2/org/apache/ivy/ivy" />
+  <property name="ivy.home" value="${user.home}/.ant" />
+  <property name="ivy.lib" value="${build.dir}/lib"/>
+  <property name="ivy.test.lib" value="${build.test}/lib"/>
+  <property name="ivysettings.xml" value="${zk.root}/ivysettings.xml"/>
+
+  <!-- to be overridden by sub-projects -->
+  <target name="check-contrib"/>
+  <target name="init-contrib"/>
+
+  <property name="lib.jars.includes" value="lib/*.jar" />
+  <property name="lib.jars.excludes" value="" />
+
+  <!-- prior to ant 1.7.1 fileset always fails if dir doesn't exist
+       so just point to bin directory and provide settings that exclude
+       everything - user can change as appropriate -->
+  <property name="additional.lib.dir" value="${zk.root}/bin" />
+  <property name="additional.lib.dir.includes" value="**/*.jar" />
+  <property name="additional.lib.dir.excludes" value="**/*.jar" />
+
+  <fileset id="lib.jars" dir="${root}">
+    <include name="${lib.jars.includes}" />
+    <exclude name="${lib.jars.excludes}" />
+  </fileset>
+
+  <path id="classpath">
+    <pathelement location="${build.classes}"/>
+    <!-- allow the user to override (e.g. if there are local versions) -->
+    <fileset dir="${additional.lib.dir}">
+      <include name="${additional.lib.dir.includes}" />
+      <exclude name="${additional.lib.dir.excludes}" />
+    </fileset>
+    <fileset refid="lib.jars"/>
+    <pathelement location="${zk.root}/build/classes"/>
+    <fileset dir="${ivy.lib}">
+      <include name="**/*.jar" />
+    </fileset>
+    <fileset dir="${ivy.test.lib}">
+      <include name="**/*.jar" />
+    </fileset>
+    <fileset dir="${zk.root}/src/java/lib">
+      <include name="**/*.jar" />
+    </fileset>
+    <fileset dir="${ant.home}/lib">
+      <include name="ant.jar" />
+    </fileset>
+  </path>
+
+  <!-- ====================================================== -->
+  <!-- Stuff needed by all targets                            -->
+  <!-- ====================================================== -->
+  <target name="init" depends="check-contrib" unless="skip.contrib">
+    <echo message="contrib: ${name}"/>
+    <mkdir dir="${build.dir}"/>
+    <mkdir dir="${build.classes}"/>
+    <mkdir dir="${build.test}"/>
+
+    <mkdir dir="${ivy.lib}"/>
+    <mkdir dir="${ivy.test.lib}"/>
+    <condition property="ivy.jar.exists">
+      <available file="${lib.dir}/ivy-${ivy.version}.jar"/>
+    </condition>
+
+    <antcall target="init-contrib"/>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- Compile a contrib's files                              -->
+  <!-- ====================================================== -->
+  <target name="compile" depends="init"
+          unless="skip.contrib">
+    <echo message="contrib: ${name}"/>
+
+    <javac
+     encoding="${build.encoding}"
+     srcdir="${src.dir}"
+     includes="**/*.java"
+     destdir="${build.classes}"
+     debug="${javac.debug}"
+     deprecation="${javac.deprecation}">
+      <classpath refid="classpath"/>
+    </javac>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- Make a contrib's jar                                   -->
+  <!-- ====================================================== -->
+  <target name="jar" depends="compile" unless="skip.contrib">
+    <echo message="contrib: ${name}"/>
+    <jar
+      jarfile="${build.dir}/zookeeper-${version}-${name}.jar"
+      basedir="${build.classes}"      
+    />
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- Package a contrib's files                              -->
+  <!-- ====================================================== -->
+  <target name="package" depends="jar" unless="skip.contrib"> 
+    <echo message="contrib: ${name}"/>
+
+    <mkdir dir="${dist.dir}${package.share}/contrib/${name}"/>
+    <copy todir="${dist.dir}${package.share}/contrib/${name}" includeEmptyDirs="false"
+          flatten="true">
+      <fileset dir="${build.dir}">
+        <include name="zookeeper-${version}-${name}.jar" />
+      </fileset>
+    </copy>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- Package a contrib's files                              -->
+  <!-- ====================================================== -->
+  <target name="package-native" depends="jar" unless="skip.contrib">
+    <echo message="contrib: ${name}"/>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- rpm a contrib's files                                  -->
+  <!-- ====================================================== -->
+  <target name="rpm" depends="jar" unless="skip.contrib"> 
+    <echo message="contrib: ${name}"/>
+
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- deb a contrib's files                                  -->
+  <!-- ====================================================== -->
+  <target name="deb" depends="jar" unless="skip.contrib"> 
+    <echo message="contrib: ${name}"/>
+
+  </target>
+  <!-- ================================================================== -->
+  <!-- Clean.  Delete the build files, and their directories              -->
+  <!-- ================================================================== -->
+  <target name="clean">
+    <echo message="contrib: ${name}"/>
+    <delete dir="${build.dir}"/>
+  </target>
+
+
+  <!-- ================================================================== -->
+  <!-- Utility features                                                   -->
+  <!-- ================================================================== -->
+
+  <target name="checkMainIsAvailable">
+    <available classname="org.apache.zookeeper.ZooKeeperMain"
+               property="mainIsCompiled">
+      <!-- we can't use id=classpath, because available fails if fileset directory
+           doesn't exist -->
+      <classpath>
+        <pathelement location="${zk.root}/build/classes"/>
+      </classpath>
+    </available>
+  </target>
+
+  <target name="checkMainCompiled" unless="mainIsCompiled" depends="checkMainIsAvailable">
+    <fail message="ZooKeeper main must first be compiled (toplevel build.xml)"/>
+  </target>
+
+
+  <target name="checkMainTestIsAvailable">
+    <available file="${zk.root}/build/test/classes/org/apache/zookeeper/test/ClientBase.class"
+               property="mainTestIsCompiled">
+    </available>
+  </target>
+
+  <target name="checkMainTestCompiled" unless="mainTestIsCompiled" depends="checkMainTestIsAvailable">
+    <fail message="ZooKeeper test must first be compiled (toplevel build.xml) using 'ant compile-test'"/>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- Ivy                                                    -->
+  <!-- ====================================================== -->
+  <target name="ivy-download" unless="ivy.jar.exists" depends="init">
+    <delete dir="${lib.dir}"
+            includes="ivy-*.jar" excludes="ivy-${ivy.version}.jar"/>
+    <get src="${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar"
+         dest="${lib.dir}/ivy-${ivy.version}.jar" usetimestamp="true"/>
+  </target>
+
+  <target name="ivy-init" depends="ivy-download" unless="ivy.initialized">
+    <taskdef resource="org/apache/ivy/ant/antlib.xml"
+             uri="antlib:org.apache.ivy.ant" classpathref="classpath"/>
+    <!-- ensure that ivy taskdef is only run once, otw ant will error -->
+    <property name="ivy.initialized" value="true"/>
+    <ivy:settings id="${ant.project.name}" file="${ivysettings.xml}"/> 
+  </target>
+
+  <target name="ivy-retrieve" depends="init,ivy-init">
+    <ivy:retrieve settingsRef="${ant.project.name}" type="jar" conf="default"
+                  pattern="${ivy.lib}/[artifact]-[revision].[ext]"/>
+    <ivy:retrieve settingsRef="${ant.project.name}" type="bundle" conf="default"
+  				  pattern="${ivy.lib}/[artifact]-[revision].[ext]"/>
+  </target>
+
+  <target name="ivy-retrieve-test" depends="init,ivy-init">
+    <ivy:retrieve settingsRef="${ant.project.name}" type="jar" conf="test"
+                  pattern="${ivy.test.lib}/[artifact]-[revision].[ext]"/>
+  </target>
+
+
+</project>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/build.xml
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/build.xml b/zookeeper-contrib/build.xml
new file mode 100644
index 0000000..7f7ba4f
--- /dev/null
+++ b/zookeeper-contrib/build.xml
@@ -0,0 +1,88 @@
+<?xml version="1.0"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<project name="zookeepercontrib" default="compile" basedir=".">
+
+  <property name="contribfilesetincludes" value="*/build.xml" />
+  <property name="contribfilesetexcludes" value="" />
+
+  <fileset id="contribfileset" dir=".">
+    <include name="${contribfilesetincludes}"/>
+    <exclude name="${contribfilesetexcludes}"/>
+  </fileset>
+
+  <!-- In case one of the contrib subdirectories -->
+  <!-- fails the build or test targets and you cannot fix it: -->
+  <!-- Then add to fileset: excludes="badcontrib/build.xml" -->
+
+  <!-- ====================================================== -->
+  <!-- Compile contribs.                                      -->
+  <!-- ====================================================== -->
+  <target name="compile">
+    <subant target="jar">
+      <fileset refid="contribfileset" />
+    </subant>
+  </target>
+  
+  <!-- ====================================================== -->
+  <!-- Package contrib jars.                                  -->
+  <!-- ====================================================== -->
+  <target name="package">
+    <subant target="package">
+      <fileset refid="contribfileset" />
+    </subant>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- Test all the contribs.                               -->
+  <!-- ====================================================== -->
+  <target name="test">
+    <subant target="test">
+      <fileset refid="contribfileset" />
+    </subant>
+  </target>
+  
+  
+  <!-- ====================================================== -->
+  <!-- Clean all the contribs.                              -->
+  <!-- ====================================================== -->
+  <target name="clean">
+    <subant target="clean">
+      <fileset refid="contribfileset" />
+    </subant>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- rpm all the contribs.                                  -->
+  <!-- ====================================================== -->
+  <target name="rpm">
+    <subant target="rpm">
+      <fileset refid="contribfileset" />
+    </subant>
+  </target>
+
+  <!-- ====================================================== -->
+  <!-- deb all the contribs.                                  -->
+  <!-- ====================================================== -->
+  <target name="deb">
+    <subant target="deb">
+      <fileset refid="contribfileset" />
+    </subant>
+  </target>
+</project>

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/zookeeper-contrib-fatjar/README.txt
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-fatjar/README.txt b/zookeeper-contrib/zookeeper-contrib-fatjar/README.txt
new file mode 100644
index 0000000..f8027ae
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-fatjar/README.txt
@@ -0,0 +1,2 @@
+This package contains build to create a fat zookeeper jar. You need to run ant to create the fat jar.
+To run the fatjar you can use. java -jar zoookeeper-*fatjar.jar 

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/zookeeper-contrib-fatjar/build.xml
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-fatjar/build.xml b/zookeeper-contrib/zookeeper-contrib-fatjar/build.xml
new file mode 100644
index 0000000..6f34a92
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-fatjar/build.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+
+<project name="fatjar" default="jar">
+  <import file="../build-contrib.xml"/>
+
+  <target name="setjarname">
+    <property name="jarname"
+              value="${build.dir}/zookeeper-${version}-${name}.jar"/>
+  </target>
+
+  <!-- Override jar target to specify main class -->
+  <target name="jar" depends="checkMainCompiled, setjarname, compile">
+    <echo message="contrib: ${name}"/>
+    <jar jarfile="${jarname}">
+      <manifest>
+        <attribute name="Main-Class" value="org.apache.zookeeper.util.FatJarMain" />
+        <attribute name="Built-By" value="${user.name}"/>
+        <attribute name="Built-At" value="${build.time}"/>
+        <attribute name="Built-On" value="${host.name}" />
+        <attribute name="Implementation-Title" value="org.apache.zookeeper"/>
+        <attribute name="Implementation-Version" value="${revision}"/>
+        <attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
+      </manifest>
+      <fileset file="${basedir}/src/main/resources/mainClasses" />
+      <fileset dir="${build.classes}"/>
+      <fileset dir="${build.test}"/>
+      <fileset file="${zk.root}/LICENSE.txt" />
+      <fileset file="${zk.root}/conf/log4j.properties" />
+      <fileset dir="${zk.root}/build/classes" excludes="**/.generated"/>
+      <fileset dir="${zk.root}/build/test/classes"/>
+      <zipgroupfileset dir="${zk.root}/build/lib" includes="*.jar" />
+      <zipgroupfileset dir="${zk.root}/build/test/lib" includes="*.jar" />
+      <zipgroupfileset dir="${zk.root}/src/java/lib" includes="*.jar" />
+    </jar>
+  </target>
+
+  <target name="package" depends="jar, zookeeperbuildcontrib.package"
+          unless="skip.contrib">
+
+    <copy file="${basedir}/build.xml" todir="${dist.dir}/contrib/${name}"/>
+
+    <mkdir dir="${dist.dir}/contrib/${name}/conf"/>
+    <copy todir="${dist.dir}/contrib/${name}/conf">
+      <fileset dir="${basedir}/src/main/resources"/>
+    </copy>
+
+    <mkdir dir="${dist.dir}/contrib/${name}/src"/>
+    <copy todir="${dist.dir}/contrib/${name}/src">
+      <fileset dir="${basedir}/src"/>
+    </copy>
+  </target>
+
+	<target name="test">
+		<echo message="No test target defined for this package" />
+	</target>
+</project>
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/java/org/apache/zookeeper/util/FatJarMain.java
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/java/org/apache/zookeeper/util/FatJarMain.java b/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/java/org/apache/zookeeper/util/FatJarMain.java
new file mode 100644
index 0000000..bdf0eae
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/java/org/apache/zookeeper/util/FatJarMain.java
@@ -0,0 +1,126 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zookeeper.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * This is a generic Main class that is completely driven by the
+ * /mainClasses resource on the class path. This resource has the
+ * format:
+ * <pre>
+ * cmd:mainClass:Description
+ * </pre>
+ * Any lines starting with # will be skipped
+ *
+ */
+public class FatJarMain {
+    static class Cmd {
+        Cmd(String cmd, String clazz, String desc) {
+            this.cmd = cmd;
+            this.clazz = clazz;
+            this.desc = desc;
+        }
+        String cmd;
+        String clazz;
+        String desc;
+    }
+    static HashMap<String, Cmd> cmds = new HashMap<String, Cmd>();
+    static ArrayList<String> order = new ArrayList<String>();
+    
+    /**
+     * @param args the first parameter of args will be used as an
+     * index into the /mainClasses resource. The rest will be passed
+     * to the mainClass to run.
+     * @throws IOException 
+     * @throws ClassNotFoundException 
+     * @throws NoSuchMethodException 
+     * @throws SecurityException 
+     * @throws IllegalAccessException 
+     * @throws IllegalArgumentException 
+     */
+    public static void main(String[] args) throws IOException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException {
+        InputStream is = FatJarMain.class.getResourceAsStream("/mainClasses");
+        if (is == null) {
+            System.err.println("Couldn't find /mainClasses in classpath.");
+            System.exit(3);
+        }
+        BufferedReader br = new BufferedReader(new InputStreamReader(is));
+        String line;
+        while((line = br.readLine()) != null) {
+            String parts[] = line.split(":", 3);
+            if (parts.length != 3 || (parts[0].length() > 0 && parts[0].charAt(0) == '#')) {
+                continue;
+            }
+            if (parts[0].length() > 0) {
+                cmds.put(parts[0], new Cmd(parts[0], parts[1], parts[2]));
+                // We use the order array to preserve the order of the commands
+                // for help. The hashmap will not preserver order. (It may be overkill.)
+                order.add(parts[0]);
+            } else {
+                // Just put the description in
+                order.add(parts[2]);
+            }
+        }
+        if (args.length == 0) {
+            doHelp();
+            return;
+        }
+        Cmd cmd = cmds.get(args[0]);
+        if (cmd == null) {
+            doHelp();
+            return;
+        }
+        Class<?> clazz = Class.forName(cmd.clazz);
+        Method main = clazz.getMethod("main", String[].class);
+        String newArgs[] = new String[args.length-1];
+        System.arraycopy(args, 1, newArgs, 0, newArgs.length);
+        try {
+            main.invoke(null, (Object)newArgs);
+        } catch(InvocationTargetException e) {
+            if (e.getCause() != null) {
+                e.getCause().printStackTrace();
+            } else {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    private static void doHelp() {
+        System.err.println("USAGE: FatJarMain cmd args");
+        System.err.println("Available cmds:");
+        for(String c: order) {
+            Cmd cmd = cmds.get(c);
+            if (cmd != null) {
+                System.err.println("  " + c + " " + cmd.desc);
+            } else {
+                System.err.println(c);
+            }
+        }
+        System.exit(2);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/resources/mainClasses
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/resources/mainClasses b/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/resources/mainClasses
new file mode 100644
index 0000000..2b0fc83
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-fatjar/src/main/resources/mainClasses
@@ -0,0 +1,10 @@
+::Client Commands
+client:org.apache.zookeeper.ZooKeeperMain:Client shell to ZooKeeper
+::Server Commands
+server:org.apache.zookeeper.server.quorum.QuorumPeerMain:Start ZooKeeper server
+::Test Commands
+generateLoad:org.apache.zookeeper.test.system.GenerateLoad:A distributed load generator for testing
+quorumBench:org.apache.zookeeper.server.QuorumBenchmark:A benchmark of just the quorum protocol
+abBench:org.apache.zookeeper.server.quorum.AtomicBroadcastBenchmark:A benchmark of just the atomic broadcast
+ic:org.apache.zookeeper.test.system.InstanceContainer:A container that will instantiate classes as directed by an instance manager
+systest:org.apache.zookeeper.test.system.BaseSysTest:Start system test

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/zookeeper-contrib-huebrowser/README
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-huebrowser/README b/zookeeper-contrib/zookeeper-contrib-huebrowser/README
new file mode 100644
index 0000000..c03ea90
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-huebrowser/README
@@ -0,0 +1,62 @@
+
+ZooKeeper Browser - Hue Application
+===================================
+
+The ZooKeeper Browser application allows you to see how the cluster nodes are working and also allows you to do CRUD operations on the znode hierarchy.
+
+Requirements
+------------
+
+Hue-1.0:
+  * http://github.com/downloads/cloudera/hue/hue-1.0.tgz
+  * http://github.com/downloads/cloudera/hue/release-notes-1.0.html
+
+ZooKeeper REST gateway:
+  * available as contrib: contrib/rest
+
+How to install?
+---------------
+
+First of all you need to install Hue 1.0 release:
+
+  * http://archive.cloudera.com/cdh/3/hue/sdk/sdk.html
+  * http://github.com/cloudera/hue/tree/release-1.0
+
+After you finish the previous step you should copy the zkui/ folder to apps/ and register the new application:
+
+  * $ ./build/env/bin/python tools/app_reg/app_reg.py --install apps/zkui
+  * $ ./build/env/bin/python tools/app_reg/app_reg.py --list 2>&1 | grep zkui
+    zkui           0.1     /Users/philip/src/hue/apps/zkui
+
+
+And restart the Hue application server.
+
+Configuration
+-------------
+
+Edit zkui/src/zkui/settings.py:
+
+CLUSTERS = [{
+        'nice_name': 'Default',
+        'hostport': 'localhost:2181,localhost:2182,localhost:2183',
+        'rest_gateway': 'http://localhost:9998'
+    }, {
+      # ... and more clusters
+    }
+]
+
+What is Hue?
+------------
+
+Wiki: http://wiki.github.com/cloudera/hue/
+Main Repo: http://github.com/cloudera/hue 
+
+Hue is both a web UI for Hadoop and a framework to create interactive web applications. It features a FileBrowser for accessing HDFS, JobSub and JobBrowser applications for submitting and viewing MapReduce jobs, a Beeswax application for interacting with Hive. On top of that, the web frontend is mostly built from declarative widgets that require no JavaScript and are easy to learn.
+
+What is ZooKeeper?
+------------------
+
+http://zookeeper.apache.org/
+
+ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications. Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that are inevitable. Because of the difficulty of implementing these kinds of services, applications initially usually skimp on them ,which make them brittle in the presence of change and difficult to manage. Even when done correctly, different implementations of these services lead to management complexity when the applications are deployed.
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/Makefile
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/Makefile b/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/Makefile
new file mode 100644
index 0000000..9c22d1c
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/Makefile
@@ -0,0 +1,21 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+ifeq ($(ROOT),)
+  $(error "Error: Expect the environment variable $$ROOT to point to the Desktop installation")
+endif
+
+include $(ROOT)/Makefile.sdk

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/63aaf0a1/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/setup.py
----------------------------------------------------------------------
diff --git a/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/setup.py b/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/setup.py
new file mode 100644
index 0000000..68d1352
--- /dev/null
+++ b/zookeeper-contrib/zookeeper-contrib-huebrowser/zkui/setup.py
@@ -0,0 +1,46 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from setuptools import setup, find_packages
+import os
+
+def expand_package_data(src_dirs, strip=""):
+  ret = []
+  for src_dir in src_dirs:
+    for path, dnames, fnames in os.walk(src_dir):
+      for fname in fnames:
+        ret.append(os.path.join(path, fname).replace(strip, ""))
+  return ret
+
+os.chdir(os.path.dirname(os.path.abspath(__file__)))
+setup(
+  name = "zkui",
+  version = "0.1",
+  url = 'http://zookeeper.apache.org/',
+  description = 'ZooKeeper Browser',
+  packages = find_packages('src'),
+  package_dir = {'': 'src'},
+  install_requires = ['setuptools', 'desktop'],
+  entry_points = { 'desktop.sdk.application': 'zkui=zkui' },
+  zip_safe = False,
+  package_data = {
+    # Include static resources.  Package_data doesn't
+    # deal well with directory globs, so we enumerate
+    # the files manually.
+    'zkui': expand_package_data(
+      ["src/zkui/templates", "src/zkui/static"],
+      "src/zkui/")
+  }
+)


Mime
View raw message