geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [47/51] [partial] incubator-geode git commit: GEODE-917: rename gemfire subprojects to geode
Date Wed, 17 Feb 2016 18:23:51 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/JarClassLoader.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/JarClassLoader.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/JarClassLoader.java
deleted file mode 100644
index ba528ce..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/JarClassLoader.java
+++ /dev/null
@@ -1,123 +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 com.gemstone.gemfire.modules.session.installer;
-
-import java.io.Closeable;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-/**
- * Classloader, which allows finding classes in jars  within jars. This is used to check
- * whether a listener, as found in web.xml, is a ServletContextListener
- */
-public class JarClassLoader extends URLClassLoader {
-
-  public JarClassLoader(URL[] urls, ClassLoader parent) {
-    super(urls, parent);
-
-    try {
-      for (URL url : urls) {
-        if (isJar(url.getFile())) {
-          addJarResource(new File(url.getPath()));
-        }
-      }
-    } catch (IOException e) {
-      e.printStackTrace();
-    }
-  }
-
-  private void addJarResource(File file) throws IOException {
-    JarFile jarFile = new JarFile(file);
-    addURL(file.toURL());
-    Enumeration<JarEntry> jarEntries = jarFile.entries();
-    while (jarEntries.hasMoreElements()) {
-      JarEntry jarEntry = jarEntries.nextElement();
-      if (!jarEntry.isDirectory() && isJar(jarEntry.getName())) {
-        addJarResource(jarEntryAsFile(jarFile, jarEntry));
-      }
-    }
-  }
-
-  @Override
-  protected synchronized Class<?> loadClass(String name, boolean resolve)
-      throws ClassNotFoundException {
-    try {
-      Class<?> clazz = findLoadedClass(name);
-      if (clazz == null) {
-        clazz = findClass(name);
-        if (resolve) {
-          resolveClass(clazz);
-        }
-      }
-      return clazz;
-    } catch (ClassNotFoundException e) {
-      return super.loadClass(name, resolve);
-    }
-  }
-
-  private static void close(Closeable closeable) {
-    if (closeable != null) {
-      try {
-        closeable.close();
-      } catch (IOException e) {
-        e.printStackTrace();
-      }
-    }
-  }
-
-  private static boolean isJar(String fileName) {
-    return fileName != null && (fileName.toLowerCase().endsWith(".jar") ||
-        fileName.toLowerCase().endsWith(".war") ||
-        fileName.toLowerCase().endsWith(".ear"));
-  }
-
-  private static File jarEntryAsFile(JarFile jarFile,
-      JarEntry jarEntry) throws IOException {
-    InputStream input = null;
-    OutputStream output = null;
-    try {
-      String name = jarEntry.getName().replace('/', '_');
-      int i = name.lastIndexOf(".");
-      String extension = i > -1 ? name.substring(i) : "";
-      File file = File.createTempFile(
-          name.substring(0, name.length() - extension.length()) + ".",
-          extension);
-      file.deleteOnExit();
-      input = jarFile.getInputStream(jarEntry);
-      output = new FileOutputStream(file);
-      int readCount;
-      byte[] buffer = new byte[4096];
-      while ((readCount = input.read(buffer)) != -1) {
-        output.write(buffer, 0, readCount);
-      }
-      return file;
-    } finally {
-      close(input);
-      close(output);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/Argument.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/Argument.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/Argument.java
deleted file mode 100644
index 1125c1b..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/Argument.java
+++ /dev/null
@@ -1,275 +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 com.gemstone.gemfire.modules.session.installer.args;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Class representing a single command line argument.
- */
-public class Argument {
-
-  /**
-   * Parameter names.
-   */
-  private final String[] paramNames;
-
-  /**
-   * Default values for the parameters when not explicitly set.
-   */
-  private String[] defaults;
-
-  /**
-   * Environment variable names forfor each parameter where values will be
-   * pulled in, if not explicitly provided and if the environment variable
-   * exists.
-   */
-  private String[] envVars;
-
-  /**
-   * Flag indicating whether this argument is required on the command line.
-   */
-  private final boolean required;
-
-  /**
-   * Handler used to hook into processing.
-   */
-  private ArgumentHandler handler;
-
-  /**
-   * List of all representation forms.
-   */
-  private final List<String> forms = new ArrayList<String>();
-
-  /**
-   * Usage description.
-   */
-  private String description;
-
-  ///////////////////////////////////////////////////////////////////////////
-  // Constructor:
-
-  /**
-   * Contructor to create an argument definition.
-   *
-   * @param primaryForm    the form of the argument (e.g., --foo).  Should start
-   *                       with a dash.
-   * @param argRequired    flag indicating whether or not the argument is
-   *                       required to be onthe command line
-   * @param parameterNames names of the parameters to this argument for use in
-   *                       the usage generation
-   */
-  public Argument(
-      final String primaryForm,
-      final boolean argRequired,
-      final String... parameterNames) {
-    forms.add(primaryForm);
-    paramNames = parameterNames;
-    required = argRequired;
-  }
-
-  /**
-   * Returns the number of parameters that this argument takes.
-   *
-   * @return parameter count
-   */
-  public int getParameterCount() {
-    return paramNames.length;
-  }
-
-  /**
-   * Returns the name of the parameter position requested.
-   *
-   * @param idx parameter index
-   * @return parameter name
-   */
-  public String getParameterName(final int idx) {
-    return paramNames[idx];
-  }
-
-  /**
-   * Returns whether or not this argument is required to be defined.
-   *
-   * @return true if required, false if optional
-   */
-  public boolean isRequired() {
-    return required;
-  }
-
-  /**
-   * Determines if the argument provisioning has been done via the environment.
-   */
-  public boolean isDefinedInEnv() {
-    if (envVars == null || paramNames.length == 0) {
-      return false;
-    }
-    for (String var : envVars) {
-      if (System.getenv(var) == null) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * Sets the argument handler.
-   *
-   * @param aHandler argument handler
-   * @return this argument (for chained calls)
-   */
-  public Argument setArgumentHandler(final ArgumentHandler aHandler) {
-    handler = aHandler;
-    return this;
-  }
-
-  /**
-   * Returns the argument handler.
-   *
-   * @return argument handler
-   */
-  public ArgumentHandler getArgumentHandler() {
-    return handler;
-  }
-
-  /**
-   * Adds a possible representation of the command line argument.
-   *
-   * @param aliasName additional form to accept
-   * @return this argument (for chained calls)
-   */
-  public Argument addForm(final String aliasName) {
-    forms.add(aliasName);
-    return this;
-  }
-
-  /**
-   * Returns the primary form of the argument.
-   *
-   * @return primary form
-   */
-  public String getPrimaryForm() {
-    if (forms.isEmpty()) {
-      return null;
-    } else {
-      return forms.get(0);
-    }
-  }
-
-  /**
-   * Returns a list of all valid representations of this command line argument.
-   *
-   * @return list of all registered forms
-   */
-  public List<String> getForms() {
-    return forms;
-  }
-
-  /**
-   * Sets a usage description for this argument.
-   *
-   * @param str usage description
-   * @return this argument (for chained calls)
-   */
-  public Argument setDescription(final String str) {
-    description = str;
-    return this;
-  }
-
-  /**
-   * Returns a usage description of this argument.
-   *
-   * @return description
-   */
-  public String getDescription() {
-    return description;
-  }
-
-  /**
-   * Sets the default values when no explicit values were provided.
-   *
-   * @param newDefaults default values for all argument parameters
-   * @return this argument (for chained calls)
-   */
-  public Argument setDefaults(final String... newDefaults) {
-    if (newDefaults.length != paramNames.length) {
-      throw (new IllegalArgumentException(
-          "Defaults array length provided is not the correct size"));
-    }
-    defaults = newDefaults;
-    return this;
-  }
-
-  /**
-   * Returns the defaults.
-   *
-   * @return default parameter values
-   */
-  public String[] getDefaults() {
-    return defaults;
-  }
-
-  /**
-   * Sets the environment variables which will be checked for values before
-   * falling back on the default values.
-   *
-   * @param newEnvVars environment variable name array
-   * @return this argument (for chained calls)
-   */
-  public Argument setEnvVars(final String... newEnvVars) {
-    if (newEnvVars.length != paramNames.length) {
-      throw (new IllegalArgumentException(
-          "Environment variables array length provided is not "
-              + "the correct size"));
-    }
-    envVars = newEnvVars;
-    return this;
-  }
-
-  /**
-   * Returns the environment variable names for each parameter.
-   *
-   * @return environment variable names
-   */
-  public String[] getEnvVars() {
-    return envVars;
-  }
-
-  /**
-   * Returns a human readable form.
-   *
-   * @return human readable string
-   */
-  @Override
-  public String toString() {
-    final StringBuilder builder = new StringBuilder();
-    builder.append("[Argument '");
-    builder.append(forms.get(0));
-    builder.append("'");
-    if (paramNames.length > 0) {
-      for (int i = 0; i < paramNames.length; i++) {
-        builder.append(" <");
-        builder.append(paramNames[i]);
-        builder.append(">");
-      }
-    }
-    builder.append("]");
-    return builder.toString();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentHandler.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentHandler.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentHandler.java
deleted file mode 100644
index 97c8108..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentHandler.java
+++ /dev/null
@@ -1,38 +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 com.gemstone.gemfire.modules.session.installer.args;
-
-/**
- * Interface specifying the requirements for objects wiching to be able to
- * examine arguments (potentially tweaking parameters) at the time of parsing,
- * thereby allowing for usage display to occur automatically.
- */
-public interface ArgumentHandler {
-
-  /**
-   * Process the argument values specified.
-   *
-   * @param arg    argument definition
-   * @param form   form which was used on the command line
-   * @param params parameters supplied to the argument
-   * @throws UsageException when usage was suboptimal
-   */
-  void handleArgument(Argument arg, String form, String[] params)
-      throws UsageException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentProcessor.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentProcessor.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentProcessor.java
deleted file mode 100644
index 04ecfab..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentProcessor.java
+++ /dev/null
@@ -1,397 +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 com.gemstone.gemfire.modules.session.installer.args;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-/**
- * This class is used to process command line arguments for Java programs in a
- * flexible and powerful manner.
- */
-public class ArgumentProcessor {
-  /**
-   * Logger.
-   */
-  private static final Logger LOG =
-      Logger.getLogger(ArgumentProcessor.class.getName());
-
-  /**
-   * Description line length.
-   */
-  private static final int LINE_LENGTH = 60;
-
-  /**
-   * Map containing all arguments defined, indexed by their unique IDs.
-   */
-  private final List<Argument> args = new ArrayList<Argument>();
-
-  /**
-   * Unknown argument handler.
-   */
-  private UnknownArgumentHandler handler;
-
-  /**
-   * Program name to display in usage.
-   */
-  private String programName;
-
-  ///////////////////////////////////////////////////////////////////////////
-  // Classes:
-
-  /**
-   * Structure used to represent an argument match.
-   */
-  private static class Match {
-    /**
-     * The argument which matched.
-     */
-    private final Argument arg;
-
-    /**
-     * The specific form which matched.
-     */
-    private final String form;
-
-    /**
-     * The parameters to the argument form.
-     */
-    private final String[] params;
-
-    /**
-     * Constructor.
-     *
-     * @param theArgument the argument which matched
-     * @param theForm     the form used
-     * @param theParams   the parameters supplied
-     */
-    public Match(
-        final Argument theArgument,
-        final String theForm, final String[] theParams) {
-      arg = theArgument;
-      form = theForm;
-      params = theParams;
-    }
-
-    /**
-     * Accessor.
-     *
-     * @return argument which matched
-     */
-    public Argument getArgument() {
-      return arg;
-    }
-
-    /**
-     * Accessor.
-     *
-     * @return form which was used
-     */
-    public String getForm() {
-      return form;
-    }
-
-    /**
-     * Accessor.
-     *
-     * @return parameters supplied
-     */
-    public String[] getParams() {
-      return params;
-    }
-  }
-
-  ///////////////////////////////////////////////////////////////////////////
-  // Constructors:
-
-  /**
-   * Creates a new Argument processor instance for te program name given.
-   *
-   * @param progName program name used in usage
-   */
-  public ArgumentProcessor(final String progName) {
-    programName = progName;
-  }
-
-
-  ///////////////////////////////////////////////////////////////////////////
-  // Public methods:
-
-  /**
-   * Adds a new argument.
-   *
-   * @param arg argument to add
-   */
-  public void addArgument(final Argument arg) {
-    args.add(arg);
-  }
-
-  /**
-   * Sets the handler to call when an unknown argument is encountered.
-   *
-   * @param aHandler unknown arg handler, or null to unset
-   */
-  public void setUnknownArgumentHandler(
-      final UnknownArgumentHandler aHandler) {
-    handler = aHandler;
-  }
-
-  /**
-   * Process the command line arguments provided.
-   *
-   * @param programArgs command line arguments supplied to program
-   * @return argument values parsed out of command line
-   * @throws UsageException when usge sucked
-   */
-  public ArgumentValues process(final String[] programArgs)
-      throws UsageException {
-    ArgumentHandler argHandler;
-    final ArgumentValues result = new ArgumentValues();
-    List<Argument> unmatched;
-    List<Match> matches;
-
-    // Find all argument matches and set postArgs
-    matches = checkMatches(programArgs, result);
-
-    // Find arguments which didnt match
-    unmatched = new ArrayList<Argument>();
-    unmatched.addAll(args);
-    for (Match match : matches) {
-      unmatched.remove(match.getArgument());
-    }
-
-    // Error on unmatched yet required args
-    for (Argument arg : unmatched) {
-      if (arg.isRequired() && !arg.isDefinedInEnv()) {
-        final UsageException usageException = new UsageException(
-            "Required argument not provided: " + arg);
-        usageException.setUsage(getUsage());
-        throw usageException;
-      }
-    }
-
-    // Handle the arguments
-    for (Match match : matches) {
-      final Argument arg = match.getArgument();
-      argHandler = arg.getArgumentHandler();
-      if (argHandler != null) {
-        argHandler.handleArgument(
-            arg, match.getForm(), match.getParams());
-      }
-      result.addResult(arg, match.getParams());
-    }
-
-    return result;
-  }
-
-
-  /**
-   * Generates command line usage text for display to user.
-   *
-   * @return usage to dusplay to user
-   */
-  public String getUsage() {
-    final StringBuilder builder = new StringBuilder();
-    List<String> descriptionLines;
-    final String blank20 = "                    ";
-
-    builder.append("\nUSAGE: ");
-    if (programName == null) {
-      builder.append("<program>");
-    } else {
-      builder.append(programName);
-    }
-    if (args.isEmpty()) {
-      builder.append("\nNo arguments supported.\n");
-    } else {
-      builder.append(" <args>\nWHERE <args>:\n\n");
-      for (Argument arg : args) {
-        for (String form : arg.getForms()) {
-          builder.append("    ");
-          builder.append(form);
-
-          for (int i = 0; i < arg.getParameterCount(); i++) {
-            builder.append(" <");
-            builder.append(arg.getParameterName(i));
-            builder.append(">");
-          }
-          builder.append("\n");
-        }
-
-        descriptionLines =
-            breakupString(arg.getDescription(), LINE_LENGTH);
-        if (descriptionLines.isEmpty()) {
-          builder.append(blank20);
-          builder.append("No argument description provided.");
-          builder.append("\n\n");
-        } else {
-          for (String line : descriptionLines) {
-            builder.append(blank20);
-            builder.append(line.trim());
-            builder.append("\n");
-          }
-          builder.append("\n");
-        }
-      }
-    }
-    builder.append("\n");
-
-    return builder.toString();
-  }
-
-
-  ///////////////////////////////////////////////////////////////////////////
-  // Private methods:
-
-  /**
-   * Builds a listof all argument matches and sets the postArgs array.
-   *
-   * @param programArgs command line arguments to search through
-   * @param values      values object in which to store results
-   * @return list of matches
-   * @throws UsageException when there is EBKAC
-   */
-  private List<Match> checkMatches(
-      final String[] programArgs, final ArgumentValues values)
-      throws UsageException {
-    final List<Match> result = new ArrayList<Match>();
-    Match match;
-    String[] params;
-    String[] postArgs;
-    int idx = 0;
-    int idx2;
-
-    while (idx < programArgs.length) {
-      // Check for end-of-parameters arg
-      if ("--".equals(programArgs[idx])) {
-        if (++idx < programArgs.length) {
-          postArgs = new String[programArgs.length - idx];
-          System.arraycopy(programArgs, idx,
-              postArgs, 0, postArgs.length);
-          values.setPostArgs(postArgs);
-        }
-        // We're done processing args'
-        break;
-      }
-
-      // Determine parameter count
-      idx2 = idx;
-      while ((idx2 + 1) < programArgs.length
-          && programArgs[idx2 + 1].charAt(0) != '-') {
-        idx2++;
-      }
-
-      // Generate parameter array
-      params = new String[idx2 - idx];
-      System.arraycopy(programArgs, idx + 1, params, 0, params.length);
-
-      LOG.fine("Arg: " + programArgs[idx]);
-      LOG.fine("Params: " + params.length);
-
-      // Find first argument matches
-      match = null;
-      for (Argument arg : args) {
-        match = checkMatch(programArgs[idx], arg, params);
-        if (match != null) {
-          result.add(match);
-          LOG.fine("Match found: ");
-          LOG.fine("     ID: " + arg);
-          LOG.fine("   Form: " + match.getForm());
-          break;
-        }
-      }
-      if (match == null) {
-        if (handler == null) {
-          final UsageException usageException = new UsageException(
-              "Unknown argument: " + programArgs[idx]
-                  + " with " + params.length + " parameters.");
-          usageException.setUsage(getUsage());
-          throw (usageException);
-        } else {
-          handler.handleUnknownArgument(programArgs[idx], params);
-        }
-      }
-
-      idx += params.length + 1;
-    }
-
-    return result;
-  }
-
-  /**
-   * Checks to see if an rgument form matches the suppies parameter list.
-   *
-   * @param argName argument name
-   * @param arg     argument
-   * @param params  parameters supplied
-   * @return match object on match, null otherwise
-   */
-  private Match checkMatch(
-      final String argName, final Argument arg, final String[] params) {
-    // Look for a matching form
-    for (String form : arg.getForms()) {
-      if (
-          form.equals(argName)
-              && arg.getParameterCount() == params.length) {
-        return new Match(arg, form, params);
-      }
-    }
-
-    return null;
-  }
-
-  /**
-   * Breaks up a string into sub-strings, each with a length equal to or less
-   * than the max length specified.
-   *
-   * @param str       string to break up
-   * @param maxLength maximum line length to use
-   * @return broken up string
-   */
-  private List<String> breakupString(
-      final String str, final int maxLength) {
-    final List<String> result = new ArrayList<String>();
-    int startIdx = -1;
-    int lastIdx;
-    int idx;
-
-    if (str == null) {
-      return result;
-    }
-
-    do {
-      idx = startIdx;
-      do {
-        lastIdx = idx;
-        idx = str.indexOf(' ', lastIdx + 1);
-        LOG.fine("startIdx=" + startIdx + "  lastIdx=" + lastIdx
-            + "  idx=" + idx);
-        if (idx < 0) {
-          // Canot break line up any further
-          result.add(str.substring(startIdx + 1));
-          return result;
-        }
-      } while ((idx - startIdx) <= maxLength);
-
-      result.add(str.substring(startIdx + 1, lastIdx));
-      startIdx = lastIdx;
-    } while (true);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentValues.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentValues.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentValues.java
deleted file mode 100644
index cd412da..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/ArgumentValues.java
+++ /dev/null
@@ -1,222 +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 com.gemstone.gemfire.modules.session.installer.args;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Result object capturing the result of processing command line arguments.
- */
-public class ArgumentValues {
-
-  /**
-   * Storage location for all arguments found after the "--" pseudo-arg.
-   */
-  private String[] postArgs = new String[]{};
-
-  /**
-   * Storage location for the command line argument values.
-   */
-  private final Map<Argument, List<String[]>> values =
-      new LinkedHashMap<Argument, List<String[]>>();
-
-  /**
-   * Constructor.
-   */
-  ArgumentValues() {
-    // Empty.
-  }
-
-  /**
-   * Sets the post-arguments found after the "--" pseudo-argument.
-   *
-   * @param newPostArgs arguments defined after the special "--" argument
-   */
-  void setPostArgs(final String[] newPostArgs) {
-    postArgs = newPostArgs;
-  }
-
-  /**
-   * After processing the command line arguments, this method may be used to
-   * return all arguments which were excluded from processing by their placement
-   * after the "<code>--</code>" psuedo-argument.
-   *
-   * @return all unprocess arguments
-   */
-  public String[] getPostArgs() {
-    return postArgs;
-  }
-
-  /**
-   * Sets the data values found for a specific argument.
-   *
-   * @param arg         argument
-   * @param paramValues parameter values for the argument
-   */
-  public void addResult(final Argument arg, final String[] paramValues) {
-    List<String[]> list = values.get(arg);
-    if (list == null) {
-      list = new ArrayList<String[]>();
-      list.add(paramValues);
-      values.put(arg, list);
-    } else {
-      list.add(paramValues);
-    }
-  }
-
-  /**
-   * Returns a list of all defined arguments.
-   *
-   * @return set of arguments
-   */
-  public Set<Argument> getDefinedArguments() {
-    return values.keySet();
-  }
-
-  /**
-   * Counts the number of arguments defined on the command line which are in the
-   * list provided.
-   *
-   * @param ofThese the arguments to search for, or null to count all supplied
-   *                arguments
-   * @return count of the defined arguments
-   */
-  public int getDefinedCount(Argument... ofThese) {
-    if (ofThese.length == 0) {
-      return values.keySet().size();
-    }
-
-    int count = 0;
-    for (Argument arg : values.keySet()) {
-      boolean found = false;
-      for (int i = 0; !found && i < ofThese.length; i++) {
-        if (ofThese[i].equals(arg)) {
-          count++;
-          found = true;
-        }
-      }
-    }
-    return count;
-  }
-
-  /**
-   * Returns whetheror not the command line argument was actually provided on
-   * the command line.
-   *
-   * @param arg argument to query
-   * @return true if the argument is defined by the command line, false
-   * otherwise
-   */
-  public boolean isDefined(final Argument arg) {
-    final List<String[]> result = values.get(arg);
-    return (result != null);
-  }
-
-  /**
-   * Returns all results for the specified argument.  If a command line option
-   * is specified more than once, this is the method to use to get all values.
-   *
-   * @param arg argument to query
-   * @return list of all parameter lists defined for this argument
-   */
-  public List<String[]> getAllResults(final Argument arg) {
-    List<String[]> result = values.get(arg);
-
-    if (result == null) {
-      final String[] envVars = arg.getEnvVars();
-      final String[] defaults = arg.getDefaults();
-      final String[] vals = new String[arg.getParameterCount()];
-      boolean found = defaults != null;
-
-      for (int i = 0; i < arg.getParameterCount(); i++) {
-        if (defaults != null) {
-          vals[i] = defaults[i];
-        }
-        if (envVars != null) {
-          String val = System.getenv(envVars[i]);
-          if (val != null) {
-            found = true;
-            vals[i] = val;
-          }
-        }
-      }
-
-      if (found) {
-        result = new ArrayList<String[]>();
-        result.add(vals);
-      }
-    }
-    return result;
-  }
-
-  /**
-   * Convenience method to retrieve the first instance of the command line
-   * argument's values.
-   *
-   * @param arg argument to query
-   * @return first parameter list defined for this argument
-   */
-  public String[] getResult(final Argument arg) {
-    final List<String[]> all = getAllResults(arg);
-    if (all == null) {
-      return null;
-    } else {
-      return all.get(0);
-    }
-  }
-
-  /**
-   * Convenience method to return the first value of the first instance of the
-   * command line argument values for the specified argument.
-   *
-   * @param arg argument to query
-   * @return first parameter of the first list of parameters supplied
-   */
-  public String getFirstResult(final Argument arg) {
-    final String[] all = getResult(arg);
-    if (all == null) {
-      return null;
-    } else {
-      return all[0];
-    }
-  }
-
-  /**
-   * Convenience method to return the result of getFirstResult method as an
-   * integer.
-   *
-   * @param arg            argument to query
-   * @param undefinedValue value to return when argument is not defined or is
-   *                       illegally defined
-   * @return value specified, or default value provided
-   */
-  public int getFirstResultAsInt(
-      final Argument arg, final int undefinedValue) {
-    final String value = getFirstResult(arg);
-    if (value == null) {
-      return undefinedValue;
-    } else {
-      return Integer.parseInt(value);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/URLArgumentHandler.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/URLArgumentHandler.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/URLArgumentHandler.java
deleted file mode 100644
index bb4b53a..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/URLArgumentHandler.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 com.gemstone.gemfire.modules.session.installer.args;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Argument handler implementation which accepts file paths or URLs and
- * normalizes the parameters to URLs.
- */
-public class URLArgumentHandler implements ArgumentHandler {
-
-  /**
-   * Logger.
-   */
-  private static final Logger LOG =
-      Logger.getLogger(URLArgumentHandler.class.getName());
-
-  /**
-   * Ensure that the argument is either a file path or a properly formatted URL.
-   *  If it is a file path, convert to a URL.  If neither, throws a
-   * UsageException.
-   *
-   * @param arg        argument
-   * @param form       form used
-   * @param parameters parameters supplied
-   * @throws UsageException when file not found or not a workable URL
-   */
-  public void handleArgument(
-      final Argument arg,
-      final String form,
-      final String[] parameters)
-      throws UsageException {
-    final File file = new File(parameters[0]);
-    URL result = null;
-
-    if (file.exists()) {
-      try {
-        result = file.toURI().toURL();
-      } catch (MalformedURLException mux) {
-        LOG.log(Level.FINEST, "Caught Exception", mux);
-      }
-    }
-    if (result == null) {
-      try {
-        result = new URL(parameters[0]);
-      } catch (MalformedURLException mux) {
-        LOG.log(Level.FINEST, "Caught Exception", mux);
-      }
-    }
-    if (result == null) {
-      throw (new UsageException(
-          "Argument parameter value is not a valid file "
-              + "path or URL: " + arg));
-    }
-    parameters[0] = result.toString();
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UnknownArgumentHandler.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UnknownArgumentHandler.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UnknownArgumentHandler.java
deleted file mode 100644
index 4d52f62..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UnknownArgumentHandler.java
+++ /dev/null
@@ -1,36 +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 com.gemstone.gemfire.modules.session.installer.args;
-
-/**
- * Interface defining unknown argument handlers, given the opportunity to either
- * ignore the issue or force the parameter to be dealt with.
- */
-public interface UnknownArgumentHandler {
-
-  /**
-   * Called when an unknown argument is supplied.
-   *
-   * @param form   argument name used
-   * @param params parameters passed into it
-   * @throws UsageException when the user needs to fix it
-   */
-  void handleUnknownArgument(String form, String[] params)
-      throws UsageException;
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UsageException.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UsageException.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UsageException.java
deleted file mode 100644
index 0879417..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/installer/args/UsageException.java
+++ /dev/null
@@ -1,89 +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 com.gemstone.gemfire.modules.session.installer.args;
-
-/**
- * Invalid usage exception.
- */
-public class UsageException extends Exception {
-
-  /**
-   * Serial format version.
-   */
-  private static final long serialVersionUID = 1L;
-
-  /**
-   * Stored usage message.
-   */
-  private String usage;
-
-  /**
-   * Creates a new UsageException.
-   */
-  public UsageException() {
-    super();
-  }
-
-  /**
-   * Creates a new UsageException.
-   *
-   * @param message description of exceptional condition
-   */
-  public UsageException(final String message) {
-    super(message);
-  }
-
-  /**
-   * Creates a new UsageException.
-   *
-   * @param message description of exceptional condition
-   * @param cause   provoking exception
-   */
-  public UsageException(final String message, final Throwable cause) {
-    super(message, cause);
-  }
-
-  /**
-   * Creates a new UsageException.
-   *
-   * @param cause provoking exception
-   */
-  public UsageException(final Throwable cause) {
-    super(cause);
-  }
-
-
-  /**
-   * Attaches a usage message to the exception for later consumption.
-   *
-   * @param usageText text to display to user to guide them to correct usage.
-   *                  This is generated and set by the <code>ArgsProcessor</code>.
-   */
-  public void setUsage(final String usageText) {
-    usage = usageText;
-  }
-
-  /**
-   * Returns the usage message previously set.
-   *
-   * @return message or null if not set.
-   */
-  public String getUsage() {
-    return usage;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/AbstractSessionCache.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/AbstractSessionCache.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/AbstractSessionCache.java
deleted file mode 100644
index 965a97f..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/AbstractSessionCache.java
+++ /dev/null
@@ -1,102 +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 com.gemstone.gemfire.modules.session.internal.common;
-
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.modules.session.catalina.internal.DeltaSessionStatistics;
-import com.gemstone.gemfire.modules.session.internal.filter.util.TypeAwareMap;
-import com.gemstone.gemfire.modules.util.RegionConfiguration;
-
-import java.util.Map;
-import javax.servlet.http.HttpSession;
-
-public abstract class AbstractSessionCache implements SessionCache {
-
-  /**
-   * The sessionRegion is the <code>Region</code> that actually stores and
-   * replicates the <code>Session</code>s.
-   */
-  protected Region<String, HttpSession> sessionRegion;
-
-  /**
-   * The operatingRegion is the <code>Region</code> used to do HTTP operations.
-   * if local cache is enabled, then this will be the local <code>Region</code>;
-   * otherwise, it will be the session <code>Region</code>.
-   */
-  protected Region<String, HttpSession> operatingRegion;
-
-  protected Map<CacheProperty, Object> properties =
-      new TypeAwareMap<CacheProperty, Object>(CacheProperty.class);
-
-  protected DeltaSessionStatistics statistics;
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void stop() {
-    sessionRegion.close();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Region<String, HttpSession> getOperatingRegion() {
-    return this.operatingRegion;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Region<String, HttpSession> getSessionRegion() {
-    return this.sessionRegion;
-  }
-
-  protected void createStatistics() {
-    this.statistics =
-        new DeltaSessionStatistics(getCache().getDistributedSystem(),
-            (String) properties.get(CacheProperty.STATISTICS_NAME));
-  }
-
-  /**
-   * Build up a {@code RegionConfiguraton} object from parameters originally
-   * passed in as filter initialization parameters.
-   *
-   * @return a {@code RegionConfiguration} object
-   */
-  protected RegionConfiguration createRegionConfiguration() {
-    RegionConfiguration configuration = new RegionConfiguration();
-
-    configuration.setRegionName(
-        (String) properties.get(CacheProperty.REGION_NAME));
-    configuration.setRegionAttributesId(
-        (String) properties.get(CacheProperty.REGION_ATTRIBUTES_ID));
-
-    configuration.setEnableGatewayDeltaReplication(
-        (Boolean) properties.get(
-            CacheProperty.ENABLE_GATEWAY_DELTA_REPLICATION));
-    configuration.setEnableGatewayReplication(
-        (Boolean) properties.get(CacheProperty.ENABLE_GATEWAY_REPLICATION));
-    configuration.setEnableDebugListener(
-        (Boolean) properties.get(CacheProperty.ENABLE_DEBUG_LISTENER));
-
-    return configuration;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/CacheProperty.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/CacheProperty.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/CacheProperty.java
deleted file mode 100644
index e26281e..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/CacheProperty.java
+++ /dev/null
@@ -1,65 +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 com.gemstone.gemfire.modules.session.internal.common;
-
-/**
- * Used to define cache properties
- */
-public enum CacheProperty {
-
-  ENABLE_DEBUG_LISTENER(Boolean.class),
-
-  ENABLE_GATEWAY_REPLICATION(Boolean.class),
-
-  ENABLE_GATEWAY_DELTA_REPLICATION(Boolean.class),
-
-  ENABLE_LOCAL_CACHE(Boolean.class),
-
-  REGION_NAME(String.class),
-
-  REGION_ATTRIBUTES_ID(String.class),
-
-  STATISTICS_NAME(String.class),
-
-  /**
-   * This parameter can take the following values which match the respective
-   * attribute container classes
-   * <p/>
-   * delta_queued     : QueuedDeltaSessionAttributes delta_immediate  :
-   * DeltaSessionAttributes immediate        : ImmediateSessionAttributes queued
-   * : QueuedSessionAttributes
-   */
-  SESSION_DELTA_POLICY(String.class),
-
-  /**
-   * This parameter can take the following values:
-   * <p/>
-   * set (default) set_and_get
-   */
-  REPLICATION_TRIGGER(String.class);
-
-  Class clazz;
-
-  CacheProperty(Class clazz) {
-    this.clazz = clazz;
-  }
-
-  public Class getClazz() {
-    return clazz;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/ClientServerSessionCache.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/ClientServerSessionCache.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/ClientServerSessionCache.java
deleted file mode 100644
index a23888c..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/ClientServerSessionCache.java
+++ /dev/null
@@ -1,186 +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 com.gemstone.gemfire.modules.session.internal.common;
-
-import com.gemstone.gemfire.cache.GemFireCache;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.client.ClientCache;
-import com.gemstone.gemfire.cache.client.ClientRegionFactory;
-import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
-import com.gemstone.gemfire.cache.execute.Execution;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.cache.execute.ResultCollector;
-import com.gemstone.gemfire.modules.util.BootstrappingFunction;
-import com.gemstone.gemfire.modules.util.CreateRegionFunction;
-import com.gemstone.gemfire.modules.util.RegionConfiguration;
-import com.gemstone.gemfire.modules.util.RegionStatus;
-
-import java.util.List;
-import java.util.Map;
-import javax.servlet.http.HttpSession;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Class which defines a client/server cache.
- */
-public class ClientServerSessionCache extends AbstractSessionCache {
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(PeerToPeerSessionCache.class.getName());
-
-  private ClientCache cache;
-
-  protected static final String DEFAULT_REGION_ATTRIBUTES_ID =
-      RegionShortcut.PARTITION_REDUNDANT.toString();
-
-  protected static final Boolean DEFAULT_ENABLE_LOCAL_CACHE = true;
-
-  /**
-   * Constructor
-   *
-   * @param cache
-   * @param properties
-   */
-  public ClientServerSessionCache(ClientCache cache,
-      Map<CacheProperty, Object> properties) {
-    super();
-    this.cache = cache;
-
-    /**
-     * Set some default properties for this cache if they haven't already
-     * been set
-     */
-    this.properties.put(CacheProperty.REGION_ATTRIBUTES_ID,
-        DEFAULT_REGION_ATTRIBUTES_ID);
-    this.properties.put(CacheProperty.ENABLE_LOCAL_CACHE,
-        DEFAULT_ENABLE_LOCAL_CACHE);
-    this.properties.putAll(properties);
-  }
-
-  @Override
-  public void initialize() {
-    // Bootstrap the servers
-    bootstrapServers();
-
-    // Create or retrieve the region
-    createOrRetrieveRegion();
-
-    // Set the session region directly as the operating region since there is no difference
-    // between the local cache region and the session region.
-    operatingRegion = sessionRegion;
-
-    // Create or retrieve the statistics
-    createStatistics();
-  }
-
-  @Override
-  public GemFireCache getCache() {
-    return cache;
-  }
-
-  @Override
-  public boolean isClientServer() {
-    return true;
-  }
-
-
-  ////////////////////////////////////////////////////////////////////////
-  // Private methods
-
-  private void bootstrapServers() {
-    Execution execution = FunctionService.onServers(this.cache);
-    ResultCollector collector = execution.execute(new BootstrappingFunction());
-    // Get the result. Nothing is being done with it.
-    try {
-      collector.getResult();
-    } catch (Exception e) {
-      // If an exception occurs in the function, log it.
-      LOG.warn("Caught unexpected exception:", e);
-    }
-  }
-
-  private void createOrRetrieveRegion() {
-    // Retrieve the local session region
-    this.sessionRegion =
-        this.cache.getRegion(
-            (String) properties.get(CacheProperty.REGION_NAME));
-
-    // If necessary, create the regions on the server and client
-    if (this.sessionRegion == null) {
-      // Create the PR on the servers
-      createSessionRegionOnServers();
-
-      // Create the region on the client
-      this.sessionRegion = createLocalSessionRegion();
-      LOG.debug("Created session region: " + this.sessionRegion);
-    } else {
-      LOG.debug("Retrieved session region: " + this.sessionRegion);
-    }
-  }
-
-  private void createSessionRegionOnServers() {
-    // Create the RegionConfiguration
-    RegionConfiguration configuration = createRegionConfiguration();
-
-    // Send it to the server tier
-    Execution execution = FunctionService.onServer(this.cache).withArgs(
-        configuration);
-    ResultCollector collector = execution.execute(CreateRegionFunction.ID);
-
-    // Verify the region was successfully created on the servers
-    List<RegionStatus> results = (List<RegionStatus>) collector.getResult();
-    for (RegionStatus status : results) {
-      if (status == RegionStatus.INVALID) {
-        StringBuilder builder = new StringBuilder();
-        builder.append(
-            "An exception occurred on the server while attempting to create or validate region named ");
-        builder.append(properties.get(CacheProperty.REGION_NAME));
-        builder.append(". See the server log for additional details.");
-        throw new IllegalStateException(builder.toString());
-      }
-    }
-  }
-
-  private Region<String, HttpSession> createLocalSessionRegion() {
-    ClientRegionFactory<String, HttpSession> factory = null;
-    boolean enableLocalCache =
-        (Boolean) properties.get(CacheProperty.ENABLE_LOCAL_CACHE);
-
-    String regionName = (String) properties.get(CacheProperty.REGION_NAME);
-    if (enableLocalCache) {
-      // Create the region factory with caching and heap LRU enabled
-      factory = ((ClientCache) this.cache).
-          createClientRegionFactory(
-              ClientRegionShortcut.CACHING_PROXY_HEAP_LRU);
-      LOG.info("Created new local client session region: {}", regionName);
-    } else {
-      // Create the region factory without caching enabled
-      factory = ((ClientCache) this.cache).createClientRegionFactory(
-          ClientRegionShortcut.PROXY);
-      LOG.info(
-          "Created new local client (uncached) session region: {} without any session expiry",
-          regionName);
-    }
-
-    // Create the region
-    return factory.create(regionName);
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/PeerToPeerSessionCache.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/PeerToPeerSessionCache.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/PeerToPeerSessionCache.java
deleted file mode 100644
index 878adaa..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/PeerToPeerSessionCache.java
+++ /dev/null
@@ -1,184 +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 com.gemstone.gemfire.modules.session.internal.common;
-
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.GemFireCache;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionFactory;
-import com.gemstone.gemfire.cache.RegionShortcut;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.modules.session.catalina.callback.LocalSessionCacheLoader;
-import com.gemstone.gemfire.modules.session.catalina.callback.LocalSessionCacheWriter;
-import com.gemstone.gemfire.modules.util.RegionConfiguration;
-import com.gemstone.gemfire.modules.util.RegionHelper;
-import com.gemstone.gemfire.modules.util.TouchPartitionedRegionEntriesFunction;
-import com.gemstone.gemfire.modules.util.TouchReplicatedRegionEntriesFunction;
-
-import java.util.Map;
-import javax.servlet.http.HttpSession;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Class which defines a peer-to-peer cache
- */
-public class PeerToPeerSessionCache extends AbstractSessionCache {
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(PeerToPeerSessionCache.class.getName());
-
-  private Cache cache;
-
-  private static final String DEFAULT_REGION_ATTRIBUTES_ID =
-      RegionShortcut.REPLICATE.toString();
-
-  private static final Boolean DEFAULT_ENABLE_LOCAL_CACHE = false;
-
-  /**
-   * Constructor
-   *
-   * @param cache
-   * @param properties
-   */
-  public PeerToPeerSessionCache(Cache cache,
-      Map<CacheProperty, Object> properties) {
-    super();
-    this.cache = cache;
-
-    /**
-     * Set some default properties for this cache if they haven't already
-     * been set
-     */
-    this.properties.put(CacheProperty.REGION_ATTRIBUTES_ID,
-        DEFAULT_REGION_ATTRIBUTES_ID);
-    this.properties.put(CacheProperty.ENABLE_LOCAL_CACHE,
-        DEFAULT_ENABLE_LOCAL_CACHE);
-    this.properties.putAll(properties);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void initialize() {
-    // Register Functions
-    registerFunctions();
-
-    // Create or retrieve the region
-    createOrRetrieveRegion();
-
-    /**
-     * If local cache is enabled, create the local region fronting the
-     * session region and set it as the operating region; otherwise, use
-     * the session region directly as the operating region.
-     */
-    boolean enableLocalCache =
-        (Boolean) properties.get(CacheProperty.ENABLE_LOCAL_CACHE);
-    operatingRegion = enableLocalCache
-        ? createOrRetrieveLocalRegion()
-        : this.sessionRegion;
-
-    // Create or retrieve the statistics
-    createStatistics();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public GemFireCache getCache() {
-    return cache;
-  }
-
-  @Override
-  public boolean isClientServer() {
-    return false;
-  }
-
-  private void registerFunctions() {
-    // Register the touch partitioned region entries function if it is not already registered
-    if (!FunctionService.isRegistered(
-        TouchPartitionedRegionEntriesFunction.ID)) {
-      FunctionService.registerFunction(
-          new TouchPartitionedRegionEntriesFunction());
-    }
-
-    // Register the touch replicated region entries function if it is not already registered
-    if (!FunctionService.isRegistered(
-        TouchReplicatedRegionEntriesFunction.ID)) {
-      FunctionService.registerFunction(
-          new TouchReplicatedRegionEntriesFunction());
-    }
-  }
-
-  private void createOrRetrieveRegion() {
-    // Create the RegionConfiguration
-    RegionConfiguration configuration = createRegionConfiguration();
-
-    // Attempt to retrieve the region
-    // If it already exists, validate it
-    // If it doesn't already exist, create it
-    Region region = this.cache.getRegion(
-        (String) properties.get(CacheProperty.REGION_NAME));
-    if (region == null) {
-      // Create the region
-      region = RegionHelper.createRegion(cache, configuration);
-      LOG.info("Created new session region: {}", region);
-    } else {
-      // Validate the existing region
-      LOG.info("Retrieved existing session region: {}", region);
-      RegionHelper.validateRegion(cache, configuration, region);
-    }
-
-    // Set the session region
-    this.sessionRegion = region;
-  }
-
-  /**
-   * Create a local region fronting the main region.
-   *
-   * @return
-   */
-  private Region<String, HttpSession> createOrRetrieveLocalRegion() {
-    // Attempt to retrieve the fronting region
-    String frontingRegionName = this.sessionRegion.getName() + "_local";
-    Region<String, HttpSession> frontingRegion =
-        this.cache.getRegion(frontingRegionName);
-
-    if (frontingRegion == null) {
-      // Create the region factory
-      RegionFactory<String, HttpSession> factory =
-          this.cache.createRegionFactory(RegionShortcut.LOCAL_HEAP_LRU);
-
-      // Add the cache loader and writer
-      factory.setCacheLoader(new LocalSessionCacheLoader(this.sessionRegion));
-      factory.setCacheWriter(new LocalSessionCacheWriter(this.sessionRegion));
-
-      // Create the region
-      frontingRegion = factory.create(frontingRegionName);
-      LOG.info("Created new local session region: {}", frontingRegion);
-    } else {
-      LOG.info("Retrieved existing local session region: {}",
-          frontingRegion);
-    }
-
-    return frontingRegion;
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionCache.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionCache.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionCache.java
deleted file mode 100644
index 7562dff..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionCache.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 com.gemstone.gemfire.modules.session.internal.common;
-
-import com.gemstone.gemfire.cache.GemFireCache;
-import com.gemstone.gemfire.cache.Region;
-
-import javax.servlet.http.HttpSession;
-
-/**
- * Interface to basic cache operations.
- */
-public interface SessionCache {
-
-  /**
-   * Initialize the cache and create the appropriate region.
-   */
-  public void initialize();
-
-  /**
-   * Stop the cache.
-   */
-  public void stop();
-
-  /**
-   * Retrieve the cache reference.
-   *
-   * @return a {@code GemFireCache} reference
-   */
-  public GemFireCache getCache();
-
-  /**
-   * Get the {@code Region} being used by client code to put attributes.
-   *
-   * @return a {@code Region<String, HttpSession>} reference
-   */
-  public Region<String, HttpSession> getOperatingRegion();
-
-  /**
-   * Get the backing {@code Region} being used. This may not be the same as the
-   * region being used by client code to put attributes.
-   *
-   * @return a {@code Region<String, HttpSession>} reference
-   */
-  public Region<String, HttpSession> getSessionRegion();
-
-  /**
-   * Is this cache client-server? The only other alternative is peer-to-peer.
-   *
-   * @return true if this cache is client-server.
-   */
-  public boolean isClientServer();
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionExpirationCacheListener.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionExpirationCacheListener.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionExpirationCacheListener.java
deleted file mode 100644
index 648e711..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/common/SessionExpirationCacheListener.java
+++ /dev/null
@@ -1,53 +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 com.gemstone.gemfire.modules.session.internal.common;
-
-import com.gemstone.gemfire.cache.Declarable;
-import com.gemstone.gemfire.cache.EntryEvent;
-import com.gemstone.gemfire.cache.Operation;
-import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-
-import java.util.Properties;
-import javax.servlet.http.HttpSession;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SessionExpirationCacheListener extends
-    CacheListenerAdapter<String, HttpSession> implements Declarable {
-
-  private static final Logger LOG =
-      LoggerFactory.getLogger(SessionExpirationCacheListener.class.getName());
-
-  @Override
-  public void afterDestroy(EntryEvent<String, HttpSession> event) {
-    /**
-     * A Session expired. If it was destroyed by GemFire expiration,
-     * process it. If it was destroyed via Session.invalidate, ignore it
-     * since it has already been processed.
-     */
-    if (event.getOperation() == Operation.EXPIRE_DESTROY) {
-      HttpSession session = (HttpSession) event.getOldValue();
-      session.invalidate();
-    }
-  }
-
-  @Override
-  public void init(Properties p) {
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/Constants.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/Constants.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/Constants.java
deleted file mode 100644
index 4ce8733..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/Constants.java
+++ /dev/null
@@ -1,30 +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 com.gemstone.gemfire.modules.session.internal.filter;
-
-/**
- * Various constant values used through the app
- */
-public class Constants {
-
-  public static String GEMFIRE_SESSION_REQUEST = "_gemfire_session_request_";
-
-  public static String SESSION_STATISTICS_MBEAN_NAME =
-      "com.gemstone:type=SessionStatistics,name=sessionStatistics";
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/DummySessionManager.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/DummySessionManager.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/DummySessionManager.java
deleted file mode 100644
index 9628912..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/DummySessionManager.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 com.gemstone.gemfire.modules.session.internal.filter;
-
-import com.gemstone.gemfire.modules.session.internal.filter.attributes.AbstractSessionAttributes;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import javax.servlet.http.HttpSession;
-
-/**
- * Class which fakes an in-memory basic session manager for testing purposes.
- */
-public class DummySessionManager implements SessionManager {
-
-  /**
-   * Map of sessions
-   */
-  private final Map<String, HttpSession> sessions =
-      new HashMap<String, HttpSession>();
-
-  private class Attributes extends AbstractSessionAttributes {
-
-    @Override
-    public Object putAttribute(String attr, Object value) {
-      return attributes.put(attr, value);
-    }
-
-    @Override
-    public Object removeAttribute(String attr) {
-      return attributes.remove(attr);
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void start(Object config, ClassLoader loader) {
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void stop() {
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public HttpSession getSession(String id) {
-    return sessions.get(id);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public HttpSession wrapSession(HttpSession nativeSession) {
-    String id = generateId();
-    AbstractSessionAttributes attributes = new Attributes();
-    GemfireHttpSession session = new GemfireHttpSession(id, nativeSession);
-    session.setManager(this);
-    session.setAttributes(attributes);
-    sessions.put(id, session);
-
-    return session;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public HttpSession getWrappingSession(String nativeId) {
-    return sessions.get(nativeId);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void putSession(HttpSession session) {
-    // shouldn't ever get called
-    throw new UnsupportedOperationException("Not supported yet.");
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void destroySession(String id) {
-    sessions.remove(id);
-  }
-
-  @Override
-  public String destroyNativeSession(String id) {
-    return null;
-  }
-
-  public String getSessionCookieName() {
-    return "JSESSIONID";
-  }
-
-  public String getJvmId() {
-    return "jvm-id";
-  }
-
-  /**
-   * Generate an ID string
-   */
-  private String generateId() {
-    return UUID.randomUUID().toString().toUpperCase() + "-GF";
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f6c4c2f9/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/GemfireHttpSession.java
----------------------------------------------------------------------
diff --git a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/GemfireHttpSession.java b/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/GemfireHttpSession.java
deleted file mode 100644
index 695a03b..0000000
--- a/extensions/gemfire-modules-session/src/main/java/com/gemstone/gemfire/modules/session/internal/filter/GemfireHttpSession.java
+++ /dev/null
@@ -1,526 +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 com.gemstone.gemfire.modules.session.internal.filter;
-
-import com.gemstone.gemfire.DataSerializable;
-import com.gemstone.gemfire.DataSerializer;
-import com.gemstone.gemfire.Delta;
-import com.gemstone.gemfire.Instantiator;
-import com.gemstone.gemfire.InvalidDeltaException;
-import com.gemstone.gemfire.modules.session.internal.filter.attributes.AbstractSessionAttributes;
-import com.gemstone.gemfire.modules.session.internal.filter.attributes.SessionAttributes;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.concurrent.atomic.AtomicBoolean;
-import javax.servlet.ServletContext;
-import javax.servlet.http.HttpSession;
-import javax.servlet.http.HttpSessionContext;
-
-import com.gemstone.gemfire.modules.util.ClassLoaderObjectInputStream;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Class which implements a Gemfire persisted {@code HttpSession}
- */
-public class GemfireHttpSession implements
-    HttpSession, DataSerializable, Delta {
-
-  private static transient final Logger LOG =
-      LoggerFactory.getLogger(GemfireHttpSession.class.getName());
-
-  /**
-   * Serial id
-   */
-  private static final long serialVersionUID = 238915238964017823L;
-
-  /**
-   * Id for the session
-   */
-  private String id;
-
-  /**
-   * Attributes really hold the essence of persistence.
-   */
-  private SessionAttributes attributes;
-
-  private transient SessionManager manager;
-
-  private HttpSession nativeSession = null;
-
-  /**
-   * A session becomes invalid if it is explicitly invalidated or if it
-   * expires.
-   */
-  private boolean isValid = true;
-
-  private boolean isNew = true;
-
-  private boolean isDirty = false;
-
-  /**
-   * This is set during serialization and then reset by the SessionManager when
-   * it is retrieved from the attributes.
-   */
-  private AtomicBoolean serialized = new AtomicBoolean(false);
-
-  /**
-   * Register ourselves for de-serialization
-   */
-  static {
-    Instantiator.register(new Instantiator(GemfireHttpSession.class, 27315) {
-      @Override
-      public DataSerializable newInstance() {
-        return new GemfireHttpSession();
-      }
-    });
-  }
-
-  /**
-   * Constructor used for de-serialization
-   */
-  private GemfireHttpSession() {
-  }
-
-  /**
-   * Constructor
-   */
-  public GemfireHttpSession(String id, HttpSession nativeSession) {
-    this();
-    this.id = id;
-    this.nativeSession = nativeSession;
-    if (nativeSession != null) {
-      attributes.setMaxInactiveInterval(nativeSession.getMaxInactiveInterval());
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Object getAttribute(String name) {
-    if (!isValid) {
-      throw new IllegalStateException("Session is already invalidated");
-    }
-    Object obj = attributes.getAttribute(name);
-
-    if (obj != null) {
-      Object tmpObj = null;
-      ClassLoader loader = ((GemfireSessionManager) manager).getReferenceClassLoader();
-
-      if (obj.getClass().getClassLoader() != loader) {
-        LOG.debug(
-            "Attribute '{}' needs to be reconstructed with a new classloader",
-            name);
-
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        try {
-          ObjectOutputStream oos = new ObjectOutputStream(baos);
-          oos.writeObject(obj);
-          oos.close();
-
-          ObjectInputStream ois = new ClassLoaderObjectInputStream(
-              new ByteArrayInputStream(baos.toByteArray()),
-              loader);
-          tmpObj = ois.readObject();
-        } catch (IOException e) {
-          LOG.error("Exception while recreating attribute '" + name +
-              "'", e);
-        } catch (ClassNotFoundException e) {
-          LOG.error("Exception while recreating attribute '" + name +
-              "'", e);
-        }
-        if (tmpObj != null) {
-          setAttribute(name, tmpObj);
-          obj = tmpObj;
-        }
-      }
-    }
-
-    return obj;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Enumeration getAttributeNames() {
-    if (!isValid) {
-      throw new IllegalStateException("Session is already invalidated");
-    }
-    return Collections.enumeration(attributes.getAttributeNames());
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public long getCreationTime() {
-    if (nativeSession != null) {
-      return nativeSession.getCreationTime();
-    } else {
-      return 0;
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String getId() {
-    return id;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public long getLastAccessedTime() {
-    if (!isValid) {
-      throw new IllegalStateException("Session is already invalidated");
-    }
-    return attributes.getLastAccessedTime();
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ServletContext getServletContext() {
-    if (nativeSession != null) {
-      return nativeSession.getServletContext();
-    } else {
-      return null;
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public HttpSessionContext getSessionContext() {
-    return null;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public Object getValue(String name) {
-    return getAttribute(name);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public String[] getValueNames() {
-    return attributes.getAttributeNames().toArray(new String[0]);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void invalidate() {
-    nativeSession.invalidate();
-    manager.destroySession(id);
-    isValid = false;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public boolean isNew() {
-    if (!isValid) {
-      throw new IllegalStateException("Session is already invalidated");
-    }
-    return isNew;
-  }
-
-  public void setIsNew(boolean isNew) {
-    this.isNew = isNew;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void setMaxInactiveInterval(int interval) {
-    if (nativeSession != null) {
-      nativeSession.setMaxInactiveInterval(interval);
-    }
-    attributes.setMaxInactiveInterval(interval);
-    isDirty = true;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public int getMaxInactiveInterval() {
-    if (nativeSession != null) {
-      return nativeSession.getMaxInactiveInterval();
-    } else {
-      return attributes.getMaxIntactiveInterval();
-    }
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void putValue(String name, Object value) {
-    setAttribute(name, value);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void removeAttribute(final String name) {
-    LOG.debug("Session {} removing attribute {}", getId(), name);
-    nativeSession.removeAttribute(name);
-    attributes.removeAttribute(name);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void removeValue(String name) {
-    removeAttribute(name);
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public void setAttribute(final String name, final Object value) {
-
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("Session {} setting attribute {} = '{}'",
-          new Object[]{id, name, value});
-    }
-
-    isDirty = true;
-    nativeSession.setAttribute(name, value);
-    if (value == null) {
-      removeAttribute(name);
-    } else {
-      attributes.putAttribute(name, value);
-    }
-  }
-
-  /**
-   * Gemfire serialization {@inheritDoc}
-   */
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    DataSerializer.writeString(id, out);
-    DataSerializer.writeObject(attributes, out);
-  }
-
-  /**
-   * Gemfire de-serialization {@inheritDoc}
-   */
-  @Override
-  public void fromData(DataInput in) throws IOException,
-      ClassNotFoundException {
-    id = DataSerializer.readString(in);
-    attributes = DataSerializer.readObject(in);
-    if (getNativeSession() != null) {
-      for (String s : attributes.getAttributeNames()) {
-        getNativeSession().setAttribute(s, attributes.getAttribute(s));
-      }
-    }
-
-    // Explicit sets
-    serialized.set(true);
-    attributes.setSession(this);
-  }
-
-  /**
-   * These three methods handle delta propagation and are deferred to the
-   * attribute object.
-   */
-  @Override
-  public boolean hasDelta() {
-    return isDirty;
-  }
-
-  @Override
-  public void toDelta(DataOutput out) throws IOException {
-    if (attributes instanceof Delta) {
-      ((Delta) attributes).toDelta(out);
-    } else {
-      toData(out);
-    }
-  }
-
-  @Override
-  public void fromDelta(DataInput in) throws IOException,
-      InvalidDeltaException {
-    if (attributes instanceof Delta) {
-      ((Delta) attributes).fromDelta(in);
-    } else {
-      try {
-        fromData(in);
-      } catch (ClassNotFoundException cex) {
-        throw new IOException("Unable to forward fromDelta() call "
-            + "to fromData()", cex);
-      }
-    }
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder();
-    builder.append("[id=").append(id)
-        .append(", isNew=").append(isNew)
-        .append(", isValid=").append(isValid)
-        .append(", hasDelta=").append(hasDelta())
-        .append(", lastAccessedTime=").append(attributes.getLastAccessedTime())
-        .append(", jvmOwnerId=").append(attributes.getJvmOwnerId());
-    builder.append("]");
-    return builder.toString();
-  }
-
-  /**
-   * Flush the session object to the region
-   */
-  public void putInRegion() {
-
-    manager.putSession(this);
-    isDirty = false;
-  }
-
-  /**
-   * Determine whether the session is still valid or whether it has expired.
-   *
-   * @return true or false
-   */
-  public boolean isValid() {
-    if (!isValid) {
-      return false;
-    }
-    if (getMaxInactiveInterval() >= 0) {
-      long now = System.currentTimeMillis();
-      if (now - attributes.getLastAccessedTime() >= getMaxInactiveInterval() * 1000) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  /**
-   * Is this session dirty and should it be written to cache
-   */
-  public boolean isDirty() {
-    return isDirty;
-  }
-
-  public void setManager(SessionManager manager) {
-    this.manager = manager;
-  }
-
-  /**
-   * For testing allow retrieval of the wrapped, native session.
-   */
-  public HttpSession getNativeSession() {
-    return nativeSession;
-  }
-
-
-  public void setNativeSession(HttpSession session) {
-    this.nativeSession = session;
-  }
-
-  /**
-   * Handle the process of failing over the session to a new native session
-   * object.
-   *
-   * @param session
-   */
-  public void failoverSession(HttpSession session) {
-    LOG.debug("Failing over session {} to {}", getId(), session.getId());
-    setNativeSession(session);
-    for (String name : attributes.getAttributeNames()) {
-      LOG.debug("Copying '{}' => {}", name, attributes.getAttribute(name));
-      session.setAttribute(name, attributes.getAttribute(name));
-    }
-    session.setMaxInactiveInterval(attributes.getMaxIntactiveInterval());
-    manager.putSession(this);
-  }
-
-
-  /**
-   * Update the last accessed time
-   */
-  public void updateAccessTime() {
-    attributes.setLastAccessedTime(System.currentTimeMillis());
-  }
-
-  /**
-   * The {@code SessionManager} injects this when creating a new session.
-   *
-   * @param attributes
-   */
-  public void setAttributes(AbstractSessionAttributes attributes) {
-    this.attributes = attributes;
-  }
-
-  /**
-   * This is called on deserialization. You can only call it once to get a
-   * meaningful value as it resets the serialized state. In other words, this
-   * call is not idempotent.
-   *
-   * @return whether this object has just been serialized
-   */
-  public boolean justSerialized() {
-    return serialized.getAndSet(false);
-  }
-
-  /**
-   * Called when the session is about to go out of scope. If the session has
-   * been defined to use async queued attributes then they will be written out
-   * at this point.
-   */
-  public void commit() {
-    attributes.setJvmOwnerId(manager.getJvmId());
-    attributes.flush();
-  }
-
-  public String getJvmOwnerId() {
-    if (attributes != null) {
-      return attributes.getJvmOwnerId();
-    }
-
-    return null;
-  }
-}
-



Mime
View raw message