ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [21/50] [abbrv] ignite git commit: ignite-1.5 Added node attributes in AuthenticationContext.
Date Sun, 03 Jan 2016 15:34:06 GMT
ignite-1.5 Added node attributes in AuthenticationContext.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/939a170d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/939a170d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/939a170d

Branch: refs/heads/ignite-2264
Commit: 939a170d9d27822b0ed19b019ecf8c76142c544d
Parents: 18c413c
Author: sboikov <sboikov@gridgain.com>
Authored: Mon Dec 28 12:10:53 2015 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Mon Dec 28 12:10:53 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/internal/IgniteKernal.java    |  7 +++--
 .../ignite/internal/IgniteNodeAttributes.java   |  3 ++
 .../processors/rest/GridRestProcessor.java      |  4 +++
 .../rest/client/message/GridClientNodeBean.java |  4 +--
 .../plugin/security/AuthenticationContext.java  | 33 +++++++++++++++++---
 5 files changed, 42 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/939a170d/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 6e0be10..14b5816 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -788,7 +788,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
 
             startProcessor(new ClusterProcessor(ctx));
 
-            fillNodeAttributes();
+            fillNodeAttributes(notifyEnabled);
 
             U.onGridStart();
 
@@ -1201,10 +1201,11 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
     /**
      * Creates attributes map and fills it in.
      *
+     * @param notifyEnabled Update notifier flag.
      * @throws IgniteCheckedException thrown if was unable to set up attribute.
      */
     @SuppressWarnings({"SuspiciousMethodCalls", "unchecked", "TypeMayBeWeakened"})
-    private void fillNodeAttributes() throws IgniteCheckedException {
+    private void fillNodeAttributes(boolean notifyEnabled) throws IgniteCheckedException
{
         final String[] incProps = cfg.getIncludeProperties();
 
         try {
@@ -1242,6 +1243,8 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable
{
                 }
             }
 
+            ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_UPDATE_NOTIFIER_ENABLED, notifyEnabled);
+
             if (log.isDebugEnabled())
                 log.debug("Added system properties to node attributes.");
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/939a170d/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
index ba04403..3c5f960 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteNodeAttributes.java
@@ -144,6 +144,9 @@ public final class IgniteNodeAttributes {
     /** Binary protocol version. */
     public static final String ATTR_BINARY_PROTO_VER = ATTR_PREFIX + ".binary.proto.ver";
 
+    /** Update notifier enabled. */
+    public static final String ATTR_UPDATE_NOTIFIER_ENABLED = ATTR_PREFIX + ".update.notifier.enabled";
+
     /**
      * Enforces singleton.
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/939a170d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
index 4bb02c4..e839443 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/GridRestProcessor.java
@@ -22,6 +22,7 @@ import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.List;
@@ -656,6 +657,7 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
         authCtx.subjectType(REMOTE_CLIENT);
         authCtx.subjectId(req.clientId());
+        authCtx.nodeAttributes(Collections.<String, Object>emptyMap());
 
         SecurityCredentials cred;
 
@@ -884,11 +886,13 @@ public class GridRestProcessor extends GridProcessorAdapter {
 
         /** Session token id. */
         private final UUID sesId;
+
         /**
          * Time when session is used last time.
          * If this time was set at TIMEDOUT_FLAG, then it should never be changed.
          */
         private final AtomicLong lastTouchTime = new AtomicLong(U.currentTimeMillis());
+
         /** Security context. */
         private volatile SecurityContext secCtx;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/939a170d/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
index 8ba6eb5..ca82608 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientNodeBean.java
@@ -233,8 +233,8 @@ public class GridClientNodeBean implements Externalizable {
             for (GridClientCacheBean cacheBean : caches) {
                 if (cacheBean.getName() == null)
                     dfltCacheMode = cacheBean.getMode().toString();
-                else
-                    cacheMap.put(cacheBean.getName(), cacheBean.getMode().toString());
+
+                cacheMap.put(cacheBean.getName(), cacheBean.getMode().toString());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/939a170d/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
b/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
index 16e282d..91f3379 100644
--- a/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/plugin/security/AuthenticationContext.java
@@ -18,6 +18,8 @@
 package org.apache.ignite.plugin.security;
 
 import java.net.InetSocketAddress;
+import java.util.Collections;
+import java.util.Map;
 import java.util.UUID;
 
 /**
@@ -31,11 +33,14 @@ public class AuthenticationContext {
     private UUID subjId;
 
     /** Credentials. */
-    private SecurityCredentials credentials;
+    private SecurityCredentials creds;
 
     /** Subject address. */
     private InetSocketAddress addr;
 
+    /** */
+    private Map<String, Object> nodeAttrs;
+
     /**
      * Gets subject type.
      *
@@ -78,16 +83,16 @@ public class AuthenticationContext {
      * @return Security credentials.
      */
     public SecurityCredentials credentials() {
-        return credentials;
+        return creds;
     }
 
     /**
      * Sets security credentials.
      *
-     * @param credentials Security credentials.
+     * @param creds Security credentials.
      */
-    public void credentials(SecurityCredentials credentials) {
-        this.credentials = credentials;
+    public void credentials(SecurityCredentials creds) {
+        this.creds = creds;
     }
 
     /**
@@ -107,4 +112,22 @@ public class AuthenticationContext {
     public void address(InetSocketAddress addr) {
         this.addr = addr;
     }
+
+    /**
+     * Gets node attributes.
+     *
+     * @return Node attributes or empty map for {@link SecuritySubjectType#REMOTE_CLIENT}.
+     */
+    public Map<String, Object> nodeAttributes() {
+        return nodeAttrs != null ? nodeAttrs : Collections.<String, Object>emptyMap();
+    }
+
+    /**
+     * Sets node attributes.
+     *
+     * @param nodeAttrs Node attributes.
+     */
+    public void nodeAttributes(Map<String, Object> nodeAttrs) {
+        this.nodeAttrs = nodeAttrs;
+    }
 }
\ No newline at end of file


Mime
View raw message