Fixed bugs in ARP caching. Site ARP was not being cached. User ARP was being cached...
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 28 Jan 2003 19:56:25 +0000 (19:56 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 28 Jan 2003 19:56:25 +0000 (19:56 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@430 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/arp/AAPrincipal.java
src/edu/internet2/middleware/shibboleth/aa/arp/provider/BaseArpRepository.java
src/edu/internet2/middleware/shibboleth/aa/arp/provider/FileSystemArpRepository.java

index 031a2f9..c8bde2a 100755 (executable)
@@ -77,4 +77,21 @@ public class AAPrincipal implements Principal {
                return principalName;
        }
 
+       /**
+        * @see java.lang.Object#equals(Object)
+        */
+       public boolean equals(Object obj) {
+               if (!(obj instanceof AAPrincipal)) {
+                       return false;
+               }
+               return ((AAPrincipal) obj).getName().equals(getName());
+       }
+
+       /**
+        * @see java.lang.Object#hashCode()
+        */
+       public int hashCode() {
+               return "AAPrincipal".hashCode() + principalName.hashCode();
+       }
+
 }
index f59bdfb..e081fa5 100755 (executable)
@@ -103,12 +103,15 @@ public abstract class BaseArpRepository implements ArpRepository {
                                + principal.getName()
                                + ").");
                Set allPolicies = new HashSet();
-               if (getSitePolicy() != null) {
+               Arp sitePolicy = getSitePolicy();
+               if (sitePolicy != null) {
                        log.debug("Returning site policy.");
-                       allPolicies.add(getSitePolicy());
+                       allPolicies.add(sitePolicy);
                }
-               if (getUserPolicy(principal) != null) {
-                       allPolicies.add(getUserPolicy(principal));
+               
+               Arp userPolicy = getUserPolicy(principal);
+               if (userPolicy != null) {
+                       allPolicies.add(userPolicy);
                        log.debug("Returning user policy.");
                }
                if (allPolicies.isEmpty()) {
@@ -273,6 +276,9 @@ class ArpCache {
                        return "ARP admin";
                }
 
+               /**
+                * @see java.lang.Object#equals(Object)
+                */
                public boolean equals(Object object) {
                        if (object instanceof SiteCachePrincipal) {
                                return true;
@@ -280,7 +286,10 @@ class ArpCache {
                        return false;
                }
 
-               public long hashcode() {
+               /**
+                * @see java.lang.Object#hashCode()
+                */
+               public int hashCode() {
                        return "edu.internet2.middleware.shibboleth.aa.arp.provider.BaseArpRepository.SiteCachePrincipal"
                                .hashCode();
                }
index f82bcf6..67cd2ca 100755 (executable)
@@ -162,7 +162,7 @@ public class FileSystemArpRepository extends BaseArpRepository implements ArpRep
                                + principal.getName()
                                + ".xml";
                log.debug(
-                       "Attempting to load user (" + principal.getName() + ")ARP from: (" + fileName + ").");
+                       "Attempting to load user (" + principal.getName() + ") ARP from: (" + fileName + ").");
                return retrieveArpXml(fileName);
        }