|
From: <pe...@us...> - 2003-11-21 04:45:47
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source
In directory sc8-pr-cvs1:/tmp/cvs-serv10855/src/java/org/neuclear/source
Modified Files:
CachedSource.java HttpSource.java Source.java
Log Message:
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
Otherwise You will Finaliate.
Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
This should hopefully make everything more stable (and secure).
Index: CachedSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/CachedSource.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** CachedSource.java 11 Nov 2003 21:18:44 -0000 1.12
--- CachedSource.java 21 Nov 2003 04:45:14 -0000 1.13
***************
*** 3,6 ****
--- 3,12 ----
* $Id$
* $Log$
+ * Revision 1.13 2003/11/21 04:45:14 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.12 2003/11/11 21:18:44 pelle
* Further vital reshuffling.
***************
*** 103,110 ****
*/
public final class CachedSource extends Source {
! public CachedSource(Source src) {
this.src = src;
cachedirpath = System.getProperty("user.home") + "/.neuclear/cache";
! File cachedir = new File(cachedirpath);
if (!cachedir.exists())
cachedir.mkdirs();
--- 109,116 ----
*/
public final class CachedSource extends Source {
! public CachedSource(final Source src) {
this.src = src;
cachedirpath = System.getProperty("user.home") + "/.neuclear/cache";
! final File cachedir = new File(cachedirpath);
if (!cachedir.exists())
cachedir.mkdirs();
***************
*** 112,122 ****
! protected InputStream getStream(String endpoint, String name) throws NeuClearException {
! File object = new File(cachedirpath + NSTools.url2path(name) + "/root.id");
try {
if (!object.exists()) { //TODO check for freshness
object.getParentFile().mkdirs();
! InputStream in = src.getStream(endpoint, name);
! OutputStream out = new FileOutputStream(object);
int character;
//TODO Explore more efficient ways of copying streams
--- 118,128 ----
! protected InputStream getStream(final String endpoint, final String name) throws NeuClearException {
! final File object = new File(cachedirpath + NSTools.url2path(name) + "/root.id");
try {
if (!object.exists()) { //TODO check for freshness
object.getParentFile().mkdirs();
! final InputStream in = src.getStream(endpoint, name);
! final OutputStream out = new FileOutputStream(object);
int character;
//TODO Explore more efficient ways of copying streams
Index: HttpSource.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/HttpSource.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** HttpSource.java 11 Nov 2003 21:18:44 -0000 1.8
--- HttpSource.java 21 Nov 2003 04:45:14 -0000 1.9
***************
*** 15,18 ****
--- 15,24 ----
* $Id$
* $Log$
+ * Revision 1.9 2003/11/21 04:45:14 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.8 2003/11/11 21:18:44 pelle
* Further vital reshuffling.
***************
*** 69,78 ****
* CommandLineSigner is simplified to make it easier to use.
*/
! public class HttpSource extends Source {
! protected InputStream getStream(String endpoint, String name) throws NeuClearException {
try {
! String urlstring = endpoint + NSTools.url2path(name);
! URL url = new URL(urlstring);
return url.openStream();
--- 75,84 ----
* CommandLineSigner is simplified to make it easier to use.
*/
! public final class HttpSource extends Source {
! protected final InputStream getStream(final String endpoint, final String name) throws NeuClearException {
try {
! final String urlstring = endpoint + NSTools.url2path(name);
! final URL url = new URL(urlstring);
return url.openStream();
***************
*** 82,89 ****
}
! public static void main(String args[]) {
! Source source = new HttpSource();
try {
! SignedNamedObject obj = source.fetch("http://repository.neuclear.org", "/pelle");
System.out.println("Got: " + obj.getName());
--- 88,95 ----
}
! public static void main(final String[] args) {
! final Source source = new HttpSource();
try {
! final SignedNamedObject obj = source.fetch("http://repository.neuclear.org", "/pelle");
System.out.println("Got: " + obj.getName());
Index: Source.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/source/Source.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Source.java 11 Nov 2003 21:18:44 -0000 1.6
--- Source.java 21 Nov 2003 04:45:14 -0000 1.7
***************
*** 19,22 ****
--- 19,28 ----
* $Id$
* $Log$
+ * Revision 1.7 2003/11/21 04:45:14 pelle
+ * EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
+ * Otherwise You will Finaliate.
+ * Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
+ * This should hopefully make everything more stable (and secure).
+ *
* Revision 1.6 2003/11/11 21:18:44 pelle
* Further vital reshuffling.
***************
*** 76,80 ****
}
! public final SignedNamedObject fetch(String endpoint, String name) throws NeuClearException {
try {
name = NSTools.normalizeNameURI(name);
--- 82,86 ----
}
! public final SignedNamedObject fetch(final String endpoint, String name) throws NeuClearException {
try {
name = NSTools.normalizeNameURI(name);
***************
*** 99,107 ****
* @return
*/
! protected InputStream getStream(String endpoint, String name) throws NeuClearException {
return null;
}
! private void storeInCache(SignedNamedObject obj) throws NeuClearException {
cache.put(obj.getName(), obj);
}
--- 105,113 ----
* @return
*/
! protected InputStream getStream(final String endpoint, final String name) throws NeuClearException {
return null;
}
! private void storeInCache(final SignedNamedObject obj) throws NeuClearException {
cache.put(obj.getName(), obj);
}
|