geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [45/69] [abbrv] geode git commit: GEODE-2927: fix pulse logging and useLocator, SSL flags
Date Mon, 22 May 2017 18:29:41 GMT
GEODE-2927: fix pulse logging and useLocator, SSL flags

* using local mbs server connection will bypass all the mbean security checks
* do not update the mbean attribute since pulse user has no cluster:write privilege at all
* Created EmbeddedPulseRule for tests
* simplify PulseAppListener
* use log4j2 logging configurations


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/0f978a6d
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/0f978a6d
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/0f978a6d

Branch: refs/heads/feature/GEODE-2580
Commit: 0f978a6df711d04e0c7c1926fb1e297d07c21aa3
Parents: b3fc0c8
Author: Jinmei Liao <jiliao@pivotal.io>
Authored: Wed Mar 22 19:45:19 2017 -0700
Committer: Jinmei Liao <jiliao@pivotal.io>
Committed: Thu May 18 07:46:54 2017 -0700

----------------------------------------------------------------------
 .../test/dunit/rules/EmbeddedPulseRule.java     |  39 +-
 .../geode/tools/pulse/PulseSecurityTest.java    |  34 +-
 .../tools/pulse/PulseSecurityWithSSLTest.java   |   1 -
 .../tools/pulse/PulseVerificationTest.java      |  70 +++
 .../management/internal/ManagementAgent.java    |   8 +-
 .../cli/commands/LauncherLifecycleCommands.java |   1 -
 .../tools/pulse/internal/PulseAppListener.java  | 583 ++-----------------
 .../internal/controllers/PulseController.java   |   8 -
 .../tools/pulse/internal/data/Cluster.java      |  43 +-
 .../pulse/internal/data/IClusterUpdater.java    |   6 +
 .../pulse/internal/data/JMXDataUpdater.java     | 157 +----
 .../tools/pulse/internal/data/Repository.java   | 127 +---
 .../security/GemFireAuthenticationProvider.java |  33 +-
 .../pulse/internal/security/LogoutHandler.java  |  22 +-
 .../internal/service/ClusterMemberService.java  |   2 -
 .../service/ClusterMembersRGraphService.java    |  20 +-
 geode-pulse/src/main/resources/log4j2.xml       |  31 +
 geode-pulse/src/main/resources/pulse.properties |  23 +-
 .../controllers/PulseControllerJUnitTest.java   |   6 -
 19 files changed, 325 insertions(+), 889 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
index 0ed5403..f81d7f4 100644
--- a/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
+++ b/geode-assembly/src/test/java/org/apache/geode/test/dunit/rules/EmbeddedPulseRule.java
@@ -18,37 +18,58 @@ package org.apache.geode.test.dunit.rules;
 import org.apache.geode.tools.pulse.internal.data.Repository;
 import org.junit.rules.ExternalResource;
 
