|
From: <pe...@us...> - 2003-09-24 23:56:57
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source
In directory sc8-pr-cvs1:/tmp/cvs-serv524/src/java/org/neuclear/source
Modified Files:
CachedSource.java HttpSource.java Source.java
Log Message:
Refactoring nearly done. New model for creating signed objects.
With view for supporting the xmlpull api shortly for performance reasons.
Currently still uses dom4j but that has been refactored out that it
should now be very quick to implement a xmlpull implementation.
A side benefit of this is that the API has been further simplified. I still have some work
todo with regards to cleaning up some of the outlying parts of the code.
Index: CachedSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/CachedSource.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CachedSource.java 22 Sep 2003 19:24:02 -0000 1.2
--- CachedSource.java 24 Sep 2003 23:56:49 -0000 1.3
***************
*** 3,6 ****
--- 3,15 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/09/24 23:56:49 pelle
+ * Refactoring nearly done. New model for creating signed objects.
+ * With view for supporting the xmlpull api shortly for performance reasons.
+ * Currently still uses dom4j but that has been refactored out that it
+ * should now be very quick to implement a xmlpull implementation.
+ *
+ * A side benefit of this is that the API has been further simplified. I still have some work
+ * todo with regards to cleaning up some of the outlying parts of the code.
+ *
* Revision 1.2 2003/09/22 19:24:02 pelle
* More fixes throughout to problems caused by renaming.
***************
*** 31,35 ****
import org.apache.commons.collections.LRUMap;
import org.neuclear.id.NSTools;
! import org.neuclear.id.NamedObject;
import org.neudist.utils.NeudistException;
--- 40,44 ----
import org.apache.commons.collections.LRUMap;
import org.neuclear.id.NSTools;
! import org.neuclear.id.SignedNamedObject;
import org.neudist.utils.NeudistException;
***************
*** 47,53 ****
! public NamedObject fetch(String endpoint, String name) throws NeudistException {
name = NSTools.normalizeNameURI(name);
! NamedObject candidate = (NamedObject) cache.get(name);
if (candidate != null)
return candidate;
--- 56,62 ----
! public SignedNamedObject fetch(String endpoint, String name) throws NeudistException {
name = NSTools.normalizeNameURI(name);
! SignedNamedObject candidate = (SignedNamedObject) cache.get(name);
if (candidate != null)
return candidate;
***************
*** 60,64 ****
}
! private void storeInCache(NamedObject obj) throws NeudistException {
cache.put(obj.getName(), obj);
}
--- 69,73 ----
}
! private void storeInCache(SignedNamedObject obj) throws NeudistException {
cache.put(obj.getName(), obj);
}
Index: HttpSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/HttpSource.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HttpSource.java 22 Sep 2003 19:24:02 -0000 1.2
--- HttpSource.java 24 Sep 2003 23:56:49 -0000 1.3
***************
*** 5,10 ****
import org.dom4j.io.SAXReader;
import org.neuclear.id.NSTools;
! import org.neuclear.id.NamedObject;
import org.neuclear.id.NamedObjectFactory;
import org.neudist.utils.NeudistException;
--- 5,11 ----
import org.dom4j.io.SAXReader;
import org.neuclear.id.NSTools;
! import org.neuclear.id.SignedNamedObject;
import org.neuclear.id.NamedObjectFactory;
+ import org.neuclear.id.verifier.VerifyingReader;
import org.neudist.utils.NeudistException;
***************
*** 19,22 ****
--- 20,32 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/09/24 23:56:49 pelle
+ * Refactoring nearly done. New model for creating signed objects.
+ * With view for supporting the xmlpull api shortly for performance reasons.
+ * Currently still uses dom4j but that has been refactored out that it
+ * should now be very quick to implement a xmlpull implementation.
+ *
+ * A side benefit of this is that the API has been further simplified. I still have some work
+ * todo with regards to cleaning up some of the outlying parts of the code.
+ *
* Revision 1.2 2003/09/22 19:24:02 pelle
* More fixes throughout to problems caused by renaming.
***************
*** 48,60 ****
}
! public NamedObject fetch(String endpoint, String name) throws NeudistException {
try {
String urlstring = endpoint + NSTools.url2path(name);
URL url = new URL(urlstring);
! Document doc = reader.read(url);
! return NamedObjectFactory.createNamedObject(doc);
! } catch (DocumentException e) {
! throw new NeudistException(name + " not found");
! } catch (MalformedURLException e) {
throw new NeudistException(e);
}
--- 58,68 ----
}
! public SignedNamedObject fetch(String endpoint, String name) throws NeudistException {
try {
String urlstring = endpoint + NSTools.url2path(name);
URL url = new URL(urlstring);
!
! return VerifyingReader.getInstance().read(url.openStream());
! } catch (java.io.IOException e) {
throw new NeudistException(e);
}
***************
*** 64,70 ****
Source source = new HttpSource();
try {
! NamedObject obj = source.fetch("http://repository.neuclear.org", "/pelle");
System.out.println("Got: " + obj.getName());
! System.out.println(obj.getElement().asXML());
} catch (NeudistException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
--- 72,78 ----
Source source = new HttpSource();
try {
! SignedNamedObject obj = source.fetch("http://repository.neuclear.org", "/pelle");
System.out.println("Got: " + obj.getName());
!
} catch (NeudistException e) {
e.printStackTrace(); //To change body of catch statement use Options | File Templates.
Index: Source.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/Source.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Source.java 22 Sep 2003 19:24:02 -0000 1.2
--- Source.java 24 Sep 2003 23:56:49 -0000 1.3
***************
*** 1,5 ****
package org.neuclear.source;
! import org.neuclear.id.NamedObject;
import org.neudist.utils.NeudistException;
import org.neudist.utils.Utility;
--- 1,5 ----
package org.neuclear.source;
! import org.neuclear.id.SignedNamedObject;
import org.neudist.utils.NeudistException;
import org.neudist.utils.Utility;
***************
*** 12,15 ****
--- 12,24 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/09/24 23:56:49 pelle
+ * Refactoring nearly done. New model for creating signed objects.
+ * With view for supporting the xmlpull api shortly for performance reasons.
+ * Currently still uses dom4j but that has been refactored out that it
+ * should now be very quick to implement a xmlpull implementation.
+ *
+ * A side benefit of this is that the API has been further simplified. I still have some work
+ * todo with regards to cleaning up some of the outlying parts of the code.
+ *
* Revision 1.2 2003/09/22 19:24:02 pelle
* More fixes throughout to problems caused by renaming.
***************
*** 42,46 ****
*/
public abstract class Source {
! abstract public NamedObject fetch(String endpoint, String name) throws NeudistException;
public static synchronized Source getInstance() {
--- 51,55 ----
*/
public abstract class Source {
! abstract public SignedNamedObject fetch(String endpoint, String name) throws NeudistException;
public static synchronized Source getInstance() {
|