[java-identity-provider] branch master updated: Fix warnings and missing javadocs.

Scott Cantor cantor.2 at osu.edu
Tue Jun 6 21:54:18 EDT 2017


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=0e35432df130deca9af08e639d2b0ecd4932c96e

The following commit(s) were added to refs/heads/master by this push:
       new  0e35432   Fix warnings and missing javadocs.
0e35432 is described below

commit 0e35432df130deca9af08e639d2b0ecd4932c96e
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Jun 6 21:54:15 2017 -0400

    Fix warnings and missing javadocs.
---
 .../resolver/PluginDependencySupport.java          | 24 ++++++++----
 .../ResolverAttributeDefinitionDependency.java     |  3 +-
 .../resolver/ResolverDataConnectorDependency.java  | 43 +++++++++++++++-------
 .../resolver/ResolverPluginDependency.java         |  6 +--
 4 files changed, 50 insertions(+), 26 deletions(-)

diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/PluginDependencySupport.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/PluginDependencySupport.java
index f0bd177..4a2dab1 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/PluginDependencySupport.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/PluginDependencySupport.java
@@ -74,6 +74,7 @@ public final class PluginDependencySupport {
         return getMergedAttributeValues(workContext, dependencies, "<unknown>");
     }
 
+// Checkstyle: MethodLength|CyclomaticComplexity OFF
     /**
      * Gets the values, as a single list, from all dependencies. This method only supports dependencies which contain an
      * attribute specifier (i.e. {@link ResolverPluginDependency#getDependencyAttributeId()} does not equal null). It is
@@ -111,14 +112,16 @@ public final class PluginDependencySupport {
                 mergeAttributeValues(resolvedAttribute, values);
             } else if (dependency instanceof ResolverDataConnectorDependency) {
                 // Merge all specified attribute values.
-                final ResolverDataConnectorDependency dataConnectorDependency = (ResolverDataConnectorDependency) dependency;
+                final ResolverDataConnectorDependency dataConnectorDependency =
+                        (ResolverDataConnectorDependency) dependency;
                 final ResolvedDataConnector dataConnector =
                         workContext.getResolvedDataConnectors().get(dependency.getDependencyPluginId());
                 if (dataConnector != null) { 
                     final Map<String, IdPAttribute> resolvedAttrs = dataConnector.getResolvedAttributes();
                     if (null != resolvedAttrs) {
                         for (final Entry<String, IdPAttribute> entry : resolvedAttrs.entrySet()) {
-                            if (dataConnectorDependency.isAllAttributes() || dataConnectorDependency.getAttributeNames().contains(entry.getKey())) {
+                            if (dataConnectorDependency.isAllAttributes()
+                                    || dataConnectorDependency.getAttributeNames().contains(entry.getKey())) {
                                 mergeAttributeValues(entry.getValue(), values);
                             }
                         }
@@ -130,11 +133,11 @@ public final class PluginDependencySupport {
                 final String dependencyAttributeId = dependency.getDependencyAttributeId();
                 if (attributeDefinition != null) {
                     if (null == dependencyAttributeId) {
-                        LOG.warn("Plugin '{}' was defined without a sourceAttributeID,  but attribute '{}', specified "
-                                + "" + "as a <Dependency> will be used.", attributeDefinitionId, pluginId);
+                        LOG.warn("Plugin '{}' was defined without a sourceAttributeID,  but attribute '{}', specified" +
+                                " as a <Dependency> will be used.", attributeDefinitionId, pluginId);
                     } else if (!dependencyAttributeId.equals(pluginId)) {
-                        LOG.warn("Plugin '{}' was defined with a sourceAttributeID '{}',"
-                                + " but the attribute definition '{}', specified as a <Dependency> will be used as well.",
+                        LOG.warn("Plugin '{}' was defined with a sourceAttributeID '{}', " +
+                                "but the attribute definition '{}', specified as a <Dependency> will be used as well.",
                                 attributeDefinitionId, dependencyAttributeId, pluginId);
                     }
     
@@ -165,7 +168,9 @@ public final class PluginDependencySupport {
 
         return values;
     }
+// Checkstyle: MethodLength|CyclomaticComplexity ON
 
+// Checkstyle: MethodLength|CyclomaticComplexity OFF
     /**
      * Gets the values from all dependencies. Attributes, with the same identifier but from different resolver plugins,
      * will have their values merged into a single list within this method's returned map. This method is the equivalent
@@ -200,14 +205,16 @@ public final class PluginDependencySupport {
                 }
             } else if (dependency instanceof ResolverDataConnectorDependency) {
                 // Just add those attributes specified
-                final ResolverDataConnectorDependency dataConnectorDependency = (ResolverDataConnectorDependency) dependency;
+                final ResolverDataConnectorDependency dataConnectorDependency =
+                        (ResolverDataConnectorDependency) dependency;
                 final ResolvedDataConnector dataConnector =
                         workContext.getResolvedDataConnectors().get(dependency.getDependencyPluginId());
                 if (dataConnector != null) { 
                     final Map<String, IdPAttribute> resolvedAttrs = dataConnector.getResolvedAttributes();
                     if (null != resolvedAttrs) {
                         for (final Entry<String, IdPAttribute> entry : resolvedAttrs.entrySet()) {
-                            if (dataConnectorDependency.isAllAttributes() || dataConnectorDependency.getAttributeNames().contains(entry.getKey())) {
+                            if (dataConnectorDependency.isAllAttributes()
+                                    || dataConnectorDependency.getAttributeNames().contains(entry.getKey())) {
                                 addAttribute(entry.getValue(), result);
                             }
                         }
@@ -234,6 +241,7 @@ public final class PluginDependencySupport {
 
         return result;
     }
+// Checkstyle: MethodLength|CyclomaticComplexity ON
 
     /**
      * Adds the values of the attributes to the target collection of attribute values indexes by attribute ID.
diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java
index a875b41..50e5ec3 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverAttributeDefinitionDependency.java
@@ -25,11 +25,10 @@ public final class ResolverAttributeDefinitionDependency extends ResolverPluginD
     /**
      * Constructor.
      *
-     * @param pluginId
+     * @param pluginId ID of dependency
      */
     public ResolverAttributeDefinitionDependency(final String pluginId) {
         super(pluginId);
-        // TODO Auto-generated constructor stub
     }
 
 }
diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverDataConnectorDependency.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverDataConnectorDependency.java
index c24253f..235f91d 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverDataConnectorDependency.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverDataConnectorDependency.java
@@ -22,52 +22,70 @@ import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
+import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.primitive.StringSupport;
+
 /**
- *
+ * A Dependency that references to an Data Connector.
  */
 public final class ResolverDataConnectorDependency extends ResolverPluginDependency {
 
-    private boolean allAttributes = false;
+    /** Whether to depend on all the connector's attributes. */
+    private boolean allAttributes;
     
-    private Set<String> attributeNames = Collections.EMPTY_SET;
+    /** Names of attributes to import via dependency. */
+    @Nonnull @NotEmpty private Set<String> attributeNames;
     
     /**
      * Constructor.
      *
-     * @param pluginId
+     * @param pluginId ID of dependency
      */
     public ResolverDataConnectorDependency(final String pluginId) {
         super(pluginId);
+        
+        allAttributes = false;
+        attributeNames = Collections.emptySet();
     }
 
     /**
-     * @return Returns the allAttributes.
+     * Get whether all the connector's attributes are part of the dependency.
+     * 
+     * @return whether all the connector's attributes are part of the dependency
      */
     public boolean isAllAttributes() {
         return allAttributes;
     }
 
     /**
-     * @param all The allAttributes to set.
+     * Set whether all the connector's attributes are part of the dependency.
+     * 
+     * @param all flag to set
      */
     public void setAllAttributes(final boolean all) {
         allAttributes = all;
     }
 
     /**
-     * @return Returns the attributeNames.
+     * Get the names of the connector's attributes that make up the dependency.
+     * 
+     * @return attribute names
      */
-    public Collection<String> getAttributeNames() {
+    @Nonnull @NonnullElements public Collection<String> getAttributeNames() {
         return attributeNames;
     }
 
     /**
-     * @param names The attributeNames to set.
+     * Set the names of the connector's attributes that make up the dependency.
+     * 
+     * @param names attribute names
      */
-    public void setAttributeNames(final Collection<String> names) {
-        attributeNames = new HashSet(names);
+    public void setAttributeNames(@Nonnull @NotEmpty final Collection<String> names) {
+        attributeNames = new HashSet<>(StringSupport.normalizeStringCollection(names));
     }
    
     /**
@@ -78,5 +96,4 @@ public final class ResolverDataConnectorDependency extends ResolverPluginDepende
         super.setDependencyAttributeId(attributeId);
     }
 
-
-}
+}
\ No newline at end of file
diff --git a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverPluginDependency.java b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverPluginDependency.java
index a393e0f..eca5ba3 100644
--- a/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverPluginDependency.java
+++ b/idp-attribute-resolver-api/src/main/java/net/shibboleth/idp/attribute/resolver/ResolverPluginDependency.java
@@ -32,16 +32,16 @@ import com.google.common.base.Objects;
 /**
  * Represents the dependency of one {@link ResolverPlugin} upon another plugin. Note that this serves for
  * dependencies both on data connectors (in which case the {@link #dependencyAttributeId} member will be null) or
- * attributes. The dependency analysis stages is aware of this difference and relies on it.
+ * attributes. The dependency analysis stage is aware of this difference and relies on it.
  */
 @ThreadSafe
 public class ResolverPluginDependency {
 
     /** ID of the plugin that will produce the attribute. */
-    private final String dependencyPluginId;
+    @Nonnull @NotEmpty private final String dependencyPluginId;
 
     /** ID of the attribute, produced by the identified plugin, whose values will be used by the dependent plugin. */
-    private String dependencyAttributeId;
+    @Nullable private String dependencyAttributeId;
 
     /**
      * Constructor.

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list