-import java.util.function.Supplier;
-
 /**
  * This is used to test embedded pulse. If your test needs to check pulse's repository object for
  * assertions, use this rules to properly initialize and cleanup the repository
  *
+ *
+ *
  */
 public class EmbeddedPulseRule extends ExternalResource {
-  private Supplier<Integer> portSupplier;
   private Repository repository;
 
-  public EmbeddedPulseRule(Supplier<Integer> portSupplier) {
-    this.portSupplier = portSupplier;
-  }
-
   public Repository getRepository() {
     return repository;
   }
 
   protected void before() throws Throwable {
     repository = Repository.get();
-    repository.setJmxHost("localhost");
-    repository.setJmxPort(portSupplier.get() + "");
+    cleanup();
+    repository.setHost("localhost");
+  }
+
+  public void useJmxPort(int jmxPort) {
     repository.setJmxUseLocator(false);
+    repository.setPort(jmxPort + "");
+  }
+
+  public void useLocatorPort(int locatorPort) {
+    repository.setJmxUseLocator(true);
+    repository.setPort(locatorPort + "");
+  }
+
+  public void setLocatorSSL(boolean locatorSSL) {
+    repository.setUseSSLLocator(locatorSSL);
+  }
+
+  public void setJmxSSL(boolean jmxSSL) {
+    repository.setUseSSLManager(jmxSSL);
   }
 
   /**
    * Override to tear down your specific external resource.
    */
   protected void after() {
+    cleanup();
+  }
+
+  private void cleanup() {
     if (repository != null) {
+      repository.setPort("-1");
+      repository.setHost("");
+      repository.setJmxUseLocator(false);
+      repository.setUseSSLManager(false);
+      repository.setUseSSLManager(false);
       repository.removeAllClusters();
     }
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java
index 7278c84..832564f 100644
--- a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityTest.java
@@ -17,28 +17,34 @@ package org.apache.geode.tools.pulse;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.security.SimpleTestSecurityManager;
+import org.apache.geode.test.dunit.rules.EmbeddedPulseRule;
 import org.apache.geode.test.dunit.rules.HttpClientRule;
-import org.apache.geode.test.dunit.rules.LocatorStarterRule;
+import org.apache.geode.test.dunit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.tools.pulse.internal.data.Cluster;
 import org.apache.http.HttpResponse;
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.junit.rules.RuleChain;
 
 
 @Category(IntegrationTest.class)
 public class PulseSecurityTest {
 
-  private LocatorStarterRule locator =
-      new LocatorStarterRule().withSecurityManager(SimpleTestSecurityManager.class).withAutoStart();
-
-  private HttpClientRule client = new HttpClientRule(locator::getHttpPort);
+  @ClassRule
+  public static ServerStarterRule server =
+      new ServerStarterRule().withSecurityManager(SimpleTestSecurityManager.class).withJMXManager()
+          .withRegion(RegionShortcut.REPLICATE, "regionA");
 
   @Rule
-  public RuleChain ruleChain = RuleChain.outerRule(locator).around(client);
+  public EmbeddedPulseRule pulse = new EmbeddedPulseRule();
 
+  @Rule
+  public HttpClientRule client = new HttpClientRule(server::getHttpPort);
 
 
   @Test
@@ -88,4 +94,18 @@ public class PulseSecurityTest {
     assertThat(response.getStatusLine().getStatusCode()).isEqualTo(403);
   }
 
+  @Test
+  public void queryUsingEmbededPulseWillHaveAuthorizationEnabled() throws Exception {
+    pulse.useJmxPort(server.getJmxPort());
+    // using "cluster" to connect to jmx manager will not get authorized to execute query
+    Cluster cluster = pulse.getRepository().getCluster("cluster", "cluster");
+    ObjectNode result = cluster.executeQuery("select * from /regionA a order by a", null, 0);
+    assertThat(result.toString()).contains("cluster not authorized for DATA:READ");
+
+    // using "data" to connect to jmx manager will succeeed
+    cluster = pulse.getRepository().getCluster("data", "data");
+    result = cluster.executeQuery("select * from /regionA a order by a", null, 0);
+    assertThat(result.toString()).contains("No Data Found");
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java
index 3b9cd72..0bacd99 100644
--- a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseSecurityWithSSLTest.java
@@ -56,7 +56,6 @@ public class PulseSecurityWithSSLTest {
     securityProps.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannels.JMX);
     securityProps.setProperty(SSL_KEYSTORE, jks.getCanonicalPath());
     securityProps.setProperty(SSL_KEYSTORE_PASSWORD, "password");
-    // securityProps.setProperty(SSL_KEYSTORE_TYPE, "JKS");
     securityProps.setProperty(SSL_TRUSTSTORE, jks.getCanonicalPath());
     securityProps.setProperty(SSL_TRUSTSTORE_PASSWORD, "password");
     securityProps.setProperty(SSL_PROTOCOLS, "TLSv1.2");

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java
new file mode 100644
index 0000000..44fadb6
--- /dev/null
+++ b/geode-assembly/src/test/java/org/apache/geode/tools/pulse/PulseVerificationTest.java
@@ -0,0 +1,70 @@
+/*
+ * 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.geode.tools.pulse;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.apache.geode.test.dunit.rules.EmbeddedPulseRule;
+import org.apache.geode.test.dunit.rules.HttpClientRule;
+import org.apache.geode.test.dunit.rules.LocatorStarterRule;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.tools.pulse.internal.data.Cluster;
+import org.apache.http.HttpResponse;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+
+@Category(IntegrationTest.class)
+public class PulseVerificationTest {
+
+  @ClassRule
+  public static LocatorStarterRule locator =
+      new LocatorStarterRule().withJMXManager().withAutoStart();
+
+  @Rule
+  public EmbeddedPulseRule pulse = new EmbeddedPulseRule();
+
+  @Rule
+  public HttpClientRule client = new HttpClientRule(locator::getHttpPort);
+
+  @Test
+  public void loginWithIncorrectPassword() throws Exception {
+    HttpResponse response = client.loginToPulse("admin", "wrongPassword");
+    assertThat(response.getStatusLine().getStatusCode()).isEqualTo(302);
+    assertThat(response.getFirstHeader("Location").getValue())
+        .contains("/pulse/login.html?error=BAD_CREDS");
+
+    client.loginToPulseAndVerify("admin", "admin");
+  }
+
+  @Test
+  public void testConnectToJmx() throws Exception {
+    pulse.useJmxPort(locator.getJmxPort());
+    Cluster cluster = pulse.getRepository().getCluster("admin", null);
+    assertThat(cluster.isConnectedFlag()).isTrue();
+    assertThat(cluster.getServerCount()).isEqualTo(0);
+  }
+
+  @Test
+  public void testConnectToLocator() throws Exception {
+    pulse.useLocatorPort(locator.getPort());
+    Cluster cluster = pulse.getRepository().getCluster("admin", null);
+    assertThat(cluster.isConnectedFlag()).isTrue();
+    assertThat(cluster.getServerCount()).isEqualTo(0);
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
index 62310e8..bf0b99c 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/ManagementAgent.java
@@ -103,6 +103,7 @@ public class ManagementAgent {
   private static final String PULSE_EMBEDDED_PROP = "pulse.embedded";
   private static final String PULSE_PORT_PROP = "pulse.port";
   private static final String PULSE_USESSL_MANAGER = "pulse.useSSL.manager";
+  private static final String PULSE_USESSL_LOCATOR = "pulse.useSSL.locator";
 
   public ManagementAgent(DistributionConfig config) {
     this.config = config;
@@ -272,9 +273,12 @@ public class ManagementAgent {
           System.setProperty(PULSE_EMBEDDED_PROP, "true");
           System.setProperty(PULSE_PORT_PROP, "" + config.getJmxManagerPort());
 
-          final SocketCreator socketCreator =
+          final SocketCreator jmxSocketCreator =
               SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX);
-          System.setProperty(PULSE_USESSL_MANAGER, socketCreator.useSSL() + "");
+          final SocketCreator locatorSocketCreator = SocketCreatorFactory
+              .getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR);
+          System.setProperty(PULSE_USESSL_MANAGER, jmxSocketCreator.useSSL() + "");
+          System.setProperty(PULSE_USESSL_LOCATOR, locatorSocketCreator.useSSL() + "");
 
           this.httpServer = JettyHelper.startJetty(this.httpServer);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
index 101bae4..0de41c0 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LauncherLifecycleCommands.java
@@ -2281,7 +2281,6 @@ public class LauncherLifecycleCommands extends AbstractCommandsSupport {
   @CliCommand(value = CliStrings.START_PULSE, help = CliStrings.START_PULSE__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_MANAGER,
       CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_M_AND_M})
-  // TODO change url parameter type to URL when I figure out the Converter logic in Gfsh
   public Result startPulse(@CliOption(key = CliStrings.START_PULSE__URL,
       unspecifiedDefaultValue = "http://localhost:7070/pulse",
       help = CliStrings.START_PULSE__URL__HELP) final String url) {

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
index 35f494b..34dbf2e 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/PulseAppListener.java
@@ -18,25 +18,13 @@
 package org.apache.geode.tools.pulse.internal;
 
 import org.apache.geode.tools.pulse.internal.controllers.PulseController;
-import org.apache.geode.tools.pulse.internal.data.PulseConfig;
 import org.apache.geode.tools.pulse.internal.data.PulseConstants;
 import org.apache.geode.tools.pulse.internal.data.Repository;
-import org.apache.commons.lang.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.Level;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.support.WebApplicationContextUtils;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.InetAddress;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map.Entry;
 import java.util.Properties;
@@ -56,25 +44,8 @@ public class PulseAppListener implements ServletContextListener {
   private static final Logger logger = LogManager.getLogger();
   private final ResourceBundle resourceBundle = Repository.get().getResourceBundle();
 
-  // String object to store all messages which needs to be logged into the log
-  // file before logger gets initialized
-  private String messagesToBeLogged = "";
-
   private Properties pulseProperties;
   private Properties pulseSecurityProperties;
-  private Boolean sysPulseUseLocator;
-  private String sysPulseHost;
-  private String sysPulsePort;
-  private String jmxUserName;
-  private String jmxUserPassword;
-
-  private boolean sysPulseUseSSLLocator;
-  private boolean sysPulseUseSSLManager;
-
-  // This property determines if pulse webApp login is authenticated against
-  // GemFire integrated security or custom spring-security config provided
-  // in pulse-authentication-custom.xml
-  private boolean useGemFireCredentials;
 
   @Override
   public void contextDestroyed(ServletContextEvent event) {
@@ -89,36 +60,16 @@ public class PulseAppListener implements ServletContextListener {
 
   @Override
   public void contextInitialized(ServletContextEvent event) {
-
-    messagesToBeLogged = messagesToBeLogged
-        .concat(formatLogString(resourceBundle.getString("LOG_MSG_CONTEXT_INITIALIZED")));
-
-    // Load Pulse version details
-    loadPulseVersionDetails();
-
+    logger.info(resourceBundle.getString("LOG_MSG_CONTEXT_INITIALIZED"));
     // Load Pulse Properties
     pulseProperties = loadProperties(PulseConstants.PULSE_PROPERTIES_FILE);
 
-    if (pulseProperties.isEmpty()) {
-      messagesToBeLogged = messagesToBeLogged
-          .concat(formatLogString(resourceBundle.getString("LOG_MSG_PROPERTIES_NOT_FOUND")));
-    } else {
-      messagesToBeLogged = messagesToBeLogged
-          .concat(formatLogString(resourceBundle.getString("LOG_MSG_PROPERTIES_FOUND")));
-
-      // set Pulse product support into the Pulse controller for access from
-      // client side
-      // to display the appropriate ui depending on which product is supported
-      // in present deployment
-      String pulseProduct =
-          pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_PRODUCTSUPPORT);
-    }
+    // Load Pulse version details
+    loadPulseVersionDetails();
 
+    // load pulse security properties
     pulseSecurityProperties = loadProperties(PulseConstants.PULSE_SECURITY_PROPERTIES_FILE);
 
-    // Initialize logger
-    initializeLogger();
-
     // Reference to repository
     Repository repository = Repository.get();
 
@@ -127,499 +78,79 @@ public class PulseAppListener implements ServletContextListener {
     boolean sysIsEmbedded = Boolean.getBoolean(PulseConstants.SYSTEM_PROPERTY_PULSE_EMBEDDED);
 
     if (sysIsEmbedded) {
-      // Application Pulse is running in Embedded Mode
+      // jmx connection parameters
       logger.info(resourceBundle.getString("LOG_MSG_APP_RUNNING_EMBEDDED_MODE"));
-      repository.setIsEmbeddedMode(true);
-
-      sysPulseUseLocator = Boolean.FALSE;
-      try {
-        // Get host name of machine running pulse in embedded mode
-        sysPulseHost = InetAddress.getLocalHost().getCanonicalHostName();
-      } catch (Exception e) {
-        logger.debug(resourceBundle.getString("LOG_MSG_JMX_CONNECTION_UNKNOWN_HOST"), e);
-        // Set default host name
-        sysPulseHost = PulseConstants.GEMFIRE_DEFAULT_HOST;
-      }
-      sysPulsePort = System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_PORT);
-      if (StringUtils.isBlank(sysPulsePort)) {
-        sysPulsePort = PulseConstants.GEMFIRE_DEFAULT_PORT;
-      }
-
+      repository.setJmxUseLocator(false);
+      repository.setHost(PulseConstants.GEMFIRE_DEFAULT_HOST);
+      repository.setPort(System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_PORT,
+          PulseConstants.GEMFIRE_DEFAULT_PORT));
+
+      // SSL, all the other system properties are already set in the embedded VM
+      repository.setUseSSLManager(
+          Boolean.valueOf(System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_MANAGER)));
+      repository.setUseSSLLocator(
+          Boolean.valueOf(System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_LOCATOR)));
     } else {
-      // Application Pulse is running in Non-Embedded Mode
+      // jmx connection parameters
       logger.info(resourceBundle.getString("LOG_MSG_APP_RUNNING_NONEMBEDDED_MODE"));
-      repository.setIsEmbeddedMode(false);
-
-      // Load JMX User Details
-      loadJMXUserDetails();
-      // Load locator and/or manager details
-      loadLocatorManagerDetails();
-
-      useGemFireCredentials = areWeUsingGemFireSecurityProfile(event);
-    }
-
-    // Set user details in repository
-    repository.setJmxUserName(jmxUserName);
-    repository.setJmxUserPassword(jmxUserPassword);
-
-    // Set locator/Manager details in repository
-    repository.setJmxUseLocator(sysPulseUseLocator);
-    repository.setJmxHost(sysPulseHost);
-    repository.setJmxPort(sysPulsePort);
-
-    // set SSL info
-    initializeSSL();
-    if (sysIsEmbedded) {
-      sysPulseUseSSLManager = Boolean
-          .parseBoolean(System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_MANAGER));
-    }
-    repository.setUseSSLLocator(sysPulseUseSSLLocator);
-    repository.setUseSSLManager(sysPulseUseSSLManager);
-
-    repository.setUseGemFireCredentials(useGemFireCredentials);
-
-  }
-
-  /**
-   * Return true if pulse is configure to authenticate using gemfire integrated security
-   * 
-   * @param event
-   * @return
-   */
-  private boolean areWeUsingGemFireSecurityProfile(ServletContextEvent event) {
-    String profile = null;
-    WebApplicationContext ctx =
-        WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
-    if (ctx.getEnvironment() != null) {
-      String[] profiles = ctx.getEnvironment().getActiveProfiles();
-      if (profiles != null && profiles.length > 0) {
-        StringBuilder sb = new StringBuilder();
-        for (String p : profiles)
-          sb.append(p).append(",");
-        logger.info("#SpringProfilesConfigured : {}", sb);
-        profile = ctx.getEnvironment().getActiveProfiles()[0];
-        logger.info("#First Profile : {}", profile);
-      } else {
-        logger.info("No SpringProfileConfigured using default spring profile");
-        return false;
-      }
-    }
-    if (PulseConstants.APPLICATION_PROPERTY_PULSE_SEC_PROFILE_GEMFIRE.equals(profile)) {
-      logger.info("Using gemfire integrated security profile");
-      return true;
-    }
-    return false;
-  }
-
-  // Function to load pulse version details from properties file
-  private void loadPulseVersionDetails() {
-
-    // Read version details from version property file
-    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-    InputStream inputStream =
-        classLoader.getResourceAsStream(PulseConstants.PULSE_VERSION_PROPERTIES_FILE);
-
-    if (inputStream != null) {
-      Properties properties = new Properties();
-      try {
-        properties.load(inputStream);
-      } catch (IOException e) {
-        messagesToBeLogged = messagesToBeLogged.concat(
-            formatLogString(resourceBundle.getString("LOG_MSG_EXCEPTION_LOADING_PROPERTIES_FILE")));
-      } finally {
-        try {
-          inputStream.close();
-        } catch (IOException e) {
-          messagesToBeLogged = messagesToBeLogged.concat(
-              formatLogString(resourceBundle.getString("LOG_MSG_EXCEPTION_CLOSING_INPUT_STREAM")));
-        }
-      }
-      // Set pulse version details in common object
-      PulseController.pulseVersion
-          .setPulseVersion(properties.getProperty(PulseConstants.PROPERTY_PULSE_VERSION, ""));
-      PulseController.pulseVersion
-          .setPulseBuildId(properties.getProperty(PulseConstants.PROPERTY_BUILD_ID, ""));
-      PulseController.pulseVersion
-          .setPulseBuildDate(properties.getProperty(PulseConstants.PROPERTY_BUILD_DATE, ""));
-      PulseController.pulseVersion
-          .setPulseSourceDate(properties.getProperty(PulseConstants.PROPERTY_SOURCE_DATE, ""));
-      PulseController.pulseVersion.setPulseSourceRevision(
-          properties.getProperty(PulseConstants.PROPERTY_SOURCE_REVISION, ""));
-      PulseController.pulseVersion.setPulseSourceRepository(
-          properties.getProperty(PulseConstants.PROPERTY_SOURCE_REPOSITORY, ""));
-    }
-
-    // Log Pulse Version details into log file
-    messagesToBeLogged = messagesToBeLogged
-        .concat(formatLogString(PulseController.pulseVersion.getPulseVersionLogMessage()));
-  }
-
-  private void initializeLogger() {
-
-    // Override default log configuration by properties which are provided in
-    // properties file.
-    loadLogDetailsFromPropertyFile();
-
-    // Override log configuration by properties which are provided in
-    // through system properties.
-    loadLogDetailsFromSystemProperties();
-
-    // Log messages stored in messagesToBeLogged
-    logger.info(messagesToBeLogged);
-    messagesToBeLogged = "";
-  }
-
-  // Function to load pulse properties from pulse.properties file
-  private Properties loadProperties(String propertyFile) {
-
-    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-    InputStream inputStream = classLoader.getResourceAsStream(propertyFile);
-    Properties properties = new Properties();
-
-    if (inputStream != null) {
-      messagesToBeLogged = messagesToBeLogged.concat(
-          formatLogString(propertyFile + " " + resourceBundle.getString("LOG_MSG_FILE_FOUND")));
-
-      try {
-        // Load properties from input stream
-        properties.load(inputStream);
-      } catch (IOException e1) {
-        messagesToBeLogged = messagesToBeLogged.concat(
-            formatLogString(resourceBundle.getString("LOG_MSG_EXCEPTION_LOADING_PROPERTIES_FILE")
-                + " " + propertyFile));
-      } finally {
-        // Close input stream
-        try {
-          inputStream.close();
-        } catch (IOException e) {
-          messagesToBeLogged = messagesToBeLogged.concat(
-              formatLogString(resourceBundle.getString("LOG_MSG_EXCEPTION_CLOSING_INPUT_STREAM")
-                  + " " + propertyFile));
-        }
-      }
-
-    } else {
-      messagesToBeLogged = messagesToBeLogged.concat(formatLogString(
-          resourceBundle.getString("LOG_MSG_COULD_NOT_READ_FILE") + " " + propertyFile));
-    }
-    return properties;
-  }
-
-  // Function to load Logging details from properties file
-  private void loadLogDetailsFromPropertyFile() {
-
-    // return, if Pulse Properties are not provided
-    if (pulseProperties.size() == 0) {
-      return;
-    }
-
-    messagesToBeLogged = messagesToBeLogged
-        .concat(formatLogString(resourceBundle.getString("LOG_MSG_CHECK_LOG_PROPERTIES_IN_FILE")));
-
-    HashMap<String, String> logPropertiesHM = new HashMap<String, String>();
-
-    logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILENAME,
-        pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILENAME, ""));
-
-    logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILELOCATION,
-        pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILELOCATION, ""));
-
-    logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILESIZE,
-        pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILESIZE, ""));
-
-    logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILECOUNT,
-        pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILECOUNT, ""));
-
-    logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGDATEPATTERN,
-        pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGDATEPATTERN, ""));
-
-    logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGLEVEL,
-        pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGLEVEL, ""));
-
-    logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGAPPEND,
-        pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGAPPEND, ""));
-
-    if (logPropertiesHM.size() == 0) {
-      messagesToBeLogged = messagesToBeLogged.concat(
-          formatLogString(resourceBundle.getString("LOG_MSG_LOG_PROPERTIES_NOT_FOUND_IN_FILE")));
-    } else {
-      messagesToBeLogged = messagesToBeLogged.concat(
-          formatLogString(resourceBundle.getString("LOG_MSG_LOG_PROPERTIES_FOUND_IN_FILE")));
-    }
-
-    setLogConfigurations(logPropertiesHM);
-  }
-
-  // Function to load Logging details from system properties
-  private void loadLogDetailsFromSystemProperties() {
-
-    messagesToBeLogged = messagesToBeLogged.concat(formatLogString(
-        resourceBundle.getString("LOG_MSG_CHECK_LOG_PROPERTIES_IN_SYSTEM_PROPERTIES")));
-
-    HashMap<String, String> logPropertiesHM = new HashMap<String, String>();
-
-    String sysLogFileName =
-        System.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILENAME);
-    String sysLogFileLocation =
-        System.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILELOCATION);
-    String sysLogFileSize =
-        System.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILESIZE);
-    String sysLogFileCount =
-        System.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILECOUNT);
-    String sysLogDatePattern =
-        System.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGDATEPATTERN);
-    String sysLogLevel = System.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGLEVEL);
-    String sysLogAppend = System.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGAPPEND);
-
-    if (sysLogFileName == null || sysLogFileName.isEmpty()) {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILENAME, "");
-    } else {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILENAME, sysLogFileName);
-    }
-
-    if (sysLogFileLocation == null || sysLogFileLocation.isEmpty()) {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILELOCATION, "");
-    } else {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILELOCATION,
-          sysLogFileLocation);
-    }
-
-    if (sysLogFileSize == null || sysLogFileSize.isEmpty()) {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILESIZE, "");
-    } else {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILESIZE, sysLogFileSize);
-    }
-
-    if (sysLogFileCount == null || sysLogFileCount.isEmpty()) {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILECOUNT, "");
-    } else {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILECOUNT, sysLogFileCount);
-    }
-
-    if (sysLogDatePattern == null || sysLogDatePattern.isEmpty()) {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGDATEPATTERN, "");
-    } else {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGDATEPATTERN,
-          sysLogDatePattern);
-    }
-
-    if (sysLogLevel == null || sysLogLevel.isEmpty()) {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGLEVEL, "");
-    } else {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGLEVEL, sysLogLevel);
-    }
-
-    if (sysLogAppend == null || sysLogAppend.isEmpty()) {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGAPPEND, "");
-    } else {
-      logPropertiesHM.put(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGAPPEND, sysLogAppend);
-    }
-
-    if (logPropertiesHM.size() == 0) {
-      messagesToBeLogged = messagesToBeLogged.concat(formatLogString(
-          resourceBundle.getString("LOG_MSG_LOG_PROPERTIES_NOT_FOUND_IN_SYSTEM_PROPERTIES")));
-    } else {
-      messagesToBeLogged = messagesToBeLogged.concat(formatLogString(
-          resourceBundle.getString("LOG_MSG_LOG_PROPERTIES_FOUND_IN_SYSTEM_PROPERTIES")));
-    }
-
-    setLogConfigurations(logPropertiesHM);
-  }
-
-  private void setLogConfigurations(HashMap<String, String> logPropertiesHM) {
-
-    PulseConfig pulseConfig = Repository.get().getPulseConfig();
-
-    // log file name
-    if (StringUtils
-        .isNotBlank(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILENAME))) {
-      pulseConfig.setLogFileName(
-          logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILENAME));
-    }
-
-    // log file location
-    if (StringUtils.isNotBlank(
-        logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILELOCATION))) {
-      pulseConfig.setLogFileLocation(
-          logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILELOCATION));
-    }
-
-    // log file size
-    if (StringUtils
-        .isNotBlank(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILESIZE))) {
-      pulseConfig.setLogFileSize(Integer
-          .parseInt(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILESIZE)));
-    }
-
-    // log file count
-    if (StringUtils
-        .isNotBlank(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILECOUNT))) {
-      pulseConfig.setLogFileCount(Integer
-          .parseInt(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGFILECOUNT)));
-    }
-
-    // log message date pattern
-    if (StringUtils.isNotBlank(
-        logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGDATEPATTERN))) {
-      pulseConfig.setLogDatePattern(
-          logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGDATEPATTERN));
-    }
-
-    // log level
-    if (StringUtils
-        .isNotBlank(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGLEVEL))) {
-      pulseConfig.setLogLevel(Level.getLevel(
-          logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGLEVEL).toUpperCase()));
-    }
-
-    // log append
-    if (StringUtils
-        .isNotBlank(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGAPPEND))) {
-      pulseConfig.setLogAppend(Boolean
-          .valueOf(logPropertiesHM.get(PulseConstants.APPLICATION_PROPERTY_PULSE_LOGAPPEND)));
-    }
-
-  }
-
-  // Function to load JMX User details from properties
-  private void loadJMXUserDetails() {
-    logger.info(resourceBundle.getString("LOG_MSG_GET_JMX_USER_DETAILS"));
-
-    if (pulseProperties.isEmpty()) {
-      logger.info("{}{}", resourceBundle.getString("LOG_MSG_JMX_USER_DETAILS_NOT_FOUND"),
-          resourceBundle.getString("LOG_MSG_REASON_USER_DETAILS_NOT_FOUND"));
-    } else {
-      jmxUserName =
-          pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_JMXUSERNAME, "");
-      jmxUserPassword =
-          pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_JMXPASSWORD, "");
-
-      if (jmxUserName.isEmpty() || jmxUserPassword.isEmpty()) {
-        logger.info("{}{}", resourceBundle.getString("LOG_MSG_JMX_USER_DETAILS_NOT_FOUND"),
-            resourceBundle.getString("LOG_MSG_REASON_USER_DETAILS_NOT_FOUND"));
-      } else {
-        logger.info(resourceBundle.getString("LOG_MSG_JMX_USER_DETAILS_FOUND"));
-      }
-    }
-  }
-
-  // Function to set SSL VM arguments
-  private void initializeSSL() {
-    logger.info(resourceBundle.getString("LOG_MSG_GET_SSL_DETAILS"));
-
-
-    this.sysPulseUseSSLLocator = Boolean.valueOf(
-        pulseProperties.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_LOCATOR, "false"));
-
-    this.sysPulseUseSSLManager = Boolean.valueOf(
-        pulseProperties.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_MANAGER, "false"));
-
-
-    if ((sysPulseUseSSLLocator || sysPulseUseSSLManager)) {
-      Properties sslProperties = new Properties();
+      repository.setJmxUseLocator(Boolean.valueOf(
+          pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_USELOCATOR)));
+      repository.setHost(pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_HOST,
+          PulseConstants.GEMFIRE_DEFAULT_HOST));
+      repository.setPort(pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_PORT,
+          PulseConstants.GEMFIRE_DEFAULT_PORT));
+
+      // SSL
+      repository.setUseSSLManager(Boolean.valueOf(pulseProperties
+          .getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_MANAGER, "false")));
+      repository.setUseSSLLocator(Boolean.valueOf(pulseProperties
+          .getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_USESSL_LOCATOR, "false")));
+
+      // set the ssl related properties found in pulsesecurity.properties
       if (!pulseSecurityProperties.isEmpty()) {
         Set entrySet = pulseSecurityProperties.entrySet();
         for (Iterator it = entrySet.iterator(); it.hasNext();) {
           Entry<String, String> entry = (Entry<String, String>) it.next();
           String key = entry.getKey();
           if (key.startsWith("javax.net.ssl.")) {
-
             String val = entry.getValue();
             System.setProperty(key, val);
-            sslProperties.setProperty(key, val);
           }
         }
       }
