/** * Check is a AuthScope is "subsumed" by another AuthScope. * Alias for equivalence */ static boolean subsumes(AuthScope as, AuthScope has) { return equivalent(as, has); }
/** * Clear some entries matching the argument */ static synchronized public void // public only to allow testing invalidate(AuthScope scope) { if(TESTING) { if(testlist == null) testlist = new ArrayList<Triple>(); } // walk backward because we are removing entries for(int i = HTTPCachingProvider.cache.size() - 1;i >= 0;i--) { Triple p = HTTPCachingProvider.cache.get(i); if(HTTPAuthScope.equivalent(scope, p.scope)) { if(TESTING) { System.err.println("invalidating: " + p); if(testlist == null) testlist = new ArrayList<Triple>(); testlist.add(p); } HTTPCachingProvider.cache.remove(i); } } }
/** * Search for all equivalent rows, then sort on the path. * * @param scope * @return list of matching entries */ synchronized public List<Entry> search(String principal, AuthScope scope) { List<Entry> matches; if(isdefault || DEFAULT == null) matches = new ArrayList<Entry>(); else matches = DEFAULT.search(principal, scope); if(scope == null || rows.size() == 0) return matches; for(Entry e : getAllRows()) { if(principal != ANY_PRINCIPAL && e.principal.equals(principal)) continue; if(HTTPAuthScope.equivalent(scope, e.scope)) matches.add(e); } Collections.sort(matches); return matches; }