You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by an...@apache.org on 2018/10/05 13:36:59 UTC

[31/51] [partial] zookeeper git commit: ZOOKEEPER-3032: MAVEN MIGRATION - branch-3.5 - move java server, client

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/AdminServerFactory.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/AdminServerFactory.java b/src/java/main/org/apache/zookeeper/server/admin/AdminServerFactory.java
deleted file mode 100644
index 80852ab..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/AdminServerFactory.java
+++ /dev/null
@@ -1,63 +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.server.admin;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Factory class for creating an AdminServer.
- */
-public class AdminServerFactory {
-    private static final Logger LOG = LoggerFactory.getLogger(AdminServerFactory.class);
-
-    /**
-     * This method encapsulates the logic for whether we should use a
-     * JettyAdminServer (i.e., the AdminServer is enabled) or a DummyAdminServer
-     * (i.e., the AdminServer is disabled). It uses reflection when attempting
-     * to create a JettyAdminServer, rather than referencing the class directly,
-     * so that it's ok to omit Jetty from the classpath if a user doesn't wish
-     * to pull in Jetty with ZooKeeper.
-     */
-    public static AdminServer createAdminServer() {
-        if (!"false".equals(System.getProperty("zookeeper.admin.enableServer"))) {
-            try {
-                Class<?> jettyAdminServerC = Class.forName("org.apache.zookeeper.server.admin.JettyAdminServer");
-                Object adminServer = jettyAdminServerC.getConstructor().newInstance();
-                return (AdminServer) adminServer;
-
-            } catch (ClassNotFoundException e) {
-                LOG.warn("Unable to start JettyAdminServer", e);
-            } catch (InstantiationException e) {
-                LOG.warn("Unable to start JettyAdminServer", e);
-            } catch (IllegalAccessException e) {
-                LOG.warn("Unable to start JettyAdminServer", e);
-            } catch (InvocationTargetException e) {
-                LOG.warn("Unable to start JettyAdminServer", e);
-            } catch (NoSuchMethodException e) {
-                LOG.warn("Unable to start JettyAdminServer", e);
-            } catch (NoClassDefFoundError e) {
-                LOG.warn("Unable to load jetty, not starting JettyAdminServer", e);
-            }
-        }
-        return new DummyAdminServer();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/Command.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/Command.java b/src/java/main/org/apache/zookeeper/server/admin/Command.java
deleted file mode 100644
index d06af89..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/Command.java
+++ /dev/null
@@ -1,68 +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.server.admin;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.zookeeper.server.ZooKeeperServer;
-
-/**
- * Interface implemented by all commands runnable by JettyAdminServer.
- *
- * @see CommandBase
- * @see Commands
- * @see JettyAdminServer
- */
-public interface Command {
-    /**
-     * The set of all names that can be used to refer to this command (e.g.,
-     * "configuration", "config", and "conf").
-     */
-    Set<String> getNames();
-
-    /**
-     * The name that is returned with the command response and that appears in
-     * the list of all commands. This should be a member of the set returned by
-     * getNames().
-     */
-    String getPrimaryName();
-
-    /**
-     * A string documentating this command (e.g., what it does, any arguments it
-     * takes).
-     */
-    String getDoc();
-
-    /**
-     * Run this command. Commands take a ZooKeeperServer and String-valued
-     * keyword arguments and return a map containing any information
-     * constituting the response to the command. Commands are responsible for
-     * parsing keyword arguments and performing any error handling if necessary.
-     * Errors should be reported by setting the "error" entry of the returned
-     * map with an appropriate message rather than throwing an exception.
-     *
-     * @param zkServer
-     * @param kwargs keyword -> argument value mapping
-     * @return Map representing response to command containing at minimum:
-     *    - "command" key containing the command's primary name
-     *    - "error" key containing a String error message or null if no error
-     */
-    CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs);
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/CommandBase.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/CommandBase.java b/src/java/main/org/apache/zookeeper/server/admin/CommandBase.java
deleted file mode 100644
index b5f1bee..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/CommandBase.java
+++ /dev/null
@@ -1,66 +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.server.admin;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public abstract class CommandBase implements Command {
-    private final String primaryName;
-    private final Set<String> names;
-    private final String doc;
-
-    /**
-     * @param names The possible names of this command, with the primary name first.
-     */
-    protected CommandBase(List<String> names) {
-        this(names, null);
-    }
-
-    protected CommandBase(List<String> names, String doc) {
-        this.primaryName = names.get(0);
-        this.names = new HashSet<String>(names);
-        this.doc = doc;
-    }
-
-    @Override
-    public String getPrimaryName() {
-        return primaryName;
-    }
-
-    @Override
-    public Set<String> getNames() {
-        return names;
-    }
-
-    @Override
-    public String getDoc() {
-        return doc;
-    }
-
-    /**
-     * @return A response with the command set to the primary name and the
-     *         error set to null (these are the two entries that all command
-     *         responses are required to include).
-     */
-    protected CommandResponse initializeResponse() {
-        return new CommandResponse(primaryName);
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/CommandOutputter.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/CommandOutputter.java b/src/java/main/org/apache/zookeeper/server/admin/CommandOutputter.java
deleted file mode 100644
index 88f695e..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/CommandOutputter.java
+++ /dev/null
@@ -1,35 +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.server.admin;
-
-import java.io.PrintWriter;
-import java.util.Map;
-
-/**
- * CommandOutputters are used to format the responses from Commands.
- *
- * @see Command
- * @see JettyAdminServer
- */
-public interface CommandOutputter {
-    /** The MIME type of this output (e.g., "application/json") */
-    String getContentType();
-
-    void output(CommandResponse response, PrintWriter pw);
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/CommandResponse.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/CommandResponse.java b/src/java/main/org/apache/zookeeper/server/admin/CommandResponse.java
deleted file mode 100644
index f4e2499..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/CommandResponse.java
+++ /dev/null
@@ -1,112 +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.server.admin;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * A response from running a {@link Command}.
- */
-public class CommandResponse {
-
-    /**
-     * The key in the map returned by {@link #toMap()} for the command name.
-     */
-    public static final String KEY_COMMAND = "command";
-    /**
-     * The key in the map returned by {@link #toMap()} for the error string.
-     */
-    public static final String KEY_ERROR = "error";
-
-    private final String command;
-    private final String error;
-    private final Map<String, Object> data;
-
-    /**
-     * Creates a new response with no error string.
-     *
-     * @param command command name
-     */
-    public CommandResponse(String command) {
-        this(command, null);
-    }
-    /**
-     * Creates a new response.
-     *
-     * @param command command name
-     * @param error error string (may be null)
-     */
-    public CommandResponse(String command, String error) {
-        this.command = command;
-        this.error = error;
-        data = new LinkedHashMap<String, Object>();
-    }
-
-    /**
-     * Gets the command name.
-     *
-     * @return command name
-     */
-    public String getCommand() {
-        return command;
-    }
-
-    /**
-     * Gets the error string (may be null).
-     *
-     * @return error string
-     */
-    public String getError() {
-        return error;
-    }
-
-    /**
-     * Adds a key/value pair to this response.
-     *
-     * @param key key
-     * @param value value
-     * @return prior value for key, or null if none
-     */
-    public Object put(String key, Object value) {
-        return data.put(key, value);
-    }
-
-    /**
-     * Adds all key/value pairs in the given map to this response.
-     *
-     * @param m map of key/value pairs
-     */
-    public void putAll(Map<? extends String,?> m) {
-        data.putAll(m);
-    }
-
-    /**
-     * Converts this response to a map. The returned map is mutable, and
-     * changes to it do not reflect back into this response.
-     *
-     * @return map representation of response
-     */
-    public Map<String, Object> toMap() {
-        Map<String, Object> m = new LinkedHashMap<String, Object>(data);
-        m.put(KEY_COMMAND, command);
-        m.put(KEY_ERROR, error);
-        m.putAll(data);
-        return m;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/Commands.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/Commands.java b/src/java/main/org/apache/zookeeper/server/admin/Commands.java
deleted file mode 100644
index f83b2f4..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/Commands.java
+++ /dev/null
@@ -1,539 +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.server.admin;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.zookeeper.Environment;
-import org.apache.zookeeper.Environment.Entry;
-import org.apache.zookeeper.Version;
-import org.apache.zookeeper.server.DataTree;
-import org.apache.zookeeper.server.ServerCnxnFactory;
-import org.apache.zookeeper.server.ServerStats;
-import org.apache.zookeeper.server.ZKDatabase;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.ZooTrace;
-import org.apache.zookeeper.server.quorum.Leader;
-import org.apache.zookeeper.server.quorum.LeaderZooKeeperServer;
-import org.apache.zookeeper.server.quorum.ReadOnlyZooKeeperServer;
-import org.apache.zookeeper.server.util.OSMXBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Class containing static methods for registering and running Commands, as well
- * as default Command definitions.
- *
- * @see Command
- * @see JettyAdminServer
- */
-public class Commands {
-    static final Logger LOG = LoggerFactory.getLogger(Commands.class);
-
-    /** Maps command names to Command instances */
-    private static Map<String, Command> commands = new HashMap<String, Command>();
-    private static Set<String> primaryNames = new HashSet<String>();
-
-    /**
-     * Registers the given command. Registered commands can be run by passing
-     * any of their names to runCommand.
-     */
-    public static void registerCommand(Command command) {
-        for (String name : command.getNames()) {
-            Command prev = commands.put(name, command);
-            if (prev != null) {
-                LOG.warn("Re-registering command %s (primary name = %s)", name, command.getPrimaryName());
-            }
-        }
-        primaryNames.add(command.getPrimaryName());
-    }
-
-    /**
-     * Run the registered command with name cmdName. Commands should not produce
-     * any exceptions; any (anticipated) errors should be reported in the
-     * "error" entry of the returned map. Likewise, if no command with the given
-     * name is registered, this will be noted in the "error" entry.
-     *
-     * @param cmdName
-     * @param zkServer
-     * @param kwargs String-valued keyword arguments to the command
-     *        (may be null if command requires no additional arguments)
-     * @return Map representing response to command containing at minimum:
-     *    - "command" key containing the command's primary name
-     *    - "error" key containing a String error message or null if no error
-     */
-    public static CommandResponse runCommand(String cmdName, ZooKeeperServer zkServer, Map<String, String> kwargs) {
-        if (!commands.containsKey(cmdName)) {
-            return new CommandResponse(cmdName, "Unknown command: " + cmdName);
-        }
-        if (zkServer == null || !zkServer.isRunning()) {
-            return new CommandResponse(cmdName, "This ZooKeeper instance is not currently serving requests");
-        }
-        return commands.get(cmdName).run(zkServer, kwargs);
-    }
-
-    /**
-     * Returns the primary names of all registered commands.
-     */
-    public static Set<String> getPrimaryNames() {
-        return primaryNames;
-    }
-
-    /**
-     * Returns the commands registered under cmdName with registerCommand, or
-     * null if no command is registered with that name.
-     */
-    public static Command getCommand(String cmdName) {
-        return commands.get(cmdName);
-    }
-
-    static {
-        registerCommand(new CnxnStatResetCommand());
-        registerCommand(new ConfCommand());
-        registerCommand(new ConsCommand());
-        registerCommand(new DirsCommand());
-        registerCommand(new DumpCommand());
-        registerCommand(new EnvCommand());
-        registerCommand(new GetTraceMaskCommand());
-        registerCommand(new IsroCommand());
-        registerCommand(new MonitorCommand());
-        registerCommand(new RuokCommand());
-        registerCommand(new SetTraceMaskCommand());
-        registerCommand(new SrvrCommand());
-        registerCommand(new StatCommand());
-        registerCommand(new StatResetCommand());
-        registerCommand(new WatchCommand());
-        registerCommand(new WatchesByPathCommand());
-        registerCommand(new WatchSummaryCommand());
-    }
-
-    /**
-     * Reset all connection statistics.
-     */
-    public static class CnxnStatResetCommand extends CommandBase {
-        public CnxnStatResetCommand() {
-            super(Arrays.asList("connection_stat_reset", "crst"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            zkServer.getServerCnxnFactory().resetAllConnectionStats();
-            return response;
-
-        }
-    }
-
-    /**
-     * Server configuration parameters.
-     * @see ZooKeeperServer#getConf()
-     */
-    public static class ConfCommand extends CommandBase {
-        public ConfCommand() {
-            super(Arrays.asList("configuration", "conf", "config"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            response.putAll(zkServer.getConf().toMap());
-            return response;
-        }
-    }
-
-    /**
-     * Information on client connections to server. Returned Map contains:
-     *   - "connections": list of connection info objects
-     * @see org.apache.zookeeper.server.ServerCnxn#getConnectionInfo(boolean)
-     */
-    public static class ConsCommand extends CommandBase {
-        public ConsCommand() {
-            super(Arrays.asList("connections", "cons"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            ServerCnxnFactory serverCnxnFactory = zkServer.getServerCnxnFactory();
-            if (serverCnxnFactory != null) {
-                response.put("connections", serverCnxnFactory.getAllConnectionInfo(false));
-            } else {
-                response.put("connections", Collections.emptyList());
-            }
-            ServerCnxnFactory secureServerCnxnFactory = zkServer.getSecureServerCnxnFactory();
-            if (secureServerCnxnFactory != null) {
-                response.put("secure_connections", secureServerCnxnFactory.getAllConnectionInfo(false));
-            } else {
-                response.put("secure_connections", Collections.emptyList());
-            }
-            return response;
-        }
-    }
-
-    /**
-     * Information on ZK datadir and snapdir size in bytes
-     */
-    public static class DirsCommand extends CommandBase {
-        public DirsCommand() {
-            super(Arrays.asList("dirs"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            response.put("datadir_size", zkServer.getDataDirSize());
-            response.put("logdir_size", zkServer.getLogDirSize());
-            return response;
-        }
-    }
-
-    /**
-     * Information on session expirations and ephemerals. Returned map contains:
-     *   - "expiry_time_to_session_ids": Map<Long, Set<Long>>
-     *                                   time -> sessions IDs of sessions that expire at time
-     *   - "sesssion_id_to_ephemeral_paths": Map<Long, Set<String>>
-     *                                       session ID -> ephemeral paths created by that session
-     * @see ZooKeeperServer#getSessionExpiryMap()
-     * @see ZooKeeperServer#getEphemerals()
-     */
-    public static class DumpCommand extends CommandBase {
-        public DumpCommand() {
-            super(Arrays.asList("dump"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            response.put("expiry_time_to_session_ids", zkServer.getSessionExpiryMap());
-            response.put("session_id_to_ephemeral_paths", zkServer.getEphemerals());
-            return response;
-        }
-    }
-
-    /**
-     * All defined environment variables.
-     */
-    public static class EnvCommand extends CommandBase {
-        public EnvCommand() {
-            super(Arrays.asList("environment", "env", "envi"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            for (Entry e : Environment.list()) {
-                response.put(e.getKey(), e.getValue());
-            }
-            return response;
-        }
-    }
-
-    /**
-     * The current trace mask. Returned map contains:
-     *   - "tracemask": Long
-     */
-    public static class GetTraceMaskCommand extends CommandBase {
-        public GetTraceMaskCommand() {
-            super(Arrays.asList("get_trace_mask", "gtmk"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            response.put("tracemask", ZooTrace.getTextTraceLevel());
-            return response;
-        }
-    }
-
-    /**
-     * Is this server in read-only mode. Returned map contains:
-     *   - "is_read_only": Boolean
-     */
-    public static class IsroCommand extends CommandBase {
-        public IsroCommand() {
-            super(Arrays.asList("is_read_only", "isro"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            response.put("read_only", zkServer instanceof ReadOnlyZooKeeperServer);
-            return response;
-        }
-    }
-
-    /**
-     * Some useful info for monitoring. Returned map contains:
-     *   - "version": String
-     *                server version
-     *   - "avg_latency": Long
-     *   - "max_latency": Long
-     *   - "min_latency": Long
-     *   - "packets_received": Long
-     *   - "packets_sents": Long
-     *   - "num_alive_connections": Integer
-     *   - "outstanding_requests": Long
-     *                             number of unprocessed requests
-     *   - "server_state": "leader", "follower", or "standalone"
-     *   - "znode_count": Integer
-     *   - "watch_count": Integer
-     *   - "ephemerals_count": Integer
-     *   - "approximate_data_size": Long
-     *   - "open_file_descriptor_count": Long (unix only)
-     *   - "max_file_descritpor_count": Long (unix only)
-     *   - "fsync_threshold_exceed_count": Long
-     *   - "followers": Integer (leader only)
-     *   - "synced_followers": Integer (leader only)
-     *   - "pending_syncs": Integer (leader only)
-     */
-    public static class MonitorCommand extends CommandBase {
-        public MonitorCommand() {
-            super(Arrays.asList("monitor", "mntr"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            ZKDatabase zkdb = zkServer.getZKDatabase();
-            ServerStats stats = zkServer.serverStats();
-
-            CommandResponse response = initializeResponse();
-
-            response.put("version", Version.getFullVersion());
-
-            response.put("avg_latency", stats.getAvgLatency());
-            response.put("max_latency", stats.getMaxLatency());
-            response.put("min_latency", stats.getMinLatency());
-
-            response.put("packets_received", stats.getPacketsReceived());
-            response.put("packets_sent", stats.getPacketsSent());
-            response.put("num_alive_connections", stats.getNumAliveClientConnections());
-
-            response.put("outstanding_requests", stats.getOutstandingRequests());
-
-            response.put("server_state", stats.getServerState());
-            response.put("znode_count", zkdb.getNodeCount());
-
-            response.put("watch_count", zkdb.getDataTree().getWatchCount());
-            response.put("ephemerals_count", zkdb.getDataTree().getEphemeralsCount());
-            response.put("approximate_data_size", zkdb.getDataTree().approximateDataSize());
-
-            OSMXBean osMbean = new OSMXBean();
-            response.put("open_file_descriptor_count", osMbean.getOpenFileDescriptorCount());
-            response.put("max_file_descriptor_count", osMbean.getMaxFileDescriptorCount());
-
-            response.put("last_client_response_size", stats.getClientResponseStats().getLastBufferSize());
-            response.put("max_client_response_size", stats.getClientResponseStats().getMaxBufferSize());
-            response.put("min_client_response_size", stats.getClientResponseStats().getMinBufferSize());
-
-            if (zkServer instanceof LeaderZooKeeperServer) {
-                Leader leader = ((LeaderZooKeeperServer) zkServer).getLeader();
-
-                response.put("followers", leader.getLearners().size());
-                response.put("synced_followers", leader.getForwardingFollowers().size());
-                response.put("pending_syncs", leader.getNumPendingSyncs());
-
-                response.put("last_proposal_size", leader.getProposalStats().getLastBufferSize());
-                response.put("max_proposal_size", leader.getProposalStats().getMaxBufferSize());
-                response.put("min_proposal_size", leader.getProposalStats().getMinBufferSize());
-            }
-
-            return response;
-
-        }}
-
-    /**
-     * No-op command, check if the server is running
-     */
-    public static class RuokCommand extends CommandBase {
-        public RuokCommand() {
-            super(Arrays.asList("ruok"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            return initializeResponse();
-        }
-    }
-
-    /**
-     * Sets the trace mask. Required arguments:
-     *   - "traceMask": Long
-     *  Returned Map contains:
-     *   - "tracemask": Long
-     */
-    public static class SetTraceMaskCommand extends CommandBase {
-        public SetTraceMaskCommand() {
-            super(Arrays.asList("set_trace_mask", "stmk"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            long traceMask;
-            if (!kwargs.containsKey("traceMask")) {
-                response.put("error", "setTraceMask requires long traceMask argument");
-                return response;
-            }
-            try {
-                traceMask = Long.parseLong(kwargs.get("traceMask"));
-            } catch (NumberFormatException e) {
-                response.put("error", "setTraceMask requires long traceMask argument, got "
-                                      + kwargs.get("traceMask"));
-                return response;
-            }
-
-            ZooTrace.setTextTraceLevel(traceMask);
-            response.put("tracemask", traceMask);
-            return response;
-        }
-    }
-
-    /**
-     * Server information. Returned map contains:
-     *   - "version": String
-     *                version of server
-     *   - "read_only": Boolean
-     *                  is server in read-only mode
-     *   - "server_stats": ServerStats object
-     *   - "node_count": Integer
-     */
-    public static class SrvrCommand extends CommandBase {
-        public SrvrCommand() {
-            super(Arrays.asList("server_stats", "srvr"));
-        }
-
-        // Allow subclasses (e.g. StatCommand) to specify their own names
-        protected SrvrCommand(List<String> names) {
-            super(names);
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            LOG.info("running stat");
-            response.put("version", Version.getFullVersion());
-            response.put("read_only", zkServer instanceof ReadOnlyZooKeeperServer);
-            response.put("server_stats", zkServer.serverStats());
-            response.put("client_response", zkServer.serverStats().getClientResponseStats());
-            if (zkServer instanceof LeaderZooKeeperServer) {
-                Leader leader = ((LeaderZooKeeperServer)zkServer).getLeader();
-                response.put("proposal_stats", leader.getProposalStats());
-            }
-            response.put("node_count", zkServer.getZKDatabase().getNodeCount());
-            return response;
-        }
-    }
-
-    /**
-     * Same as SrvrCommand but has extra "connections" entry.
-     */
-    public static class StatCommand extends SrvrCommand {
-        public StatCommand() {
-            super(Arrays.asList("stats", "stat"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = super.run(zkServer, kwargs);
-            response.put("connections", zkServer.getServerCnxnFactory().getAllConnectionInfo(true));
-            return response;
-        }
-    }
-
-    /**
-     * Resets server statistics.
-     */
-    public static class StatResetCommand extends CommandBase {
-        public StatResetCommand() {
-            super(Arrays.asList("stat_reset", "srst"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            CommandResponse response = initializeResponse();
-            zkServer.serverStats().reset();
-            return response;
-        }
-    }
-
-    /**
-     * Watch information aggregated by session. Returned Map contains:
-     *   - "session_id_to_watched_paths": Map<Long, Set<String>> session ID -> watched paths
-     * @see DataTree#getWatches()
-     */
-    public static class WatchCommand extends CommandBase {
-        public WatchCommand() {
-            super(Arrays.asList("watches", "wchc"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            DataTree dt = zkServer.getZKDatabase().getDataTree();
-            CommandResponse response = initializeResponse();
-            response.put("session_id_to_watched_paths", dt.getWatches().toMap());
-            return response;
-        }
-    }
-
-    /**
-     * Watch information aggregated by path. Returned Map contains:
-     *   - "path_to_session_ids": Map<String, Set<Long>> path -> session IDs of sessions watching path
-     * @see DataTree#getWatchesByPath()
-     */
-    public static class WatchesByPathCommand extends CommandBase {
-        public WatchesByPathCommand() {
-            super(Arrays.asList("watches_by_path", "wchp"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            DataTree dt = zkServer.getZKDatabase().getDataTree();
-            CommandResponse response = initializeResponse();
-            response.put("path_to_session_ids", dt.getWatchesByPath().toMap());
-            return response;
-        }
-    }
-
-    /**
-     * Summarized watch information.
-     * @see DataTree#getWatchesSummary()
-     */
-    public static class WatchSummaryCommand extends CommandBase {
-        public WatchSummaryCommand() {
-            super(Arrays.asList("watch_summary", "wchs"));
-        }
-
-        @Override
-        public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) {
-            DataTree dt = zkServer.getZKDatabase().getDataTree();
-            CommandResponse response = initializeResponse();
-            response.putAll(dt.getWatchesSummary().toMap());
-            return response;
-        }
-    }
-
-    private Commands() {}
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/DummyAdminServer.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/DummyAdminServer.java b/src/java/main/org/apache/zookeeper/server/admin/DummyAdminServer.java
deleted file mode 100644
index d266690..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/DummyAdminServer.java
+++ /dev/null
@@ -1,39 +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.server.admin;
-
-import org.apache.zookeeper.server.ZooKeeperServer;
-
-/**
- * An AdminServer that does nothing.
- *
- * We use this class when we wish to disable the AdminServer. (This way we only
- * have to consider whether the server is enabled when we create the
- * AdminServer, which is handled by AdminServerFactory.)
- */
-public class DummyAdminServer implements AdminServer {
-    @Override
-    public void start() throws AdminServerException {}
-
-    @Override
-    public void shutdown() throws AdminServerException {}
-
-    @Override
-    public void setZooKeeperServer(ZooKeeperServer zkServer) {}
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/JettyAdminServer.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/JettyAdminServer.java b/src/java/main/org/apache/zookeeper/server/admin/JettyAdminServer.java
deleted file mode 100644
index ff3de41..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/JettyAdminServer.java
+++ /dev/null
@@ -1,198 +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.server.admin;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class encapsulates a Jetty server for running Commands.
- *
- * Given the default settings, start a ZooKeeper server and visit
- * http://<hostname>:8080/commands for links to all registered commands. Visiting
- * http://<hostname>:8080/commands/<commandname> will execute the associated
- * Command and return the result in the body of the response. Any keyword
- * arguments to the command are specified with URL parameters (e.g.,
- * http://localhost:8080/commands/set_trace_mask?traceMask=306).
- *
- * @see Commands
- * @see CommandOutputter
- */
-public class JettyAdminServer implements AdminServer {
-    static final Logger LOG = LoggerFactory.getLogger(JettyAdminServer.class);
-
-    public static final int DEFAULT_PORT = 8080;
-    public static final int DEFAULT_IDLE_TIMEOUT = 30000;
-    public static final String DEFAULT_COMMAND_URL = "/commands";
-    private static final String DEFAULT_ADDRESS = "0.0.0.0";
-
-    private final Server server;
-    private final String address;
-    private final int port;
-    private final int idleTimeout;
-    private final String commandUrl;
-    private ZooKeeperServer zkServer;
-
-    public JettyAdminServer() throws AdminServerException {
-        this(System.getProperty("zookeeper.admin.serverAddress", DEFAULT_ADDRESS),
-             Integer.getInteger("zookeeper.admin.serverPort", DEFAULT_PORT),
-             Integer.getInteger("zookeeper.admin.idleTimeout", DEFAULT_IDLE_TIMEOUT),
-             System.getProperty("zookeeper.admin.commandURL", DEFAULT_COMMAND_URL));
-    }
-
-    public JettyAdminServer(String address, int port, int timeout, String commandUrl) {
-        this.port = port;
-        this.idleTimeout = timeout;
-        this.commandUrl = commandUrl;
-        this.address = address;
-
-        server = new Server();
-        ServerConnector connector = new ServerConnector(server);
-        connector.setHost(address);
-        connector.setPort(port);
-        connector.setIdleTimeout(idleTimeout);
-        server.addConnector(connector);
-
-        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
-        context.setContextPath("/*");
-        server.setHandler(context);
-
-        context.addServlet(new ServletHolder(new CommandServlet()), commandUrl + "/*");
-    }
-
-    /**
-     * Start the embedded Jetty server.
-     */
-    @Override
-    public void start() throws AdminServerException {
-        try {
-            server.start();
-        } catch (Exception e) {
-            // Server.start() only throws Exception, so let's at least wrap it
-            // in an identifiable subclass
-            throw new AdminServerException(String.format(
-                    "Problem starting AdminServer on address %s,"
-                            + " port %d and command URL %s", address, port,
-                    commandUrl), e);
-        }
-        LOG.info(String.format("Started AdminServer on address %s, port %d"
-                + " and command URL %s", address, port, commandUrl));
-    }
-
-    /**
-     * Stop the embedded Jetty server.
-     *
-     * This is not very important except for tests where multiple
-     * JettyAdminServers are started and may try to bind to the same ports if
-     * previous servers aren't shut down.
-     */
-    @Override
-    public void shutdown() throws AdminServerException {
-        try {
-            server.stop();
-        } catch (Exception e) {
-            throw new AdminServerException(String.format(
-                    "Problem stopping AdminServer on address %s,"
-                            + " port %d and command URL %s", address, port, commandUrl),
-                    e);
-        }
-    }
-
-    /**
-     * Set the ZooKeeperServer that will be used to run Commands.
-     *
-     * It is not necessary to set the ZK server before calling
-     * AdminServer.start(), and the ZK server can be set to null when, e.g.,
-     * that server is being shut down. If the ZK server is not set or set to
-     * null, the AdminServer will still be able to issue Commands, but they will
-     * return an error until a ZK server is set.
-     */
-    @Override
-    public void setZooKeeperServer(ZooKeeperServer zkServer) {
-        this.zkServer = zkServer;
-    }
-
-    private class CommandServlet extends HttpServlet {
-        private static final long serialVersionUID = 1L;
-
-        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-            // Capture the command name from the URL
-            String cmd = request.getPathInfo();
-            if (cmd == null || cmd.equals("/")) {
-                // No command specified, print links to all commands instead
-                for (String link : commandLinks()) {
-                    response.getWriter().println(link);
-                    response.getWriter().println("<br/>");
-                }
-                return;
-            }
-            // Strip leading "/"
-            cmd = cmd.substring(1);
-
-            // Extract keyword arguments to command from request parameters
-            @SuppressWarnings("unchecked")
-            Map<String, String[]> parameterMap = request.getParameterMap();
-            Map<String, String> kwargs = new HashMap<String, String>();
-            for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
-                kwargs.put(entry.getKey(), entry.getValue()[0]);
-            }
-
-            // Run the command
-            CommandResponse cmdResponse = Commands.runCommand(cmd, zkServer, kwargs);
-
-            // Format and print the output of the command
-            CommandOutputter outputter = new JsonOutputter();
-            response.setStatus(HttpServletResponse.SC_OK);
-            response.setContentType(outputter.getContentType());
-            outputter.output(cmdResponse, response.getWriter());
-        }
-    }
-
-    /**
-     * Returns a list of URLs to each registered Command.
-     */
-    private List<String> commandLinks() {
-        List<String> links = new ArrayList<String>();
-        List<String> commands = new ArrayList<String>(Commands.getPrimaryNames());
-        Collections.sort(commands);
-        for (String command : commands) {
-            String url = commandUrl + "/" + command;
-            links.add(String.format("<a href=\"%s\">%s</a>", url, command));
-        }
-        return links;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/admin/JsonOutputter.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/admin/JsonOutputter.java b/src/java/main/org/apache/zookeeper/server/admin/JsonOutputter.java
deleted file mode 100644
index 566444f..0000000
--- a/src/java/main/org/apache/zookeeper/server/admin/JsonOutputter.java
+++ /dev/null
@@ -1,67 +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.server.admin;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.PropertyNamingStrategy;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-public class JsonOutputter implements CommandOutputter {
-    static final Logger LOG = LoggerFactory.getLogger(JsonOutputter.class);
-
-    public static final String ERROR_RESPONSE = "{\"error\": \"Exception writing command response to JSON\"}";
-
-    private ObjectMapper mapper;
-
-    public JsonOutputter() {
-        mapper = new ObjectMapper();
-        mapper.configure(SerializationFeature.WRITE_ENUMS_USING_TO_STRING, true);
-        mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
-        mapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);
-    }
-
-    @Override
-    public String getContentType() {
-        return "application/json";
-    }
-
-    @Override
-    public void output(CommandResponse response, PrintWriter pw) {
-        try {
-            mapper.writeValue(pw, response.toMap());
-        } catch (JsonGenerationException e) {
-            LOG.warn("Exception writing command response to JSON:", e);
-            pw.write(ERROR_RESPONSE);
-        } catch (JsonMappingException e) {
-            LOG.warn("Exception writing command response to JSON:", e);
-            pw.write(ERROR_RESPONSE);
-        } catch (IOException e) {
-            LOG.warn("Exception writing command response to JSON:", e);
-            pw.write(ERROR_RESPONSE);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/auth/AuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/AuthenticationProvider.java b/src/java/main/org/apache/zookeeper/server/auth/AuthenticationProvider.java
deleted file mode 100644
index dd6e32f..0000000
--- a/src/java/main/org/apache/zookeeper/server/auth/AuthenticationProvider.java
+++ /dev/null
@@ -1,82 +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.server.auth;
-
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.server.ServerCnxn;
-
-/**
- * This interface is implemented by authentication providers to add new kinds of
- * authentication schemes to ZooKeeper.
- */
-public interface AuthenticationProvider {
-    /**
-     * The String used to represent this provider. This will correspond to the
-     * scheme field of an Id.
-     * 
-     * @return the scheme of this provider.
-     */
-    String getScheme();
-
-    /**
-     * This method is called when a client passes authentication data for this
-     * scheme. The authData is directly from the authentication packet. The
-     * implementor may attach new ids to the authInfo field of cnxn or may use
-     * cnxn to send packets back to the client.
-     * 
-     * @param cnxn
-     *                the cnxn that received the authentication information.
-     * @param authData
-     *                the authentication data received.
-     * @return TODO
-     */
-    KeeperException.Code handleAuthentication(ServerCnxn cnxn, byte authData[]);
-
-    /**
-     * This method is called to see if the given id matches the given id
-     * expression in the ACL. This allows schemes to use application specific
-     * wild cards.
-     * 
-     * @param id
-     *                the id to check.
-     * @param aclExpr
-     *                the expression to match ids against.
-     * @return true if the id can be matched by the expression.
-     */
-    boolean matches(String id, String aclExpr);
-
-    /**
-     * This method is used to check if the authentication done by this provider
-     * should be used to identify the creator of a node. Some ids such as hosts
-     * and ip addresses are rather transient and in general don't really
-     * identify a client even though sometimes they do.
-     * 
-     * @return true if this provider identifies creators.
-     */
-    boolean isAuthenticated();
-
-    /**
-     * Validates the syntax of an id.
-     * 
-     * @param id
-     *                the id to validate.
-     * @return true if id is well formed.
-     */
-    boolean isValid(String id);
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/auth/DigestAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/DigestAuthenticationProvider.java b/src/java/main/org/apache/zookeeper/server/auth/DigestAuthenticationProvider.java
deleted file mode 100644
index 2427e7a..0000000
--- a/src/java/main/org/apache/zookeeper/server/auth/DigestAuthenticationProvider.java
+++ /dev/null
@@ -1,139 +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.server.auth;
-
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.Id;
-import org.apache.zookeeper.server.ServerCnxn;
-
-public class DigestAuthenticationProvider implements AuthenticationProvider {
-    private static final Logger LOG =
-        LoggerFactory.getLogger(DigestAuthenticationProvider.class);
-
-    /** specify a command line property with key of 
-     * "zookeeper.DigestAuthenticationProvider.superDigest"
-     * and value of "super:<base64encoded(SHA1(password))>" to enable
-     * super user access (i.e. acls disabled)
-     */
-    private final static String superDigest = System.getProperty(
-        "zookeeper.DigestAuthenticationProvider.superDigest");
-
-    public String getScheme() {
-        return "digest";
-    }
-
-    static final private String base64Encode(byte b[]) {
-        StringBuilder sb = new StringBuilder();
-        for (int i = 0; i < b.length;) {
-            int pad = 0;
-            int v = (b[i++] & 0xff) << 16;
-            if (i < b.length) {
-                v |= (b[i++] & 0xff) << 8;
-            } else {
-                pad++;
-            }
-            if (i < b.length) {
-                v |= (b[i++] & 0xff);
-            } else {
-                pad++;
-            }
-            sb.append(encode(v >> 18));
-            sb.append(encode(v >> 12));
-            if (pad < 2) {
-                sb.append(encode(v >> 6));
-            } else {
-                sb.append('=');
-            }
-            if (pad < 1) {
-                sb.append(encode(v));
-            } else {
-                sb.append('=');
-            }
-        }
-        return sb.toString();
-    }
-
-    static final private char encode(int i) {
-        i &= 0x3f;
-        if (i < 26) {
-            return (char) ('A' + i);
-        }
-        if (i < 52) {
-            return (char) ('a' + i - 26);
-        }
-        if (i < 62) {
-            return (char) ('0' + i - 52);
-        }
-        return i == 62 ? '+' : '/';
-    }
-
-    static public String generateDigest(String idPassword)
-            throws NoSuchAlgorithmException {
-        String parts[] = idPassword.split(":", 2);
-        byte digest[] = MessageDigest.getInstance("SHA1").digest(
-                idPassword.getBytes());
-        return parts[0] + ":" + base64Encode(digest);
-    }
-
-    public KeeperException.Code 
-        handleAuthentication(ServerCnxn cnxn, byte[] authData)
-    {
-        String id = new String(authData);
-        try {
-            String digest = generateDigest(id);
-            if (digest.equals(superDigest)) {
-                cnxn.addAuthInfo(new Id("super", ""));
-            }
-            cnxn.addAuthInfo(new Id(getScheme(), digest));
-            return KeeperException.Code.OK;
-        } catch (NoSuchAlgorithmException e) {
-            LOG.error("Missing algorithm",e);
-        }
-        return KeeperException.Code.AUTHFAILED;
-    }
-
-    public boolean isAuthenticated() {
-        return true;
-    }
-
-    public boolean isValid(String id) {
-        String parts[] = id.split(":");
-        return parts.length == 2;
-    }
-
-    public boolean matches(String id, String aclExpr) {
-        return id.equals(aclExpr);
-    }
-
-    /** Call with a single argument of user:pass to generate authdata.
-     * Authdata output can be used when setting superDigest for example. 
-     * @param args single argument of user:pass
-     * @throws NoSuchAlgorithmException
-     */
-    public static void main(String args[]) throws NoSuchAlgorithmException {
-        for (int i = 0; i < args.length; i++) {
-            System.out.println(args[i] + "->" + generateDigest(args[i]));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/auth/DigestLoginModule.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/DigestLoginModule.java b/src/java/main/org/apache/zookeeper/server/auth/DigestLoginModule.java
deleted file mode 100644
index 955c728..0000000
--- a/src/java/main/org/apache/zookeeper/server/auth/DigestLoginModule.java
+++ /dev/null
@@ -1,61 +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.server.auth;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.spi.LoginModule;
-import java.util.Map;
-
-public class DigestLoginModule implements LoginModule {
-    private Subject subject;
-
-    public boolean abort() {
-        return false;
-    }
-
-    public boolean commit() {
-        return true;
-    }
-
-    public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String,?> sharedState, Map<String,?> options) {
-        if (options.containsKey("username")) {
-            // Zookeeper client: get username and password from JAAS conf (only used if using DIGEST-MD5).
-            this.subject = subject;
-            String username = (String)options.get("username");
-            this.subject.getPublicCredentials().add((Object)username);
-            String password = (String)options.get("password");
-            this.subject.getPrivateCredentials().add((Object)password);
-        }
-        return;
-    }
-
-    public boolean logout() {
-        return true;
-    }
-
-    public boolean login() {
-        // Unlike with Krb5LoginModule, we don't do any actual login or credential passing here: authentication to Zookeeper
-        // is done later, through the SASLClient object.
-        return true;
-    }
-
-}
-
-

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/auth/IPAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/IPAuthenticationProvider.java b/src/java/main/org/apache/zookeeper/server/auth/IPAuthenticationProvider.java
deleted file mode 100644
index 6f2a81d..0000000
--- a/src/java/main/org/apache/zookeeper/server/auth/IPAuthenticationProvider.java
+++ /dev/null
@@ -1,132 +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.server.auth;
-
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.data.Id;
-import org.apache.zookeeper.server.ServerCnxn;
-
-public class IPAuthenticationProvider implements AuthenticationProvider {
-
-    public String getScheme() {
-        return "ip";
-    }
-
-    public KeeperException.Code
-        handleAuthentication(ServerCnxn cnxn, byte[] authData)
-    {
-        String id = cnxn.getRemoteSocketAddress().getAddress().getHostAddress();
-        cnxn.addAuthInfo(new Id(getScheme(), id));
-        return KeeperException.Code.OK;
-    }
-
-    // This is a bit weird but we need to return the address and the number of
-    // bytes (to distinguish between IPv4 and IPv6
-    private byte[] addr2Bytes(String addr) {
-        byte b[] = v4addr2Bytes(addr);
-        // TODO Write the v6addr2Bytes
-        return b;
-    }
-
-    private byte[] v4addr2Bytes(String addr) {
-        String parts[] = addr.split("\\.", -1);
-        if (parts.length != 4) {
-            return null;
-        }
-        byte b[] = new byte[4];
-        for (int i = 0; i < 4; i++) {
-            try {
-                int v = Integer.parseInt(parts[i]);
-                if (v >= 0 && v <= 255) {
-                    b[i] = (byte) v;
-                } else {
-                    return null;
-                }
-            } catch (NumberFormatException e) {
-                return null;
-            }
-        }
-        return b;
-    }
-
-    private void mask(byte b[], int bits) {
-        int start = bits / 8;
-        int startMask = (1 << (8 - (bits % 8))) - 1;
-        startMask = ~startMask;
-        while (start < b.length) {
-            b[start] &= startMask;
-            startMask = 0;
-            start++;
-        }
-    }
-
-    public boolean matches(String id, String aclExpr) {
-        String parts[] = aclExpr.split("/", 2);
-        byte aclAddr[] = addr2Bytes(parts[0]);
-        if (aclAddr == null) {
-            return false;
-        }
-        int bits = aclAddr.length * 8;
-        if (parts.length == 2) {
-            try {
-                bits = Integer.parseInt(parts[1]);
-                if (bits < 0 || bits > aclAddr.length * 8) {
-                    return false;
-                }
-            } catch (NumberFormatException e) {
-                return false;
-            }
-        }
-        mask(aclAddr, bits);
-        byte remoteAddr[] = addr2Bytes(id);
-        if (remoteAddr == null) {
-            return false;
-        }
-        mask(remoteAddr, bits);
-        for (int i = 0; i < remoteAddr.length; i++) {
-            if (remoteAddr[i] != aclAddr[i]) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    public boolean isAuthenticated() {
-        return false;
-    }
-
-    public boolean isValid(String id) {
-        String parts[] = id.split("/", 2);
-        byte aclAddr[] = addr2Bytes(parts[0]);
-        if (aclAddr == null) {
-            return false;
-        }
-        if (parts.length == 2) {
-            try {
-                int bits = Integer.parseInt(parts[1]);
-                if (bits < 0 || bits > aclAddr.length * 8) {
-                    return false;
-                }
-            } catch (NumberFormatException e) {
-                return false;
-            }
-        }
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/auth/KerberosName.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/KerberosName.java b/src/java/main/org/apache/zookeeper/server/auth/KerberosName.java
deleted file mode 100644
index 01d1f66..0000000
--- a/src/java/main/org/apache/zookeeper/server/auth/KerberosName.java
+++ /dev/null
@@ -1,418 +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.
- */
-
- /* This file copied from Hadoop's security branch,
-  * with the following changes:
-  * 1. package changed from org.apache.hadoop.security to
-  *    org.apache.zookeeper.server.auth.
-  * 2. Usage of Hadoop's Configuration class removed since
-  *    it is not available in Zookeeper: instead, system property
-  *    "zookeeper.security.auth_to_local" is used.
-  */
-
-package org.apache.zookeeper.server.auth;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.zookeeper.server.util.KerberosUtil;
-
-/**
- * This class implements parsing and handling of Kerberos principal names. In 
- * particular, it splits them apart and translates them down into local
- * operating system names.
- */
-public class KerberosName {
-  /** The first component of the name */
-  private final String serviceName;
-  /** The second component of the name. It may be null. */
-  private final String hostName;
-  /** The realm of the name. */
-  private final String realm;
-
-  /**
-   * A pattern that matches a Kerberos name with at most 2 components.
-   */
-  private static final Pattern nameParser = 
-    Pattern.compile("([^/@]*)(/([^/@]*))?@([^/@]*)");
-
-  /** 
-   * A pattern that matches a string with out '$' and then a single
-   * parameter with $n.
-   */
-  private static Pattern parameterPattern = 
-    Pattern.compile("([^$]*)(\\$(\\d*))?");
-
-  /**
-   * A pattern for parsing a auth_to_local rule.
-   */
-  private static final Pattern ruleParser =
-    Pattern.compile("\\s*((DEFAULT)|(RULE:\\[(\\d*):([^\\]]*)](\\(([^)]*)\\))?"+
-                    "(s/([^/]*)/([^/]*)/(g)?)?))");
-  
-  /**
-   * A pattern that recognizes simple/non-simple names.
-   */
-  private static final Pattern nonSimplePattern = Pattern.compile("[/@]");
-  
-  /**
-   * The list of translation rules.
-   */
-  private static List<Rule> rules;
-
-  private static String defaultRealm;
-  
-  static {
-    try {
-      defaultRealm = KerberosUtil.getDefaultRealm();
-    } catch (Exception ke) {
-      if ((System.getProperty("zookeeper.requireKerberosConfig") != null) &&
-          (System.getProperty("zookeeper.requireKerberosConfig").equals("true"))) {
-        throw new IllegalArgumentException("Can't get Kerberos configuration",ke);
-      }
-      else
-        defaultRealm="";
-    }
-    try {
-      // setConfiguration() will work even if the above try() fails due
-      // to a missing Kerberos configuration (unless zookeeper.requireKerberosConfig
-      // is set to true, which would not allow execution to reach here due to the
-      // throwing of an IllegalArgumentException above).
-      setConfiguration();
-    }
-    catch (IOException e) {
-      throw new IllegalArgumentException("Could not configure Kerberos principal name mapping.");
-    }
-  }
-
-  /**
-   * Create a name from the full Kerberos principal name.
-   * @param name
-   */
-  public KerberosName(String name) {
-    Matcher match = nameParser.matcher(name);
-    if (!match.matches()) {
-      if (name.contains("@")) {
-        throw new IllegalArgumentException("Malformed Kerberos name: " + name);
-      } else {
-        serviceName = name;
-        hostName = null;
-        realm = null;
-      }
-    } else {
-      serviceName = match.group(1);
-      hostName = match.group(3);
-      realm = match.group(4);
-    }
-  }
-
-  /**
-   * Get the configured default realm.
-   * @return the default realm from the krb5.conf
-   */
-  public String getDefaultRealm() {
-    return defaultRealm;
-  }
-
-  /**
-   * Put the name back together from the parts.
-   */
-  @Override
-  public String toString() {
-    StringBuilder result = new StringBuilder();
-    result.append(serviceName);
-    if (hostName != null) {
-      result.append('/');
-      result.append(hostName);
-    }
-    if (realm != null) {
-      result.append('@');
-      result.append(realm);
-    }
-    return result.toString();
-  }
-
-  /**
-   * Get the first component of the name.
-   * @return the first section of the Kerberos principal name
-   */
-  public String getServiceName() {
-    return serviceName;
-  }
-
-  /**
-   * Get the second component of the name.
-   * @return the second section of the Kerberos principal name, and may be null
-   */
-  public String getHostName() {
-    return hostName;
-  }
-  
-  /**
-   * Get the realm of the name.
-   * @return the realm of the name, may be null
-   */
-  public String getRealm() {
-    return realm;
-  }
-  
-  /**
-   * An encoding of a rule for translating kerberos names.
-   */
-  private static class Rule {
-    private final boolean isDefault;
-    private final int numOfComponents;
-    private final String format;
-    private final Pattern match;
-    private final Pattern fromPattern;
-    private final String toPattern;
-    private final boolean repeat;
-
-    Rule() {
-      isDefault = true;
-      numOfComponents = 0;
-      format = null;
-      match = null;
-      fromPattern = null;
-      toPattern = null;
-      repeat = false;
-    }
-
-    Rule(int numOfComponents, String format, String match, String fromPattern,
-         String toPattern, boolean repeat) {
-      isDefault = false;
-      this.numOfComponents = numOfComponents;
-      this.format = format;
-      this.match = match == null ? null : Pattern.compile(match);
-      this.fromPattern = 
-        fromPattern == null ? null : Pattern.compile(fromPattern);
-      this.toPattern = toPattern;
-      this.repeat = repeat;
-    }
-    
-    @Override
-    public String toString() {
-      StringBuilder buf = new StringBuilder();
-      if (isDefault) {
-        buf.append("DEFAULT");
-      } else {
-        buf.append("RULE:[");
-        buf.append(numOfComponents);
-        buf.append(':');
-        buf.append(format);
-        buf.append(']');
-        if (match != null) {
-          buf.append('(');
-          buf.append(match);
-          buf.append(')');
-        }
-        if (fromPattern != null) {
-          buf.append("s/");
-          buf.append(fromPattern);
-          buf.append('/');
-          buf.append(toPattern);
-          buf.append('/');
-          if (repeat) {
-            buf.append('g');
-          }
-        }
-      }
-      return buf.toString();
-    }
-    
-    /**
-     * Replace the numbered parameters of the form $n where n is from 1 to 
-     * the length of params. Normal text is copied directly and $n is replaced
-     * by the corresponding parameter.
-     * @param format the string to replace parameters again
-     * @param params the list of parameters
-     * @return the generated string with the parameter references replaced.
-     * @throws BadFormatString
-     */
-    static String replaceParameters(String format, 
-                                    String[] params) throws BadFormatString {
-      Matcher match = parameterPattern.matcher(format);
-      int start = 0;
-      StringBuilder result = new StringBuilder();
-      while (start < format.length() && match.find(start)) {
-        result.append(match.group(1));
-        String paramNum = match.group(3);
-        if (paramNum != null) {
-          try {
-            int num = Integer.parseInt(paramNum);
-            if (num < 0 || num > params.length) {
-              throw new BadFormatString("index " + num + " from " + format +
-                                        " is outside of the valid range 0 to " +
-                                        (params.length - 1));
-            }
-            result.append(params[num]);
-          } catch (NumberFormatException nfe) {
-            throw new BadFormatString("bad format in username mapping in " + 
-                                      paramNum, nfe);
-          }
-          
-        }
-        start = match.end();
-      }
-      return result.toString();
-    }
-
-    /**
-     * Replace the matches of the from pattern in the base string with the value
-     * of the to string.
-     * @param base the string to transform
-     * @param from the pattern to look for in the base string
-     * @param to the string to replace matches of the pattern with
-     * @param repeat whether the substitution should be repeated
-     * @return
-     */
-    static String replaceSubstitution(String base, Pattern from, String to, 
-                                      boolean repeat) {
-      Matcher match = from.matcher(base);
-      if (repeat) {
-        return match.replaceAll(to);
-      } else {
-        return match.replaceFirst(to);
-      }
-    }
-
-    /**
-     * Try to apply this rule to the given name represented as a parameter
-     * array.
-     * @param params first element is the realm, second and later elements are
-     *        are the components of the name "a/b@FOO" -> {"FOO", "a", "b"}
-     * @return the short name if this rule applies or null
-     * @throws IOException throws if something is wrong with the rules
-     */
-    String apply(String[] params) throws IOException {
-      String result = null;
-      if (isDefault) {
-        if (defaultRealm.equals(params[0])) {
-          result = params[1];
-        }
-      } else if (params.length - 1 == numOfComponents) {
-        String base = replaceParameters(format, params);
-        if (match == null || match.matcher(base).matches()) {
-          if (fromPattern == null) {
-            result = base;
-          } else {
-            result = replaceSubstitution(base, fromPattern, toPattern,  repeat);
-          }
-        }
-      }
-      if (result != null && nonSimplePattern.matcher(result).find()) {
-        throw new NoMatchingRule("Non-simple name " + result +
-                                 " after auth_to_local rule " + this);
-      }
-      return result;
-    }
-  }
-
-  static List<Rule> parseRules(String rules) {
-    List<Rule> result = new ArrayList<Rule>();
-    String remaining = rules.trim();
-    while (remaining.length() > 0) {
-      Matcher matcher = ruleParser.matcher(remaining);
-      if (!matcher.lookingAt()) {
-        throw new IllegalArgumentException("Invalid rule: " + remaining);
-      }
-      if (matcher.group(2) != null) {
-        result.add(new Rule());
-      } else {
-        result.add(new Rule(Integer.parseInt(matcher.group(4)),
-                            matcher.group(5),
-                            matcher.group(7),
-                            matcher.group(9),
-                            matcher.group(10),
-                            "g".equals(matcher.group(11))));
-      }
-      remaining = remaining.substring(matcher.end());
-    }
-    return result;
-  }
-
-  /**
-   * Set the static configuration to get the rules.
-   * @param conf the new configuration
-   * @throws IOException
-   */
-  public static void setConfiguration() throws IOException {
-    String ruleString = System.getProperty("zookeeper.security.auth_to_local", "DEFAULT");
-    rules = parseRules(ruleString);
-  }
-
-  @SuppressWarnings("serial")
-  public static class BadFormatString extends IOException {
-    BadFormatString(String msg) {
-      super(msg);
-    }
-    BadFormatString(String msg, Throwable err) {
-      super(msg, err);
-    }
-  }
-
-  @SuppressWarnings("serial")
-  public static class NoMatchingRule extends IOException {
-    NoMatchingRule(String msg) {
-      super(msg);
-    }
-  }
-
-  /**
-   * Get the translation of the principal name into an operating system
-   * user name.
-   * @return the short name
-   * @throws IOException
-   */
-  public String getShortName() throws IOException {
-    String[] params;
-    if (hostName == null) {
-      // if it is already simple, just return it
-      if (realm == null) {
-        return serviceName;
-      }
-      params = new String[]{realm, serviceName};
-    } else {
-      params = new String[]{realm, serviceName, hostName};
-    }
-    for(Rule r: rules) {
-      String result = r.apply(params);
-      if (result != null) {
-        return result;
-      }
-    }
-    throw new NoMatchingRule("No rules applied to " + toString());
-  }
-
-  static void printRules() throws IOException {
-    int i = 0;
-    for(Rule r: rules) {
-      System.out.println(++i + " " + r);
-    }
-  }
-
-  public static void main(String[] args) throws Exception {
-    for(String arg: args) {
-      KerberosName name = new KerberosName(arg);
-      System.out.println("Name: " + name + " to " + name.getShortName());
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java b/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java
deleted file mode 100644
index 9bce71e..0000000
--- a/src/java/main/org/apache/zookeeper/server/auth/ProviderRegistry.java
+++ /dev/null
@@ -1,77 +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.server.auth;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.zookeeper.server.ZooKeeperServer;
-
-public class ProviderRegistry {
-    private static final Logger LOG = LoggerFactory.getLogger(ProviderRegistry.class);
-
-    private static boolean initialized = false;
-    private static HashMap<String, AuthenticationProvider> authenticationProviders =
-        new HashMap<String, AuthenticationProvider>();
-
-    public static void initialize() {
-        synchronized (ProviderRegistry.class) {
-            if (initialized)
-                return;
-            IPAuthenticationProvider ipp = new IPAuthenticationProvider();
-            DigestAuthenticationProvider digp = new DigestAuthenticationProvider();
-            authenticationProviders.put(ipp.getScheme(), ipp);
-            authenticationProviders.put(digp.getScheme(), digp);
-            Enumeration<Object> en = System.getProperties().keys();
-            while (en.hasMoreElements()) {
-                String k = (String) en.nextElement();
-                if (k.startsWith("zookeeper.authProvider.")) {
-                    String className = System.getProperty(k);
-                    try {
-                        Class<?> c = ZooKeeperServer.class.getClassLoader()
-                                .loadClass(className);
-                        AuthenticationProvider ap = (AuthenticationProvider) c.getDeclaredConstructor()
-                                .newInstance();
-                        authenticationProviders.put(ap.getScheme(), ap);
-                    } catch (Exception e) {
-                        LOG.warn("Problems loading " + className,e);
-                    }
-                }
-            }
-            initialized = true;
-        }
-    }
-
-    public static AuthenticationProvider getProvider(String scheme) {
-        if(!initialized)
-            initialize();
-        return authenticationProviders.get(scheme);
-    }
-
-    public static String listProviders() {
-        StringBuilder sb = new StringBuilder();
-        for(String s: authenticationProviders.keySet()) {
-        sb.append(s + " ");
-}
-        return sb.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/main/org/apache/zookeeper/server/auth/SASLAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/src/java/main/org/apache/zookeeper/server/auth/SASLAuthenticationProvider.java b/src/java/main/org/apache/zookeeper/server/auth/SASLAuthenticationProvider.java
deleted file mode 100644
index 1f60b39..0000000
--- a/src/java/main/org/apache/zookeeper/server/auth/SASLAuthenticationProvider.java
+++ /dev/null
@@ -1,74 +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.server.auth;
-
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.server.ServerCnxn;
-
-public class SASLAuthenticationProvider implements AuthenticationProvider {
-
-    public String getScheme() {
-        return "sasl";
-    }
-
-    public KeeperException.Code
-        handleAuthentication(ServerCnxn cnxn, byte[] authData)
-    {
-        // Should never call this: SASL authentication is negotiated at session initiation.
-        // TODO: consider substituting current implementation of direct ClientCnxn manipulation with
-        // a call to this method (SASLAuthenticationProvider:handleAuthentication()) at session initiation.
-        return KeeperException.Code.AUTHFAILED;
-
-    }
-
-    public boolean matches(String id,String aclExpr) {
-        if ((id.equals("super") || id.equals(aclExpr))) {
-          return true;
-        }
-        String readAccessUser = System.getProperty("zookeeper.letAnySaslUserDoX");
-        if ( readAccessUser != null && aclExpr.equals(readAccessUser)) {
-          return true;
-        }
-        return false;
-    }
-
-    public boolean isAuthenticated() {
-        return true;
-    }
-
-    public boolean isValid(String id) {
-        // Since the SASL authenticator will usually be used with Kerberos authentication,
-        // it should enforce that these names are valid according to Kerberos's
-        // syntax for principals.
-        //
-        // Use the KerberosName(id) constructor to define validity:
-        // if KerberosName(id) throws IllegalArgumentException, then id is invalid.
-        // otherwise, it is valid.
-        //
-        try {
-            new KerberosName(id);
-            return true;
-        }
-        catch (IllegalArgumentException e) {
-            return false;
-        }
-   }
-
-
-}