Code cleanups in preparation for 2.0 work.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 28 Apr 2006 20:28:57 +0000 (20:28 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Fri, 28 Apr 2006 20:28:57 +0000 (20:28 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@1931 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/AAAttributeSet.java [deleted file]
src/edu/internet2/middleware/shibboleth/aa/arp/ArpAttributeSet.java [deleted file]
src/edu/internet2/middleware/shibboleth/aa/arp/ArpEngine.java
src/edu/internet2/middleware/shibboleth/aa/attrresolv/AttributeResolver.java
src/edu/internet2/middleware/shibboleth/aa/attrresolv/ResolverAttributeSet.java [deleted file]
tests/edu/internet2/middleware/shibboleth/aa/attrresolv/AttributesFile.java

diff --git a/src/edu/internet2/middleware/shibboleth/aa/AAAttributeSet.java b/src/edu/internet2/middleware/shibboleth/aa/AAAttributeSet.java
deleted file mode 100644 (file)
index 1c52895..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.aa;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.opensaml.SAMLAttribute;
-
-import edu.internet2.middleware.shibboleth.aa.arp.ArpAttribute;
-import edu.internet2.middleware.shibboleth.aa.arp.ArpAttributeSet;
-import edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverAttribute;
-import edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverAttributeSet;
-
-/**
- * A set of attributes for which the Shibboleth Attribute Authority has been asked to provide assertions.
- * 
- * @author Walter Hoehn (wassa@columbia.edu)
- */
-public class AAAttributeSet implements ResolverAttributeSet, ArpAttributeSet {
-
-       private HashMap attributes = new HashMap();
-
-       public AAAttributeSet() {
-
-       }
-
-       public AAAttributeSet(AAAttribute attribute) {
-
-               attributes.put(attribute.getName(), attribute);
-       }
-
-       public AAAttributeSet(AAAttribute[] attributes) {
-
-               for (int i = 0; i < attributes.length; i++) {
-                       this.attributes.put(attributes[i].getName(), attributes[i]);
-               }
-       }
-
-       public void add(AAAttribute attribute) {
-
-               attributes.put(attribute.getName(), attribute);
-       }
-
-       public ResolverAttribute getByName(String name) {
-
-               return (ResolverAttribute) attributes.get(name);
-       }
-
-       public ShibAttributeIterator shibAttributeIterator() {
-
-               return new ShibAttributeIterator(attributes.values().iterator());
-       }
-
-       public ResolverAttributeIterator resolverAttributeIterator() {
-
-               return shibAttributeIterator();
-       }
-
-       public ArpAttributeIterator arpAttributeIterator() {
-
-               return shibAttributeIterator();
-       }
-
-       public int size() {
-
-               return attributes.size();
-       }
-
-       public SAMLAttribute[] getAttributes() {
-
-               return (SAMLAttribute[]) attributes.values().toArray(new SAMLAttribute[0]);
-       }
-
-       public class ShibAttributeIterator implements ResolverAttributeIterator, ArpAttributeIterator {
-
-               private Iterator genericIterator;
-
-               private ShibAttributeIterator(Iterator iterator) {
-
-                       genericIterator = iterator;
-               }
-
-               public boolean hasNext() {
-
-                       return genericIterator.hasNext();
-               }
-
-               public ResolverAttribute nextResolverAttribute() {
-
-                       return nextShibAttribute();
-               }
-
-               public AAAttribute nextShibAttribute() {
-
-                       return (AAAttribute) genericIterator.next();
-               }
-
-               public void remove() {
-
-                       genericIterator.remove();
-               }
-
-               public ArpAttribute nextArpAttribute() {
-
-                       return (ArpAttribute) genericIterator.next();
-               }
-
-       }
-
-       /**
-        * @see java.lang.Object#equals(java.lang.Object)
-        */
-       public boolean equals(Object object) {
-
-               if (!(object instanceof AAAttributeSet)) { return false; }
-               return attributes.equals(((AAAttributeSet) object).attributes);
-       }
-
-       /**
-        * @see java.lang.Object#toString()
-        */
-       public String toString() {
-
-               StringBuffer buffer = new StringBuffer();
-               buffer.append(attributes.size());
-               for (Iterator iterator = attributes.values().iterator(); iterator.hasNext();) {
-                       AAAttribute attribute = (AAAttribute) iterator.next();
-                       buffer.append("(" + attribute.getName() + "):");
-                       for (Iterator valuesIterator = attribute.getValues(); valuesIterator.hasNext();) {
-                               buffer.append(" \"" + valuesIterator.next().toString() + "\"");
-                       }
-                       buffer.append(System.getProperty("line.separator"));
-               }
-               return buffer.toString();
-       }
-
-}
diff --git a/src/edu/internet2/middleware/shibboleth/aa/arp/ArpAttributeSet.java b/src/edu/internet2/middleware/shibboleth/aa/arp/ArpAttributeSet.java
deleted file mode 100644 (file)
index 968721b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.aa.arp;
-/**
- * Defines a set of attributes whose values can be filtered by the <code>ArpEngine</code>.
- * 
- * @author Walter Hoehn (wassa@columbia.edu)
- */
-public interface ArpAttributeSet {
-
-       public ArpAttributeIterator arpAttributeIterator();
-       
-       public interface ArpAttributeIterator {
-               public boolean hasNext();
-               public ArpAttribute nextArpAttribute();
-               public void remove();
-       }
-}
index 337f94f..0cffac7 100755 (executable)
@@ -21,6 +21,7 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.Principal;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -37,7 +38,6 @@ import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 import org.w3c.dom.Text;
 
-import edu.internet2.middleware.shibboleth.aa.arp.ArpAttributeSet.ArpAttributeIterator;
 import edu.internet2.middleware.shibboleth.idp.IdPConfig;
 import edu.internet2.middleware.shibboleth.xml.Parser;
 
@@ -51,7 +51,7 @@ public class ArpEngine {
 
        private static Logger log = Logger.getLogger(ArpEngine.class.getName());
        private ArpRepository repository;
-       private static Map matchFunctions = Collections.synchronizedMap(new HashMap());
+       private static Map<URI, String> matchFunctions = Collections.synchronizedMap(new HashMap<URI, String>());
        static {
                // Initialize built-in match functions
                try {
@@ -217,11 +217,11 @@ public class ArpEngine {
         * 
         * @return an array of <code>URI</code> objects that name the possible attributes
         */
-       public URI[] listPossibleReleaseAttributes(Principal principal, String requester, URL resource)
+       public Set<URI> listPossibleReleaseAttributes(Principal principal, String requester, URL resource)
                        throws ArpProcessingException {
 
-               Set possibleReleaseSet = new HashSet();
-               Set anyValueDenies = new HashSet();
+               Set<URI> possibleReleaseSet = new HashSet<URI>();
+               Set<URI> anyValueDenies = new HashSet<URI>();
                Rule[] rules = createEffectiveArp(principal, requester, resource).getAllRules();
                for (int i = 0; rules.length > i; i++) {
                        Rule.Attribute[] attributes = rules[i].getAttributes();
@@ -249,7 +249,7 @@ public class ArpEngine {
                                log.debug("Possible attribute: " + iterator.next().toString());
                        }
                }
-               return (URI[]) possibleReleaseSet.toArray(new URI[0]);
+               return possibleReleaseSet;
        }
 
        /**
@@ -257,11 +257,10 @@ public class ArpEngine {
         * 
         * @return the attributes to be released
         */
-       public void filterAttributes(ArpAttributeSet attributes, Principal principal, String requester, URL resource)
-                       throws ArpProcessingException {
+       public void filterAttributes(Collection<ArpAttribute> attributes, Principal principal, String requester,
+                       URL resource) throws ArpProcessingException {
 
-               ArpAttributeIterator iterator = attributes.arpAttributeIterator();
-               if (!iterator.hasNext()) {
+               if (attributes.isEmpty()) {
                        log.debug("ARP Engine was asked to apply filter to empty attribute set.");
                        return;
                }
@@ -269,18 +268,18 @@ public class ArpEngine {
                log.info("Applying Attribute Release Policies.");
                if (log.isDebugEnabled()) {
                        log.debug("Processing the following attributes:");
-                       for (ArpAttributeIterator attrIterator = attributes.arpAttributeIterator(); attrIterator.hasNext();) {
-                               log.debug("Attribute: (" + attrIterator.nextArpAttribute().getName() + ")");
+                       for (Iterator<ArpAttribute> attrIterator = attributes.iterator(); attrIterator.hasNext();) {
+                               log.debug("Attribute: (" + attrIterator.next().getName() + ")");
                        }
                }
 
                // Gather all applicable ARP attribute specifiers
-               Set attributeNames = new HashSet();
-               for (ArpAttributeIterator nameIterator = attributes.arpAttributeIterator(); nameIterator.hasNext();) {
-                       attributeNames.add(nameIterator.nextArpAttribute().getName());
+               Set<String> attributeNames = new HashSet<String>();
+               for (Iterator<ArpAttribute> nameIterator = attributes.iterator(); nameIterator.hasNext();) {
+                       attributeNames.add(nameIterator.next().getName());
                }
                Rule[] rules = createEffectiveArp(principal, requester, resource).getAllRules();
-               Set applicableRuleAttributes = new HashSet();
+               Set<Rule.Attribute> applicableRuleAttributes = new HashSet<Rule.Attribute>();
                for (int i = 0; rules.length > i; i++) {
                        Rule.Attribute[] ruleAttributes = rules[i].getAttributes();
                        for (int j = 0; ruleAttributes.length > j; j++) {
@@ -295,9 +294,9 @@ public class ArpEngine {
                                .toArray(new Rule.Attribute[0]));
 
                // Filter
-               for (ArpAttributeIterator returnIterator = attributes.arpAttributeIterator(); returnIterator.hasNext();) {
+               for (Iterator<ArpAttribute> returnIterator = attributes.iterator(); returnIterator.hasNext();) {
 
-                       ArpAttribute arpAttribute = returnIterator.nextArpAttribute();
+                       ArpAttribute arpAttribute = returnIterator.next();
                        Rule.Attribute attribute = (Rule.Attribute) arpAttributeSpecs.get(arpAttribute.getName());
 
                        // Handle no specifier
@@ -335,9 +334,9 @@ public class ArpEngine {
                }
        }
 
-       private Map createCanonicalAttributeSpec(Rule.Attribute[] attributes) {
+       private Map<String, Rule.Attribute> createCanonicalAttributeSpec(Rule.Attribute[] attributes) {
 
-               Map canonicalSpec = new HashMap();
+               Map<String, Rule.Attribute> canonicalSpec = new HashMap<String, Rule.Attribute>();
                for (int i = 0; attributes.length > i; i++) {
                        if (!canonicalSpec.containsKey(attributes[i].getName().toString())) {
                                canonicalSpec.put(attributes[i].getName().toString(), attributes[i]);
index b6c67f7..733363e 100644 (file)
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -39,7 +40,6 @@ import org.w3c.dom.NodeList;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 
-import edu.internet2.middleware.shibboleth.aa.attrresolv.ResolverAttributeSet.ResolverAttributeIterator;
 import edu.internet2.middleware.shibboleth.aa.attrresolv.provider.ValueHandler;
 import edu.internet2.middleware.shibboleth.common.ShibResource;
 import edu.internet2.middleware.shibboleth.common.ShibResource.ResourceNotAvailableException;
@@ -56,7 +56,7 @@ import edu.internet2.middleware.shibboleth.xml.Parser;
 public class AttributeResolver {
 
        private static Logger log = Logger.getLogger(AttributeResolver.class.getName());
-       private HashMap plugIns = new HashMap();
+       private HashMap<String, ResolutionPlugIn> plugIns = new HashMap<String, ResolutionPlugIn>();
        private ResolverCache resolverCache = new ResolverCache();
        public static final String resolverNamespace = "urn:mace:shibboleth:resolver:1.0";
 
@@ -135,13 +135,13 @@ public class AttributeResolver {
        private void verifyPlugIns() throws AttributeResolverException {
 
                log.info("Verifying PlugIn graph consitency.");
-               Set inconsistent = new HashSet();
+               Set<String> inconsistent = new HashSet<String>();
                Iterator registered = plugIns.keySet().iterator();
 
                while (registered.hasNext()) {
-                       ResolutionPlugIn plugIn = lookupPlugIn((String) registered.next());
+                       ResolutionPlugIn plugIn = plugIns.get((String) registered.next());
                        log.debug("Checking PlugIn (" + plugIn.getId() + ") for consistency.");
-                       verifyPlugIn(plugIn, new HashSet(), inconsistent);
+                       verifyPlugIn(plugIn, new HashSet<String>(), inconsistent);
                }
 
                if (!inconsistent.isEmpty()) {
@@ -159,7 +159,7 @@ public class AttributeResolver {
 
        }
 
-       private void verifyPlugIn(ResolutionPlugIn plugIn, Set verifyChain, Set inconsistent) {
+       private void verifyPlugIn(ResolutionPlugIn plugIn, Set<String> verifyChain, Set<String> inconsistent) {
 
                // Short-circuit if we have already found this PlugIn to be inconsistent
                if (inconsistent.contains(plugIn.getId())) { return; }
@@ -173,11 +173,11 @@ public class AttributeResolver {
                }
 
                // Recursively go through all DataConnector dependencies and make sure all are registered and consistent.
-               List depends = new ArrayList();
+               List<String> depends = new ArrayList<String>();
                depends.addAll(Arrays.asList(plugIn.getDataConnectorDependencyIds()));
-               Iterator dependsIt = depends.iterator();
+               Iterator<String> dependsIt = depends.iterator();
                while (dependsIt.hasNext()) {
-                       String key = (String) dependsIt.next();
+                       String key = dependsIt.next();
                        if (!plugIns.containsKey(key)) {
                                log.error("The PlugIn (" + plugIn.getId() + ") is inconsistent.  It depends on a PlugIn (" + key
                                                + ") that is not registered.");
@@ -185,7 +185,7 @@ public class AttributeResolver {
                                return;
                        }
 
-                       ResolutionPlugIn dependent = lookupPlugIn(key);
+                       ResolutionPlugIn dependent = plugIns.get(key);
                        if (!(dependent instanceof DataConnectorPlugIn)) {
                                log.error("The PlugIn (" + plugIn.getId() + ") is inconsistent.  It depends on a PlugIn (" + key
                                                + ") that is mislabeled as an DataConnectorPlugIn.");
@@ -219,7 +219,7 @@ public class AttributeResolver {
                                return;
                        }
 
-                       ResolutionPlugIn dependent = lookupPlugIn(key);
+                       ResolutionPlugIn dependent = plugIns.get(key);
                        if (!(dependent instanceof AttributeDefinitionPlugIn)) {
                                log.error("The PlugIn (" + plugIn.getId() + ") is inconsistent.  It depends on a PlugIn (" + key
                                                + ") that is mislabeled as an AttributeDefinitionPlugIn.");
@@ -250,7 +250,7 @@ public class AttributeResolver {
                                        return;
                                }
 
-                               ResolutionPlugIn dependent = lookupPlugIn(key);
+                               ResolutionPlugIn dependent = plugIns.get(key);
                                if (!(dependent instanceof DataConnectorPlugIn)) {
                                        log.error("The PlugIn (" + plugIn.getId()
                                                        + ") is inconsistent.  It depends on a fail-over PlugIn (" + key
@@ -284,11 +284,6 @@ public class AttributeResolver {
 
        }
 
-       private ResolutionPlugIn lookupPlugIn(String id) {
-
-               return (ResolutionPlugIn) plugIns.get(id);
-       }
-
        /**
         * Resolve a set of attributes for a particular principal and requester.
         * 
@@ -301,16 +296,15 @@ public class AttributeResolver {
         * @param attributes
         *            the set of attributes to be resolved
         */
-       public void resolveAttributes(Principal principal, String requester, String responder,
-                       ResolverAttributeSet attributes) {
+       public void resolveAttributes(Principal principal, String requester, String responder, Map attributes) {
 
-               HashMap requestCache = new HashMap();
-               ResolverAttributeIterator iterator = attributes.resolverAttributeIterator();
+               HashMap requestCache = new HashMap<String, ResolverAttribute>();
+               Iterator<ResolverAttribute> iterator = attributes.values().iterator();
 
                while (iterator.hasNext()) {
-                       ResolverAttribute attribute = iterator.nextResolverAttribute();
+                       ResolverAttribute attribute = iterator.next();
                        try {
-                               if (lookupPlugIn(attribute.getName()) == null) {
+                               if (plugIns.get(attribute.getName()) == null) {
                                        log.warn("No PlugIn registered for attribute: (" + attribute.getName() + ")");
                                        iterator.remove();
                                } else {
@@ -334,14 +328,14 @@ public class AttributeResolver {
                }
        }
 
-       public String[] listRegisteredAttributeDefinitionPlugIns() {
+       public Collection<String> listRegisteredAttributeDefinitionPlugIns() {
 
                log.debug("Listing available Attribute Definition PlugIns.");
-               Set found = new HashSet();
+               Set<String> found = new HashSet<String>();
                Iterator registered = plugIns.keySet().iterator();
 
                while (registered.hasNext()) {
-                       ResolutionPlugIn plugIn = lookupPlugIn((String) registered.next());
+                       ResolutionPlugIn plugIn = plugIns.get((String) registered.next());
                        if (plugIn instanceof AttributeDefinitionPlugIn) {
                                found.add(((AttributeDefinitionPlugIn) plugIn).getId());
                        }
@@ -352,13 +346,13 @@ public class AttributeResolver {
                                log.debug("Found registered Attribute Definition: " + (String) iterator.next());
                        }
                }
-               return (String[]) found.toArray(new String[0]);
+               return found;
        }
 
        private Attributes resolveConnector(String connector, Principal principal, String requester, String responder,
-                       Map requestCache, ResolverAttributeSet requestedAttributes) throws ResolutionPlugInException {
+                       Map requestCache, Map<String, ResolverAttribute> requestedAttributes) throws ResolutionPlugInException {
 
-               DataConnectorPlugIn currentDefinition = (DataConnectorPlugIn) lookupPlugIn(connector);
+               DataConnectorPlugIn currentDefinition = (DataConnectorPlugIn) plugIns.get(connector);
 
                // Check to see if we have already resolved the connector during this request
                if (requestCache.containsKey(currentDefinition.getId())) {
@@ -384,7 +378,7 @@ public class AttributeResolver {
                for (int i = 0; attributeDependencies.length > i; i++) {
                        log.debug("Connector (" + currentDefinition.getId() + ") depends on attribute (" + attributeDependencies[i]
                                        + ").");
-                       ResolverAttribute dependant = requestedAttributes.getByName(attributeDependencies[i]);
+                       ResolverAttribute dependant = requestedAttributes.get(attributeDependencies[i]);
                        if (dependant == null) {
                                dependant = new DependentOnlyResolutionAttribute(attributeDependencies[i]);
                        }
@@ -433,9 +427,10 @@ public class AttributeResolver {
        }
 
        private void resolveAttribute(ResolverAttribute attribute, Principal principal, String requester, String responder,
-                       Map requestCache, ResolverAttributeSet requestedAttributes) throws ResolutionPlugInException {
+                       Map<String, ResolverAttribute> requestCache, Map<String, ResolverAttribute> requestedAttributes)
+                       throws ResolutionPlugInException {
 
-               AttributeDefinitionPlugIn currentDefinition = (AttributeDefinitionPlugIn) lookupPlugIn(attribute.getName());
+               AttributeDefinitionPlugIn currentDefinition = (AttributeDefinitionPlugIn) plugIns.get(attribute.getName());
 
                // Check to see if we have already resolved the attribute during this request
                // (this checks dependency-only attributes and attributes resolved with no values
@@ -448,10 +443,10 @@ public class AttributeResolver {
 
                // Check to see if we have already resolved the attribute during this request
                // (this checks attributes that were submitted to the AR for resolution)
-               ResolverAttribute requestedAttribute = requestedAttributes.getByName(currentDefinition.getId());
+               ResolverAttribute requestedAttribute = requestedAttributes.get(currentDefinition.getId());
                if (requestedAttribute != null && requestedAttribute.resolved()) {
-                               attribute.resolveFromCached(requestedAttribute);
-                               return;
+                       attribute.resolveFromCached(requestedAttribute);
+                       return;
                }
 
                // Check to see if we have a cached resolution for this attribute
@@ -474,7 +469,7 @@ public class AttributeResolver {
                for (int i = 0; attributeDependencies.length > i; i++) {
                        log.debug("Attribute (" + attribute.getName() + ") depends on attribute (" + attributeDependencies[i]
                                        + ").");
-                       ResolverAttribute dependant = requestedAttributes.getByName(attributeDependencies[i]);
+                       ResolverAttribute dependant = requestedAttributes.get(attributeDependencies[i]);
                        if (dependant == null) {
                                dependancyOnly = true;
                                dependant = new DependentOnlyResolutionAttribute(attributeDependencies[i]);
diff --git a/src/edu/internet2/middleware/shibboleth/aa/attrresolv/ResolverAttributeSet.java b/src/edu/internet2/middleware/shibboleth/aa/attrresolv/ResolverAttributeSet.java
deleted file mode 100644 (file)
index 8cf3bc6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
- *
- * Licensed 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 edu.internet2.middleware.shibboleth.aa.attrresolv;
-
-/**
- * Defines a set of attributes that can be resolved by the <code>AttributeResolver</code>.
- * 
- * @author Walter Hoehn (wassa@columbia.edu)
- */
-public interface ResolverAttributeSet {
-
-       public ResolverAttributeIterator resolverAttributeIterator();
-
-       public ResolverAttribute getByName(String name);
-
-       public interface ResolverAttributeIterator {
-
-               public boolean hasNext();
-
-               public ResolverAttribute nextResolverAttribute();
-
-               public void remove();
-       }
-}
index 1158c0d..7644048 100644 (file)
@@ -23,6 +23,8 @@ package edu.internet2.middleware.shibboleth.aa.attrresolv;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.LineNumberReader;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
@@ -32,7 +34,6 @@ import org.apache.log4j.Logger;
 import org.opensaml.SAMLException;
 
 import edu.internet2.middleware.shibboleth.aa.AAAttribute;
-import edu.internet2.middleware.shibboleth.aa.AAAttributeSet;
 
 /**
  * The AttributesFile reads attributes specified in a file as name-value pairs separated by an 'equals' sign (=)
@@ -116,21 +117,21 @@ public class AttributesFile {
                }
        }
 
-       public synchronized ResolverAttributeSet getResolverAttributes(boolean returnValues) throws IOException,
+       public synchronized Map<String, AAAttribute> getResolverAttributes(boolean returnValues) throws IOException,
                        SAMLException {
 
                open();
                try {
-                       AAAttributeSet attributes = new AAAttributeSet();
+                       Map<String, AAAttribute> attributes = new HashMap<String, AAAttribute>();
                        AVPair av = readAV();
                        while (av != null) {
-                               AAAttribute attr = (AAAttribute) attributes.getByName(av.name);
+                               AAAttribute attr = (AAAttribute) attributes.get(av.name);
                                if (attr == null) {
                                        // The intern() is to work-around the bug in AAAttribute.equals() where the name of the
                                        // attribute is compared
                                        // using "==" rather than "equals" ...
                                        attr = new AAAttribute(av.name.intern());
-                                       attributes.add(attr);
+                                       attributes.put(attr.getName(), attr);
                                }
                                if (returnValues) {
                                        attr.addValue(av.value);