geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [3/3] incubator-geode git commit: GEODE-17: Why do we need a Logger passed in to ManagementInterceptor constructor
Date Wed, 16 Mar 2016 21:16:41 GMT
GEODE-17: Why do we need a Logger passed in to ManagementInterceptor constructor


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

Branch: refs/heads/feature/GEODE-17-2
Commit: d4ef0a24788e78d74899086954dd448223a8b656
Parents: 1ffacdc
Author: Jens Deppe <jdeppe@pivotal.io>
Authored: Wed Mar 16 14:12:46 2016 -0700
Committer: Jens Deppe <jdeppe@pivotal.io>
Committed: Wed Mar 16 14:16:25 2016 -0700

----------------------------------------------------------------------
 .../management/internal/ManagementAgent.java    |  4 ++--
 .../security/ManagementInterceptor.java         | 21 ++++++++++----------
 ...eateAlterDestroyRegionCommandsDUnitTest.java | 10 +++++-----
 .../security/MBeanServerConnectionRule.java     |  1 -
 4 files changed, 17 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d4ef0a24/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
index b1c9b46..8075938 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/ManagementAgent.java
@@ -386,7 +386,7 @@ public class ManagementAgent {
 
     ManagementInterceptor securityInterceptor = null;
     if (isCustomAuthenticator()) {
-      securityInterceptor = new ManagementInterceptor((GemFireCacheImpl)CacheFactory.getAnyInstance(),
logger);
+      securityInterceptor = new ManagementInterceptor((GemFireCacheImpl)CacheFactory.getAnyInstance());
       env.put(JMXConnectorServer.AUTHENTICATOR, securityInterceptor);
     }
     else {
@@ -462,7 +462,7 @@ public class ManagementAgent {
 
     if (isCustomAuthorizer()) {
       if(securityInterceptor==null){
-        securityInterceptor = new ManagementInterceptor((GemFireCacheImpl)CacheFactory.getAnyInstance(),
logger);
+        securityInterceptor = new ManagementInterceptor((GemFireCacheImpl)CacheFactory.getAnyInstance());
       }
       MBeanServerWrapper mBeanServerWrapper = new MBeanServerWrapper(securityInterceptor);
       cs.setMBeanServerForwarder(mBeanServerWrapper);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d4ef0a24/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ManagementInterceptor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ManagementInterceptor.java
b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ManagementInterceptor.java
index 7e6befb..0a736a9 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ManagementInterceptor.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/security/ManagementInterceptor.java
@@ -23,10 +23,10 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.ClassLoadUtil;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.lang.StringUtils;
-import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.security.AccessControl;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
+import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 
 import javax.management.InstanceAlreadyExistsException;
@@ -66,7 +66,7 @@ public class ManagementInterceptor implements JMXAuthenticator{
 	public static final String PASSWORD = "security-password";
 	public static final String OBJECT_NAME_ACCESSCONTROL = "GemFire:service=AccessControl,type=Distributed";
 
-	private Logger logger;
+	private static final Logger logger = LogManager.getLogger(ManagementInterceptor.class);
   private Cache cache;
   private String authzFactoryName;
   private String postAuthzFactoryName;
@@ -74,17 +74,16 @@ public class ManagementInterceptor implements JMXAuthenticator{
   private ConcurrentMap<Principal, AccessControl> cachedAuthZCallback;
   private ConcurrentMap<Principal, AccessControl> cachedPostAuthZCallback;
 
-  public ManagementInterceptor(Cache gemFireCacheImpl, Logger logger) {
+  public ManagementInterceptor(Cache gemFireCacheImpl) {
     this.cache = gemFireCacheImpl;
-		this.logger = logger;
     DistributedSystem system = cache.getDistributedSystem();
     Properties sysProps = system.getProperties();
     this.authzFactoryName = sysProps.getProperty(DistributionConfig.SECURITY_CLIENT_ACCESSOR_NAME);
     this.postAuthzFactoryName = sysProps.getProperty(DistributionConfig.SECURITY_CLIENT_ACCESSOR_PP_NAME);
     this.authenticatorFactoryName = sysProps.getProperty(DistributionConfig.SECURITY_CLIENT_AUTHENTICATOR_NAME);
-    this.cachedAuthZCallback = new ConcurrentHashMap<Principal, AccessControl>();
-    this.cachedPostAuthZCallback = new ConcurrentHashMap<Principal, AccessControl>();
-		registerAccessContorlMbean();
+    this.cachedAuthZCallback = new ConcurrentHashMap<>();
+    this.cachedPostAuthZCallback = new ConcurrentHashMap<>();
+		registerAccessControlMBean();
     logger.info("Started Management interceptor on JMX connector");
 	}
 
@@ -92,7 +91,7 @@ public class ManagementInterceptor implements JMXAuthenticator{
    * This method registers an AccessControlMBean which allows any remote JMX Client (for
example Pulse) to check for
    * access allowed for given Operation Code.
    */
-	private void registerAccessContorlMbean() {
+	private void registerAccessControlMBean() {
     try {
       AccessControlMBean acc = new AccessControlMBean(this);
       ObjectName accessControlMBeanON = new ObjectName(ResourceConstants.OBJECT_NAME_ACCESSCONTROL);
@@ -128,8 +127,8 @@ public class ManagementInterceptor implements JMXAuthenticator{
     Properties pr = new Properties();
     if (credentials instanceof String[]) {
 			final String[] aCredentials = (String[]) credentials;
-			username = (String) aCredentials[0];
-			password = (String) aCredentials[1];
+			username = aCredentials[0];
+			password = aCredentials[1];
 		  pr.put(USER_NAME, username);
 		  pr.put(PASSWORD, password);
     } else if (credentials instanceof Properties) {
@@ -228,7 +227,7 @@ public class ManagementInterceptor implements JMXAuthenticator{
       throw new AuthenticationFailedException(
           LocalizedStrings.HandShake_AUTHENTICATOR_INSTANCE_COULD_NOT_BE_OBTAINED.toLocalizedString());
 		}
-    auth.init(gfSecurityProperties,(InternalLogWriter) this.cache.getLogger(), (InternalLogWriter)
this.cache.getSecurityLogger());
+    auth.init(gfSecurityProperties, this.cache.getLogger(), this.cache.getSecurityLogger());
     return auth;
 	}
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d4ef0a24/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
index 9f6b141..62b038e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/CreateAlterDestroyRegionCommandsDUnitTest.java
@@ -240,11 +240,11 @@ public class CreateAlterDestroyRegionCommandsDUnitTest extends CliCommandTestBas
             }
           }
 
-          @Override
-          public String description() {
-            return "Waiting for the region to be registed with the MXBean";
-          }
-        };
+        @Override
+        public String description() {
+          return "Waiting for the region to be registered with the MXBean";
+        }
+      };
 
         Wait.waitForCriterion(wc, 5000, 500, true);
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/d4ef0a24/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
index 2f8342e..78b3283 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/security/MBeanServerConnectionRule.java
@@ -47,7 +47,6 @@ public class MBeanServerConnectionRule extends DescribedExternalResource
{
   private JMXConnector jmxConnector;
   private MBeanServerConnection con;
 
-
   /**
    * Rule constructor
    *


Mime
View raw message