-      if (sslProperties.isEmpty()) {
-        logger.warn(resourceBundle.getString("LOG_MSG_SSL_NOT_SET"));
-      }
     }
-
   }
 
-  // Function to load locator and/or manager details
-  private void loadLocatorManagerDetails() {
-
-    // Get locator details through System Properties
-    logger.info(resourceBundle.getString("LOG_MSG_GET_LOCATOR_DETAILS_1"));
-
-    // Required System properties are
-    // -Dpulse.embedded="false" -Dpulse.useLocator="false"
-    // -Dpulse.host="192.168.2.11" -Dpulse.port="2099"
-    sysPulseUseLocator = Boolean.getBoolean(PulseConstants.SYSTEM_PROPERTY_PULSE_USELOCATOR);
-    sysPulseHost = System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_HOST);
-    sysPulsePort = System.getProperty(PulseConstants.SYSTEM_PROPERTY_PULSE_PORT);
-
-    if (sysPulseHost == null || sysPulseHost.isEmpty() || sysPulsePort == null
-        || sysPulsePort.isEmpty()) {
-      logger.info("{}{}", resourceBundle.getString("LOG_MSG_LOCATOR_DETAILS_NOT_FOUND"),
-          resourceBundle.getString("LOG_MSG_REASON_LOCATOR_DETAILS_NOT_FOUND_1"));
-      logger.info(resourceBundle.getString("LOG_MSG_GET_LOCATOR_DETAILS_2"));
-
-      if (pulseProperties.isEmpty()) {
-        logger.info("{}{}", resourceBundle.getString("LOG_MSG_LOCATOR_DETAILS_NOT_FOUND"),
-            resourceBundle.getString("LOG_MSG_REASON_LOCATOR_DETAILS_NOT_FOUND_2"));
-
-        sysPulseHost = "";
-        sysPulsePort = "";
-      } else {
-        logger.info(resourceBundle.getString("LOG_MSG_LOCATOR_DETAILS_FOUND"));
-
-        sysPulseUseLocator = Boolean.valueOf(
-            pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_USELOCATOR, ""));
-        sysPulseHost =
-            pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_HOST, "");
-        sysPulsePort =
-            pulseProperties.getProperty(PulseConstants.APPLICATION_PROPERTY_PULSE_PORT, "");
-      }
-    } else {
-      logger.info(resourceBundle.getString("LOG_MSG_LOCATOR_DETAILS_FOUND"));
-    }
+  // Function to load pulse version details from properties file
+  private void loadPulseVersionDetails() {
+    Properties properties = loadProperties(PulseConstants.PULSE_VERSION_PROPERTIES_FILE);
+    // Set pulse version details in common object
+    PulseController.pulseVersion
+        .setPulseVersion(properties.getProperty(PulseConstants.PROPERTY_PULSE_VERSION, ""));
+    PulseController.pulseVersion
+        .setPulseBuildId(properties.getProperty(PulseConstants.PROPERTY_BUILD_ID, ""));
+    PulseController.pulseVersion
+        .setPulseBuildDate(properties.getProperty(PulseConstants.PROPERTY_BUILD_DATE, ""));
+    PulseController.pulseVersion
+        .setPulseSourceDate(properties.getProperty(PulseConstants.PROPERTY_SOURCE_DATE, ""));
+    PulseController.pulseVersion.setPulseSourceRevision(
+        properties.getProperty(PulseConstants.PROPERTY_SOURCE_REVISION, ""));
+    PulseController.pulseVersion.setPulseSourceRepository(
+        properties.getProperty(PulseConstants.PROPERTY_SOURCE_REPOSITORY, ""));
+    logger.info(PulseController.pulseVersion.getPulseVersionLogMessage());
   }
 
