|
From: <pe...@us...> - 2004-01-03 20:36:42
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/cache
In directory sc8-pr-cvs1:/tmp/cvs-serv10272/src/java/org/neuclear/id/cache
Modified Files:
NSCache.java
Log Message:
Renamed HeldTransfer to Exchange
Dropped valuetime from the request objects.
Doesnt yet compile. New commit to follow soon.
Index: NSCache.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/cache/NSCache.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** NSCache.java 19 Dec 2003 18:03:34 -0000 1.8
--- NSCache.java 3 Jan 2004 20:36:38 -0000 1.9
***************
*** 1,6 ****
package org.neuclear.id.cache;
- import com.waterken.adt.NoSuchElement;
- import com.waterken.adt.cache.Cache;
import org.neuclear.commons.NeuClearException;
import org.neuclear.id.Identity;
--- 1,4 ----
***************
*** 9,12 ****
--- 7,14 ----
import org.neuclear.id.InvalidNamedObjectException;
+ import java.util.Map;
+ import java.util.HashMap;
+ import java.lang.ref.WeakReference;
+
/**
* The Idea of the NSCache is to have a quick cache of verified public NameSpaces. This is not stored, but is created from scratch
***************
*** 16,26 ****
*/
public final class NSCache {
! private NSCache() {
! spaces = new Cache();
}
! public static final NSCache make() {
! return new NSCache();
! }
/**
--- 18,26 ----
*/
public final class NSCache {
! public NSCache() {
! spaces = new HashMap();
}
!
/**
***************
*** 31,39 ****
*/
public SignedNamedObject fetchCached(final String name) {
! try { // I dont like the way it forces me to catch this. I need to rewrite it.
! return (Identity) spaces.fetch(name);
! } catch (NoSuchElement noSuchElement) {
return null;
! }
}
--- 31,38 ----
*/
public SignedNamedObject fetchCached(final String name) {
! final WeakReference ref = (WeakReference) spaces.get(name);
! if (ref==null)
return null;
! return (SignedNamedObject) ref.get();
}
***************
*** 43,47 ****
final String parentName = NSTools.getSignatoryURI(ns.getName());
if ((fetchCached(parentName) != null) || (parentName.equals("neu://")||NSTools.isHttpScheme(ns.getName())!=null)) {
! spaces.put(ns.getName(), ns);
}
} catch (InvalidNamedObjectException e) {
--- 42,46 ----
final String parentName = NSTools.getSignatoryURI(ns.getName());
if ((fetchCached(parentName) != null) || (parentName.equals("neu://")||NSTools.isHttpScheme(ns.getName())!=null)) {
! spaces.put(ns.getName(),new WeakReference(ns));
}
} catch (InvalidNamedObjectException e) {
***************
*** 50,53 ****
}
! private final Cache spaces;
}
--- 49,52 ----
}
! private final Map spaces;
}
|