You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by lg...@apache.org on 2018/11/18 04:55:04 UTC

[09/12] mina-sshd git commit: [SSHD-859] Moved 'resolveAttribute' method to AttributeRepository

[SSHD-859] Moved 'resolveAttribute' method to AttributeRepository


Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/8be6ef9d
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/8be6ef9d
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/8be6ef9d

Branch: refs/heads/master
Commit: 8be6ef9dfd63d7558b2c89550143eb52c10cc39f
Parents: 71516eb
Author: Lyor Goldstein <lg...@apache.org>
Authored: Tue Nov 13 08:21:30 2018 +0200
Committer: Lyor Goldstein <lg...@apache.org>
Committed: Sun Nov 18 06:54:47 2018 +0200

----------------------------------------------------------------------
 CHANGES.md                                             |  9 ++++++---
 .../org/apache/sshd/common/AttributeRepository.java    | 13 +++++++++++++
 .../java/org/apache/sshd/common/AttributeStore.java    | 10 ----------
 3 files changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/8be6ef9d/CHANGES.md
----------------------------------------------------------------------
diff --git a/CHANGES.md b/CHANGES.md
index 7ed1296..95c17cf 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -2,10 +2,13 @@
 
 ## Major code re-factoring
 
-* `AttributeKey` moved from `AttributeStore` to `AttributeRepository`
+* `AttributeStore` "read" methods moved to (new class) `AttributeRepository`
 
-* `getAttribute` moved from `AttributeStore` to `AttributeRepository` + added
-`attributeKeys` method.
+    * `AttributeKey` moved to `AttributeRepository`
+
+    * `getAttribute` and `resolveAttribute` moved to `AttributeRepository`
+
+    * Added `attributeKeys` enumeration method to `AttributeRepository`.
 
 * `DEFAULT_PORT` moved from `SshConfigFileReader` to `SshConstants`
 

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/8be6ef9d/sshd-common/src/main/java/org/apache/sshd/common/AttributeRepository.java
----------------------------------------------------------------------
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/AttributeRepository.java b/sshd-common/src/main/java/org/apache/sshd/common/AttributeRepository.java
index f754e87..c197100 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/AttributeRepository.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/AttributeRepository.java
@@ -72,6 +72,19 @@ public interface AttributeRepository {
     <T> T getAttribute(AttributeKey<T> key);
 
     /**
+     * Attempts to resolve the associated value by going up the store's
+     * hierarchy (if any)
+     *
+     * @param <T> The generic attribute type
+     * @param key The key of the attribute; must not be {@code null}.
+     * @return {@code null} if there is no value associated with the specified key
+     * either in this repository or any of its ancestors (if any available)
+     */
+    default <T> T resolveAttribute(AttributeKey<T> key) {
+        return getAttribute(key);
+    }
+
+    /**
      * @return A {@link Collection} <u>snapshot</u> of all the currently registered
      * attributes in the repository
      */

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/8be6ef9d/sshd-common/src/main/java/org/apache/sshd/common/AttributeStore.java
----------------------------------------------------------------------
diff --git a/sshd-common/src/main/java/org/apache/sshd/common/AttributeStore.java b/sshd-common/src/main/java/org/apache/sshd/common/AttributeStore.java
index cc5665a..466cafe 100644
--- a/sshd-common/src/main/java/org/apache/sshd/common/AttributeStore.java
+++ b/sshd-common/src/main/java/org/apache/sshd/common/AttributeStore.java
@@ -77,15 +77,5 @@ public interface AttributeStore extends AttributeRepository {
      * @return The removed value; {@code null} if no previous value
      */
     <T> T removeAttribute(AttributeKey<T> key);
-
-    /**
-     * Attempts to resolve the associated value by going up the store's
-     * hierarchy (if any)
-     *
-     * @param <T> The generic attribute type
-     * @param key The key of the attribute; must not be {@code null}.
-     * @return {@code null} if there is no value associated with the specified key
-     */
-    <T> T resolveAttribute(AttributeKey<T> key);
 }