-  private String formatLogString(String logMessage) {
-
-    DateFormat df = new SimpleDateFormat(PulseConstants.LOG_MESSAGE_DATE_PATTERN);
-    // DateFormat df = new
-    // SimpleDateFormat(Repository.get().getPulseConfig().getLogDatePattern());
-    StringWriter sw = new StringWriter();
-    PrintWriter pw = new PrintWriter(sw);
-
-    pw.println();
-    pw.print("[");
-    pw.print("INFO");
-    pw.print(" ");
-    pw.print(df.format(new Date(System.currentTimeMillis())));
-    String threadName = Thread.currentThread().getName();
-    if (threadName != null) {
-      pw.print(" ");
-      pw.print(threadName);
-    }
-    pw.print(" tid=0x");
-    pw.print(Long.toHexString(Thread.currentThread().getId()));
-    pw.print("] ");
-    pw.print("(msgTID=");
-    pw.print("");
-
-    pw.print(" msgSN=");
-    pw.print("");
-
-    pw.print(") ");
-
-    pw.println("[" + PulseConstants.APP_NAME + "]");
-
-    pw.println(Logger.class.getName());
-
-    pw.println(logMessage);
-
-    pw.close();
-    try {
-      sw.close();
-    } catch (IOException ignore) {
+  // Function to load pulse properties from pulse.properties file
+  private Properties loadProperties(String propertyFile) {
+    final Properties properties = new Properties();
+    try (final InputStream stream =
+        Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFile)) {
+      logger.info(propertyFile + " " + resourceBundle.getString("LOG_MSG_FILE_FOUND"));
+      properties.load(stream);
+    } catch (IOException e) {
+      logger.error(resourceBundle.getString("LOG_MSG_EXCEPTION_LOADING_PROPERTIES_FILE"), e);
     }
-    String result = sw.toString();
-    return result;
 
+    return properties;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/controllers/PulseController.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/controllers/PulseController.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/controllers/PulseController.java
index c878879..e609477 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/controllers/PulseController.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/controllers/PulseController.java
@@ -149,14 +149,6 @@ public class PulseController {
     ObjectNode responseJSON = mapper.createObjectNode();
 
     try {
-      // Reference to repository
-      Repository repository = Repository.get();
-      // set pulse web app url
-      String pulseWebAppUrl = request.getScheme() + "://" + request.getServerName() + ":"
-          + request.getServerPort() + request.getContextPath();
-
-      repository.setPulseWebAppUrl(pulseWebAppUrl);
-
       // Response
       responseJSON.put("pulseVersion", PulseController.pulseVersion.getPulseVersion());
       responseJSON.put("buildId", PulseController.pulseVersion.getPulseBuildId());

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Cluster.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Cluster.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Cluster.java
index 78e92d4..5b552a1 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Cluster.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Cluster.java
@@ -34,7 +34,6 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.net.ConnectException;
 import java.net.URL;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -71,9 +70,9 @@ public class Cluster extends Thread {
   private final ResourceBundle resourceBundle = Repository.get().getResourceBundle();
 
   private String jmxUserName;
-  private String jmxUserPassword;
   private String serverName;
   private String port;
+  private JMXConnector jmxConnector;
   private int stale = 0;
   private double loadPerSec;
   private CountDownLatch clusterHasBeenInitialized;
@@ -2276,19 +2275,14 @@ public class Cluster extends Thread {
    * @param host host name
    * @param port port
    * @param userName pulse user name
-   * @param userPassword pulse user password
-   * @throws ConnectException
    */
-  public Cluster(String host, String port, String userName, String userPassword)
-      throws ConnectException {
+  public Cluster(String host, String port, String userName) {
     this.serverName = host;
     this.port = port;
     this.jmxUserName = userName;
-    this.jmxUserPassword = userPassword;
 
     this.updater = ClusterDataFactory.getUpdater(this, host, port);
     this.clusterHasBeenInitialized = new CountDownLatch(1);
-    // start();
   }
 
   public void waitForInitialization(long timeout, TimeUnit unit) throws InterruptedException {
@@ -2385,18 +2379,6 @@ public class Cluster extends Thread {
     return this.jmxUserName;
   }
 
-  public void setJmxUserName(String jmxUserName) {
-    this.jmxUserName = jmxUserName;
-  }
-
-  public String getJmxUserPassword() {
-    return this.jmxUserPassword;
-  }
-
-  public void setJmxUserPassword(String jmxUserPassword) {
-    this.jmxUserPassword = jmxUserPassword;
-  }
-
   public String getConnectionErrorMsg() {
     return this.connectionErrorMsg;
   }
@@ -2818,14 +2800,25 @@ public class Cluster extends Thread {
     return this.getDataBrowser().deleteQueryById(userId, queryId);
   }
 
-  public JMXConnector connectToGemFire() {
-    if (this.updater instanceof JMXDataUpdater) {
-      return ((JMXDataUpdater) this.updater).getJMXConnection(false);
-    } else {
-      return null;
+  public void connectToGemFire(String password) {
+    jmxConnector = this.updater.connect(this.getJmxUserName(), password);
+
+    // if connected
+    if (jmxConnector != null) {
+      // Start Thread
+      this.start();
+      try {
+        this.waitForInitialization(15, TimeUnit.SECONDS);
+      } catch (InterruptedException e) {
+        e.printStackTrace();
+      }
     }
   }
 
+  public JMXConnector getJMXConnector() {
+    return this.jmxConnector;
+  }
+
   /**
    * inner class for creating Mock Data
    *

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/IClusterUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/IClusterUpdater.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/IClusterUpdater.java
index 3ec8207..fb837ea 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/IClusterUpdater.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/IClusterUpdater.java
@@ -19,6 +19,8 @@ package org.apache.geode.tools.pulse.internal.data;
 
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
+import javax.management.remote.JMXConnector;
+
 /**
  * Interface having updateData() function which is getting Override by both MockDataUpdater and
  * JMXDataUpdater
@@ -30,4 +32,8 @@ public interface IClusterUpdater {
   boolean updateData();
 
   ObjectNode executeQuery(String queryText, String members, int limit);
+
+  default JMXConnector connect(String username, String password) {
+    return null;
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/JMXDataUpdater.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/JMXDataUpdater.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/JMXDataUpdater.java
index c74e3cd..2da74f1 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/JMXDataUpdater.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/JMXDataUpdater.java
@@ -27,7 +27,6 @@ import org.apache.logging.log4j.Logger;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.lang.management.ManagementFactory;
 import java.math.BigDecimal;
 import java.net.Inet4Address;
 import java.net.Inet6Address;
@@ -49,7 +48,6 @@ import javax.management.AttributeList;
 import javax.management.AttributeNotFoundException;
 import javax.management.InstanceNotFoundException;
 import javax.management.IntrospectionException;
-import javax.management.InvalidAttributeValueException;
 import javax.management.MBeanException;
 import javax.management.MBeanServerConnection;
 import javax.management.MalformedObjectNameException;
@@ -75,7 +73,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
   private final ResourceBundle resourceBundle = Repository.get().getResourceBundle();
 
   private JMXConnector conn = null;
-  private MBeanServerConnection mbs;
+  private MBeanServerConnection mbs = null;
   private final String serverName;
   private final String port;
   private Boolean isAddedNotiListner = false;
@@ -87,7 +85,6 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
   private ObjectName MBEAN_OBJECT_NAME_MEMBER;
   private ObjectName MBEAN_OBJECT_NAME_MEMBER_MANAGER;
   private ObjectName MBEAN_OBJECT_NAME_STATEMENT_DISTRIBUTED;
-  private ObjectName MBEAN_OBJECT_NAME_TABLE_AGGREGATE;
 
   private Set<ObjectName> systemMBeans = null;
 
@@ -124,10 +121,10 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
   private JmxManagerInfo getManagerInfoFromLocator(Repository repository) {
 
     try {
-      String locatorHost = repository.getJmxHost();
-      int locatorPort = Integer.parseInt(repository.getJmxPort());
+      String locatorHost = repository.getHost();
+      int locatorPort = Integer.parseInt(repository.getPort());
 
-      logger.info("{} : {} & {} : {}", resourceBundle.getString("LOG_MSG_HOST"), locatorHost,
+      logger.info("{}={} & {}={}", resourceBundle.getString("LOG_MSG_HOST"), locatorHost,
           resourceBundle.getString("LOG_MSG_PORT"), locatorPort);
 
       InetAddress inetAddr = InetAddress.getByName(locatorHost);
@@ -135,11 +132,9 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
       if ((inetAddr instanceof Inet4Address) || (inetAddr instanceof Inet6Address)) {
 
         if (inetAddr instanceof Inet4Address) {
-          logger.info("{} - {}", resourceBundle.getString("LOG_MSG_LOCATOR_IPV4_ADDRESS"),
-              inetAddr);
+          logger.info("{}: {}", resourceBundle.getString("LOG_MSG_LOCATOR_IPV4_ADDRESS"), inetAddr);
         } else {
-          logger.info("{} - {}", resourceBundle.getString("LOG_MSG_LOCATOR_IPV6_ADDRESS"),
-              inetAddr);
+          logger.info("{}: {}", resourceBundle.getString("LOG_MSG_LOCATOR_IPV6_ADDRESS"), inetAddr);
         }
 
         JmxManagerInfo jmxManagerInfo = JmxManagerFinder.askLocatorForJmxManager(inetAddr,
@@ -168,19 +163,11 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
     return null;
   }
 
-  /**
-   * Default connection is Pulse which uses configured userName and password
-   */
-  public JMXConnector getJMXConnection() {
-    return getJMXConnection(true);
-  }
 
   /**
-   * Get connection for given userName and password. This is used for DataBrowser queries which has
-   * to be fired using credentials provided at pulse login page
+   * Get the jmx connection
    */
-  public JMXConnector getJMXConnection(final boolean registerURL) {
-    JMXConnector connection = null;
+  public JMXConnector connect(String username, String password) {
     // Reference to repository
     Repository repository = Repository.get();
     try {
@@ -196,7 +183,7 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
         if (jmxManagerInfo.port == 0) {
           logger.info(resourceBundle.getString("LOG_MSG_LOCATOR_COULD_NOT_FIND_MANAGER"));
         } else {
-          logger.info("{} : {} : {} & {} : {}{}",
+          logger.info("{}: {}={} & {}={}, {}",
               resourceBundle.getString("LOG_MSG_LOCATOR_FOUND_MANAGER"),
               resourceBundle.getString("LOG_MSG_HOST"), jmxManagerInfo.host,
               resourceBundle.getString("LOG_MSG_PORT"), jmxManagerInfo.port,
@@ -207,14 +194,14 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
               formJMXServiceURLString(jmxManagerInfo.host, String.valueOf(jmxManagerInfo.port));
         }
       } else {
-        logger.info("{} : {} & {} : {}", resourceBundle.getString("LOG_MSG_HOST"), this.serverName,
+        logger.info("{}={} & {}={}", resourceBundle.getString("LOG_MSG_HOST"), this.serverName,
             resourceBundle.getString("LOG_MSG_PORT"), this.port);
         jmxSerURL = formJMXServiceURLString(this.serverName, this.port);
       }
 
       if (StringUtils.isNotBlank(jmxSerURL)) {
         JMXServiceURL url = new JMXServiceURL(jmxSerURL);
-        String[] creds = {this.cluster.getJmxUserName(), this.cluster.getJmxUserPassword()};
+        String[] creds = {username, password};
         Map<String, Object> env = new HashMap<String, Object>();
         env.put(JMXConnector.CREDENTIALS, creds);
 
@@ -223,33 +210,24 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
           env.put("com.sun.jndi.rmi.factory.socket", new SslRMIClientSocketFactory());
         }
         logger.info("Connecting to jmxURL : {}", jmxSerURL);
-        connection = JMXConnectorFactory.connect(url, env);
-
-        // Register Pulse URL if not already present in the JMX Manager
-        if (registerURL) {
-          registerPulseUrlToManager(connection);
-        }
+        this.conn = JMXConnectorFactory.connect(url, env);
+        this.mbs = this.conn.getMBeanServerConnection();
+        cluster.setConnectedFlag(true);
       }
     } catch (Exception e) {
-      if (e instanceof UnknownHostException) {
-        cluster
-            .setConnectionErrorMsg(resourceBundle.getString("LOG_MSG_JMX_CONNECTION_UNKNOWN_HOST"));
-      }
-
-      StringWriter swBuffer = new StringWriter();
-      PrintWriter prtWriter = new PrintWriter(swBuffer);
-      e.printStackTrace(prtWriter);
-      logger.fatal("Exception Details : {}\n", swBuffer);
+      cluster.setConnectedFlag(false);
+      cluster.setConnectionErrorMsg(e.getMessage());
+      logger.fatal(e.getMessage(), e);
       if (this.conn != null) {
         try {
           this.conn.close();
         } catch (Exception e1) {
-          logger.fatal("Error closing JMX connection {}\n", swBuffer);
+          logger.fatal(e1.getMessage(), e1);
         }
         this.conn = null;
       }
     }
-    return connection;
+    return this.conn;
   }
 
   private String formJMXServiceURLString(String host, String port) throws UnknownHostException {
@@ -276,92 +254,13 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
     return jmxSerURL;
   }
 
-  // Method registers Pulse URL if not already present in the JMX Manager
-  private void registerPulseUrlToManager(JMXConnector connection)
-      throws IOException, AttributeNotFoundException, InstanceNotFoundException, MBeanException,
-      ReflectionException, MalformedObjectNameException, InvalidAttributeValueException {
-    logger.info(resourceBundle.getString("LOG_MSG_REGISTERING_APP_URL_TO_MANAGER"));
-
-    // Reference to repository
-    Repository repository = Repository.get();
-
-    // Register Pulse URL if not already present in the JMX Manager
-    if (connection != null) {
-      MBeanServerConnection mbsc = connection.getMBeanServerConnection();
-
-      Set<ObjectName> mbeans = mbsc.queryNames(this.MBEAN_OBJECT_NAME_MEMBER_MANAGER, null);
-
-      for (ObjectName mbeanName : mbeans) {
-        String presentUrl =
-            (String) mbsc.getAttribute(mbeanName, PulseConstants.MBEAN_MANAGER_ATTRIBUTE_PULSEURL);
-        String pulseWebAppUrl = repository.getPulseWebAppUrl();
-        if (pulseWebAppUrl != null && (presentUrl == null || !pulseWebAppUrl.equals(presentUrl))) {
-          logger.debug(resourceBundle.getString("LOG_MSG_SETTING_APP_URL_TO_MANAGER"));
-          Attribute pulseUrlAttr =
-              new Attribute(PulseConstants.MBEAN_MANAGER_ATTRIBUTE_PULSEURL, pulseWebAppUrl);
-          mbsc.setAttribute(mbeanName, pulseUrlAttr);
-        } else {
-          logger.debug(resourceBundle.getString("LOG_MSG_APP_URL_ALREADY_PRESENT_IN_MANAGER"));
-        }
-      }
-    }
-  }
-
-  private boolean isConnected() {
-    // Reference to repository
-    Repository repository = Repository.get();
-    if (repository.getIsEmbeddedMode()) {
-      if (this.mbs == null) {
-        this.mbs = ManagementFactory.getPlatformMBeanServer();
-        cluster.setConnectedFlag(true);
-      }
-    } else {
-      try {
-        if (this.conn == null) {
-          cluster.setConnectedFlag(false);
-          cluster.setConnectionErrorMsg(resourceBundle.getString("LOG_MSG_JMX_CONNECTION_NOT_FOUND")
-              + " " + resourceBundle.getString("LOG_MSG_JMX_GETTING_NEW_CONNECTION"));
-          logger.debug("{} {}", resourceBundle.getString("LOG_MSG_JMX_CONNECTION_NOT_FOUND"),
-              resourceBundle.getString("LOG_MSG_JMX_GET_NEW_CONNECTION"));
-          this.conn = getJMXConnection();
-          if (this.conn != null) {
-            this.mbs = this.conn.getMBeanServerConnection();
-            cluster.setConnectedFlag(true);
-          } else {
-            logger.info(resourceBundle.getString("LOG_MSG_JMX_CONNECTION_NOT_FOUND"));
-            return false;
-          }
-        } else {
-          logger.debug(resourceBundle.getString("LOG_MSG_JMX_CONNECTION_IS_AVAILABLE"));
-          cluster.setConnectedFlag(true);
-          if (this.mbs == null) {
-            this.mbs = this.conn.getMBeanServerConnection();
-          }
-        }
-      } catch (Exception e) {
-        this.mbs = null;
-        if (this.conn != null) {
-          try {
-            this.conn.close();
-          } catch (Exception e1) {
-            logger.fatal(e);
-          }
-        }
-        this.conn = null;
-        return false;
-      }
-    }
-
-    return true;
-  }
-
   /**
    * function used for updating Cluster Data.
    */
   @Override
   public boolean updateData() {
     try {
-      if (!this.isConnected()) {
+      if (this.conn == null) {
         return false;
       }
 
@@ -377,9 +276,6 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
         cluster.getDeletedRegions().add(region.getFullPath());
       }
 
-      // try {
-
-      // Cluster
       this.systemMBeans = this.mbs.queryNames(this.MBEAN_OBJECT_NAME_SYSTEM_DISTRIBUTED, null);
       for (ObjectName sysMBean : this.systemMBeans) {
         updateClusterSystem(sysMBean);
@@ -389,9 +285,6 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
       Set<ObjectName> regionMBeans =
           this.mbs.queryNames(this.MBEAN_OBJECT_NAME_REGION_DISTRIBUTED, null);
 
-      Set<ObjectName> tableMBeans =
-          this.mbs.queryNames(this.MBEAN_OBJECT_NAME_TABLE_AGGREGATE, null);
-
       // For Gemfire
       for (ObjectName regMBean : regionMBeans) {
         updateClusterRegion(regMBean);
@@ -440,19 +333,15 @@ public class JMXDataUpdater implements IClusterUpdater, NotificationListener {
         updateClusterStatement(stmtObjectName);
       }
     } catch (IOException ioe) {
-
-      // write errors
-      StringWriter swBuffer = new StringWriter();
-      PrintWriter prtWriter = new PrintWriter(swBuffer);
-      ioe.printStackTrace(prtWriter);
-      logger.fatal("IOException Details : {}\n", swBuffer);
+      logger.fatal(ioe.getMessage(), ioe);
       this.mbs = null;
       if (this.conn != null) {
         try {
           this.conn.close();
         } catch (IOException e1) {
-          logger.fatal("Error closing JMX connection {}\n", swBuffer);
+          logger.fatal(e1.getMessage(), e1);
         }
+        this.conn = null;
       }
 
       return false;

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Repository.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Repository.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Repository.java
index 52e13a7..c3a33fd 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Repository.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/data/Repository.java
@@ -22,13 +22,11 @@ import org.apache.logging.log4j.Logger;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 
-import java.net.ConnectException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Map;
 import java.util.ResourceBundle;
-import java.util.concurrent.TimeUnit;
 
 /**
  * A Singleton instance of the memory cache for clusters.
@@ -41,17 +39,10 @@ public class Repository {
   private static Repository instance = new Repository();
   private HashMap<String, Cluster> clusterMap = new HashMap<String, Cluster>();
   private Boolean jmxUseLocator;
-  private String jmxHost;
-  private String jmxPort;
-  private String jmxUserName;
-  private String jmxUserPassword;
-  private Boolean isEmbeddedMode;
+  private String host;
+  private String port;
   private boolean useSSLLocator = false;
   private boolean useSSLManager = false;
-  private boolean useGemFireCredentials = false;
-
-
-  private String pulseWebAppUrl;
 
   Locale locale =
       new Locale(PulseConstants.APPLICATION_LANGUAGE, PulseConstants.APPLICATION_COUNTRY);
@@ -77,44 +68,20 @@ public class Repository {
     this.jmxUseLocator = jmxUseLocator;
   }
 
-  public String getJmxHost() {
-    return this.jmxHost;
-  }
-
-  public void setJmxHost(String jmxHost) {
-    this.jmxHost = jmxHost;
-  }
-
-  public String getJmxPort() {
-    return this.jmxPort;
-  }
-
-  public void setJmxPort(String jmxPort) {
-    this.jmxPort = jmxPort;
+  public String getHost() {
+    return this.host;
   }
 
-  public String getJmxUserName() {
-    return this.jmxUserName;
+  public void setHost(String jmxHost) {
+    this.host = jmxHost;
   }
 
-  public void setJmxUserName(String jmxUserName) {
-    this.jmxUserName = jmxUserName;
+  public String getPort() {
+    return this.port;
   }
 
-  public String getJmxUserPassword() {
-    return this.jmxUserPassword;
-  }
-
-  public void setJmxUserPassword(String jmxUserPassword) {
-    this.jmxUserPassword = jmxUserPassword;
-  }
-
-  public Boolean getIsEmbeddedMode() {
-    return this.isEmbeddedMode;
-  }
-
-  public void setIsEmbeddedMode(Boolean isEmbeddedMode) {
-    this.isEmbeddedMode = isEmbeddedMode;
+  public void setPort(String jmxPort) {
+    this.port = jmxPort;
   }
 
   public boolean isUseSSLLocator() {
@@ -133,79 +100,42 @@ public class Repository {
     this.useSSLManager = useSSLManager;
   }
 
-  public String getPulseWebAppUrl() {
-    return this.pulseWebAppUrl;
-  }
-
-  public void setPulseWebAppUrl(String pulseWebAppUrl) {
-    this.pulseWebAppUrl = pulseWebAppUrl;
-  }
-
   public PulseConfig getPulseConfig() {
     return this.pulseConfig;
   }
 
-  public void setPulseConfig(PulseConfig pulseConfig) {
-    this.pulseConfig = pulseConfig;
-  }
 
   /**
-   * we're maintaining a 1:1 mapping between webapp and cluster, there is no need for a map of
-   * clusters based on the host and port We are using this clusterMap to maintain cluster for
-   * different users now. For a single-user connection to gemfire JMX, we will use the default
-   * username/password in the pulse.properties (# JMX User Properties ) pulse.jmxUserName=admin
-   * pulse.jmxUserPassword=admin
+   * this will return a cluster already connected to the geode jmx manager for the user in the
+   * request
    *
    * But for multi-user connections to gemfireJMX, i.e pulse that uses gemfire integrated security,
    * we will need to get the username form the context
    */
   public Cluster getCluster() {
-    String username = null;
-    String password = null;
-    if (useGemFireCredentials) {
-      Authentication auth = SecurityContextHolder.getContext().getAuthentication();
-      if (auth != null) {
-        username = auth.getName();
-        password = (String) auth.getCredentials();
-      }
-    } else {
-      username = this.jmxUserName;
-      password = this.jmxUserPassword;
-    }
-    return this.getCluster(username, password);
+    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+    if (auth == null)
+      return null;
+    return getCluster(auth.getName(), null);
   }
 
   public Cluster getCluster(String username, String password) {
     synchronized (this.clusterMap) {
-      String key = username;
-      Cluster data = this.clusterMap.get(key);
-
+      Cluster data = clusterMap.get(username);
       if (data == null) {
-        try {
-          logger.info("{} : {}", resourceBundle.getString("LOG_MSG_CREATE_NEW_THREAD"), key);
-          data = new Cluster(this.jmxHost, this.jmxPort, username, password);
-          // Assign name to thread created
-          data.setName(
-              PulseConstants.APP_NAME + "-" + this.jmxHost + ":" + this.jmxPort + ":" + username);
-          // Start Thread
-          data.start();
-          data.waitForInitialization(15, TimeUnit.SECONDS);
-          this.clusterMap.put(key, data);
-        } catch (ConnectException | InterruptedException e) {
-          data = null;
-          logger.debug(e);
+        logger.info(resourceBundle.getString("LOG_MSG_CREATE_NEW_THREAD") + " : " + username);
+        data = new Cluster(this.host, this.port, username);
+        // Assign name to thread created
+        data.setName(PulseConstants.APP_NAME + "-" + this.host + ":" + this.port + ":" + username);
+        data.connectToGemFire(password);
+        if (data.isConnectedFlag()) {
+          this.clusterMap.put(username, data);
         }
-      } else {
-        data.setJmxUserPassword(password);
-
       }
       return data;
     }
   }
 
-  private String getClusterKey(String host, String port) {
-    return host + ":" + port;
-  }
 
   // This method is used to remove all cluster threads
   public void removeAllClusters() {
@@ -226,14 +156,5 @@ public class Repository {
     return this.resourceBundle;
   }
 
-  public boolean isUseGemFireCredentials() {
-    return useGemFireCredentials;
-  }
-
-  public void setUseGemFireCredentials(boolean useGemFireCredentials) {
-    this.useGemFireCredentials = useGemFireCredentials;
-  }
-
-
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/GemFireAuthenticationProvider.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/GemFireAuthenticationProvider.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/GemFireAuthenticationProvider.java
index 096bf6f..2b110bc 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/GemFireAuthenticationProvider.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/GemFireAuthenticationProvider.java
@@ -14,21 +14,19 @@
  */
 package org.apache.geode.tools.pulse.internal.security;
 
-import java.util.Collection;
-import javax.management.remote.JMXConnector;
-
 import org.apache.geode.tools.pulse.internal.data.Repository;
-
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.springframework.security.authentication.AuthenticationProvider;
-import org.springframework.security.authentication.AuthenticationServiceException;
 import org.springframework.security.authentication.BadCredentialsException;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.AuthenticationException;
 import org.springframework.security.core.GrantedAuthority;
 
+import java.util.Collection;
+import javax.management.remote.JMXConnector;
+
 /**
  * Spring security AuthenticationProvider for GemFire. It connects to gemfire manager using given
  * credentials. Successful connect is treated as successful authentication and web user is
@@ -44,7 +42,6 @@ public class GemFireAuthenticationProvider implements AuthenticationProvider {
 
   @Override
   public Authentication authenticate(Authentication authentication) throws AuthenticationException {
-
     if (authentication instanceof GemFireAuthentication) {
       GemFireAuthentication gemAuth = (GemFireAuthentication) authentication;
       logger.debug("GemAuthentication is connected? = {}", gemAuth.getJmxc());
@@ -55,21 +52,17 @@ public class GemFireAuthenticationProvider implements AuthenticationProvider {
     String name = authentication.getName();
     String password = authentication.getCredentials().toString();
 
-    try {
-      logger.debug("Connecting to GemFire with user={}", name);
-      JMXConnector jmxc = Repository.get().getCluster(name, password).connectToGemFire();
-      if (jmxc != null) {
-        Collection<GrantedAuthority> list = GemFireAuthentication.populateAuthorities(jmxc);
-        GemFireAuthentication auth = new GemFireAuthentication(authentication.getPrincipal(),
-            authentication.getCredentials(), list, jmxc);
-        logger.debug("For user " + name + " authList={}", list);
-        return auth;
-      } else {
-        throw new AuthenticationServiceException("JMX Connection unavailable");
-      }
-    } catch (Exception e) {
-      throw new BadCredentialsException("Error connecting to GemFire JMX Server", e);
+    logger.debug("Connecting to GemFire with user=" + name);
+    JMXConnector jmxc = Repository.get().getCluster(name, password).getJMXConnector();
+    if (jmxc == null) {
+      throw new BadCredentialsException("Error connecting to GemFire JMX Server");
     }
+
+    Collection<GrantedAuthority> list = GemFireAuthentication.populateAuthorities(jmxc);
+    GemFireAuthentication auth = new GemFireAuthentication(authentication.getPrincipal(),
+        authentication.getCredentials(), list, jmxc);
+    logger.debug("For user " + name + " authList=" + list);
+    return auth;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java
index b169d4f..d685964 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java
@@ -14,19 +14,17 @@
  */
 package org.apache.geode.tools.pulse.internal.security;
 
-import java.io.IOException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.geode.tools.pulse.internal.data.Repository;
-
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
 import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;
 
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 /**
  * Handler is used to close jmx connection maintained at user-level
  *
@@ -41,12 +39,10 @@ public class LogoutHandler extends SimpleUrlLogoutSuccessHandler implements Logo
   public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
       Authentication authentication) throws IOException, ServletException {
     logger.debug("Invoked #LogoutHandler ...");
-    if (Repository.get().isUseGemFireCredentials()) {
-      GemFireAuthentication gemauthentication = (GemFireAuthentication) authentication;
-      if (gemauthentication != null) {
-        gemauthentication.getJmxc().close();
-        logger.info("#LogoutHandler : Closing GemFireAuthentication JMX Connection...");
-      }
+    GemFireAuthentication gemauthentication = (GemFireAuthentication) authentication;
+    if (gemauthentication != null) {
+      gemauthentication.getJmxc().close();
+      logger.info("#LogoutHandler : Closing GemFireAuthentication JMX Connection...");
     }
     super.onLogoutSuccess(request, response, authentication);
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMemberService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMemberService.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMemberService.java
index b6a129d..34a7734 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMemberService.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMemberService.java
@@ -20,7 +20,6 @@ package org.apache.geode.tools.pulse.internal.service;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.geode.tools.pulse.internal.controllers.PulseController;
 import org.apache.geode.tools.pulse.internal.data.Cluster;
 import org.apache.geode.tools.pulse.internal.data.PulseConstants;
 import org.apache.geode.tools.pulse.internal.data.Repository;
@@ -32,7 +31,6 @@ import org.springframework.stereotype.Service;
 import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.List;
 

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMembersRGraphService.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMembersRGraphService.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMembersRGraphService.java
index 90d4ecd..7a1013a 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMembersRGraphService.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/service/ClusterMembersRGraphService.java
@@ -17,23 +17,21 @@
 
 package org.apache.geode.tools.pulse.internal.service;
 
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import org.apache.geode.tools.pulse.internal.data.Cluster;
+import org.apache.geode.tools.pulse.internal.data.PulseConstants;
+import org.apache.geode.tools.pulse.internal.data.Repository;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Service;
 
-import org.apache.geode.tools.pulse.internal.data.Cluster;
-import org.apache.geode.tools.pulse.internal.data.PulseConstants;
-import org.apache.geode.tools.pulse.internal.data.Repository;
+import java.text.DecimalFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
 
 /**
  * Class ClusterMembersRGraphService
@@ -95,7 +93,7 @@ public class ClusterMembersRGraphService implements PulseService {
 
     // cluster's Members
     responseJSON.put(this.CLUSTER,
-        getPhysicalServerJson(cluster, repository.getJmxHost(), repository.getJmxPort()));
+        getPhysicalServerJson(cluster, repository.getHost(), repository.getPort()));
     responseJSON.put(this.MEMBER_COUNT, cluster.getMemberCount());
 
     // Send json response

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/resources/log4j2.xml b/geode-pulse/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..536a045
--- /dev/null
+++ b/geode-pulse/src/main/resources/log4j2.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<Configuration status="INFO" name="Pulse" packages="org.apache.geode">
+    <Appenders>
+        <File name="File" fileName="pulse.log">
+            <PatternLayout>
+                <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
+            </PatternLayout>
+        </File>
+    </Appenders>
+    <Loggers>
+        <Root level="INFO">
+            <AppenderRef ref="File"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/main/resources/pulse.properties
----------------------------------------------------------------------
diff --git a/geode-pulse/src/main/resources/pulse.properties b/geode-pulse/src/main/resources/pulse.properties
index d47d469..6eb4730 100644
--- a/geode-pulse/src/main/resources/pulse.properties
+++ b/geode-pulse/src/main/resources/pulse.properties
@@ -21,28 +21,9 @@
 #Tue, 09 Oct 2012 16:39:00
 
 # JMX Locator/Manager Properties
-pulse.useLocator=false
+pulse.useLocator=true
 pulse.host=localhost
-pulse.port=1099
+pulse.port=10334
 
 #pulse.useSSL.locator=true
 #pulse.useSSL.manager=true
-
-# JMX User Properties
-pulse.jmxUserName=admin
-pulse.jmxUserPassword=admin
-
-# Logging Configurations Properties
-pulse.Log-File-Name=PULSELOG
-#pulse.Log-File-Location=F:\\PulseLogs
-pulse.Log-File-Size=1048576
-pulse.Log-File-Count=3
-pulse.Log-Date-Pattern=yyyy/MM/dd HH:mm:ss.SSS z
-pulse.Log-Level=info
-pulse.Log-Append=true
-
-# For supporting gemfire and sqlfire both in pulse
-# valid values are as follows 
-# for GemFire "gemfire" 
-# for GemFireXD "gemfirexd" 
-pulse.product=gemfire

http://git-wip-us.apache.org/repos/asf/geode/blob/0f978a6d/geode-pulse/src/test/java/org/apache/geode/tools/pulse/controllers/PulseControllerJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/controllers/PulseControllerJUnitTest.java b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/controllers/PulseControllerJUnitTest.java
index ddd799f..58bdbcb 100644
--- a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/controllers/PulseControllerJUnitTest.java
+++ b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/controllers/PulseControllerJUnitTest.java
@@ -16,7 +16,6 @@ package org.apache.geode.tools.pulse.controllers;
 
 import static org.hamcrest.Matchers.contains;
 import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
 import static org.mockito.Matchers.anyInt;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
@@ -29,14 +28,9 @@ import java.io.File;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.UUID;
-import javax.servlet.ServletContextListener;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.geode.tools.pulse.internal.PulseAppListener;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.geode.test.junit.categories.UnitTest;
 import org.apache.geode.tools.pulse.internal.controllers.PulseController;
 import org.apache.geode.tools.pulse.internal.data.Cluster;
 import org.apache.geode.tools.pulse.internal.data.PulseConfig;


Mime
View raw message