|
From: <pe...@us...> - 2003-10-02 23:29:14
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store
In directory sc8-pr-cvs1:/tmp/cvs-serv24957/src/java/org/neuclear/store
Modified Files:
FileStore.java Store.java
Log Message:
Updated Root Key. This will be the root key for the remainder of the beta period. With version 1.0 I will update it with a new key.
VerifyingTest works now and also does a pass for fake ones. Will have to think of better ways of making fake Identities to break it.
Cleaned up much of the tests and they all pass now.
The FileStoreTests need to be rethought out, by adding a test key.
Index: FileStore.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/FileStore.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** FileStore.java 26 Sep 2003 00:22:07 -0000 1.5
--- FileStore.java 2 Oct 2003 23:29:03 -0000 1.6
***************
*** 2,5 ****
--- 2,11 ----
* $Id$
* $Log$
+ * Revision 1.6 2003/10/02 23:29:03 pelle
+ * Updated Root Key. This will be the root key for the remainder of the beta period. With version 1.0 I will update it with a new key.
+ * VerifyingTest works now and also does a pass for fake ones. Will have to think of better ways of making fake Identities to break it.
+ * Cleaned up much of the tests and they all pass now.
+ * The FileStoreTests need to be rethought out, by adding a test key.
+ *
* Revision 1.5 2003/09/26 00:22:07 pelle
* Cleanups and final changes to code for refactoring of the Verifier and Reader part.
***************
*** 120,128 ****
//import org.neuclear.id.NSDLObject;
- import org.dom4j.Document;
import org.neuclear.id.NSTools;
import org.neuclear.id.SignedNamedObject;
import org.neudist.utils.NeudistException;
- import org.neudist.xml.XMLTools;
import java.io.File;
--- 126,134 ----
//import org.neuclear.id.NSDLObject;
import org.neuclear.id.NSTools;
import org.neuclear.id.SignedNamedObject;
+ import org.neuclear.id.builders.NamedObjectBuilder;
+ import org.neuclear.id.verifier.VerifyingReader;
import org.neudist.utils.NeudistException;
import java.io.File;
***************
*** 142,146 ****
}
! protected void rawStore(SignedNamedObject obj) throws IOException, NeudistException {
String outputFilename = base + getFileName(obj);
System.out.println("Outputting to: " + outputFilename);
--- 148,152 ----
}
! protected void rawStore(NamedObjectBuilder obj) throws IOException, NeudistException {
String outputFilename = base + getFileName(obj);
System.out.println("Outputting to: " + outputFilename);
***************
*** 154,158 ****
// }
! protected SignedNamedObject fetch(String name) throws NeudistException {
String inputFilename = base + getFileName(NSTools.normalizeNameURI(name));
System.out.println("Loading from: " + inputFilename);
--- 160,164 ----
// }
! SignedNamedObject fetch(String name) throws NeudistException {
String inputFilename = base + getFileName(NSTools.normalizeNameURI(name));
System.out.println("Loading from: " + inputFilename);
***************
*** 161,177 ****
return null;
- SignedNamedObject ns = null;
try {
! Document doc = XMLTools.loadDocument(new FileInputStream(fin));
! //TODO Find alternative ns = NamedObjectFactory.createNamedObject(doc);
! // System.out.println("NEUDIST: Fetched SignedNamedObject tag:"+rootName.getName()+" URI:"+rootName.getNamespaceURI());
! // } catch (ParserConfigurationException e) {
! // Utility.rethrowException(e);
} catch (FileNotFoundException e) {
e.printStackTrace();
! // Utility.rethrowException(e);
}
-
- return ns;
}
--- 167,176 ----
return null;
try {
! return VerifyingReader.getInstance().read(new FileInputStream(fin));
} catch (FileNotFoundException e) {
e.printStackTrace();
! return null;
}
}
***************
*** 186,190 ****
}
! protected static String getFileName(SignedNamedObject obj) throws NeudistException {
return getFileName(obj.getName());
// if (! (obj instanceof Identity))
--- 185,189 ----
}
! protected static String getFileName(NamedObjectBuilder obj) throws NeudistException {
return getFileName(obj.getName());
// if (! (obj instanceof Identity))
Index: Store.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/Store.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Store.java 26 Sep 2003 23:53:10 -0000 1.6
--- Store.java 2 Oct 2003 23:29:03 -0000 1.7
***************
*** 2,5 ****
--- 2,11 ----
* $Id$
* $Log$
+ * Revision 1.7 2003/10/02 23:29:03 pelle
+ * Updated Root Key. This will be the root key for the remainder of the beta period. With version 1.0 I will update it with a new key.
+ * VerifyingTest works now and also does a pass for fake ones. Will have to think of better ways of making fake Identities to break it.
+ * Cleaned up much of the tests and they all pass now.
+ * The FileStoreTests need to be rethought out, by adding a test key.
+ *
* Revision 1.6 2003/09/26 23:53:10 pelle
* Changes mainly in receiver and related fun.
***************
*** 134,145 ****
package org.neuclear.store;
import org.neuclear.id.SignedNamedObject;
! import org.neuclear.receiver.Receiver;
! import org.neuclear.receiver.UnsupportedTransaction;
import org.neudist.utils.NeudistException;
import java.io.IOException;
! abstract public class Store implements Receiver {
//protected Store(Store store)
--- 140,154 ----
package org.neuclear.store;
+ import org.neuclear.id.InvalidIdentityException;
import org.neuclear.id.SignedNamedObject;
! import org.neuclear.id.builders.NamedObjectBuilder;
! import org.neuclear.receiver.RawReceiver;
import org.neudist.utils.NeudistException;
+ import org.neudist.xml.xmlsec.XMLSecurityException;
import java.io.IOException;
! abstract public class Store implements RawReceiver {
!
//protected Store(Store store)
***************
*** 148,167 ****
* This handles the Identity checking on the object.
*/
! public final void receive(SignedNamedObject obj) throws UnsupportedTransaction {
try {
// Dont allow overwrites
//TODO: Implement versioning
- // if (fetch(obj.getName())!=null)
- // throw new InvalidIdentityException("The name: "+obj.getName()+" already exists");
rawStore(obj);
!
if (next != null)
next.receive(obj);
} catch (IOException e) {
e.printStackTrace();
! } catch (NeudistException e) {
e.printStackTrace();
}
// if (e instanceof InvalidIdentityException)
--- 157,180 ----
* This handles the Identity checking on the object.
*/
! public final void receive(NamedObjectBuilder obj) throws InvalidIdentityException {
try {
// Dont allow overwrites
//TODO: Implement versioning
+ // if (obj.verifySignature(obj.getParent().getPublicKey()))
rawStore(obj);
! // else
! // throw new InvalidIdentityException("INVALID Signature");
if (next != null)
next.receive(obj);
+
} catch (IOException e) {
e.printStackTrace();
! } catch (XMLSecurityException e) {
e.printStackTrace();
+ } catch (NeudistException e) {
+ if (e instanceof InvalidIdentityException)
+ throw (InvalidIdentityException) e;
}
// if (e instanceof InvalidIdentityException)
***************
*** 177,184 ****
* Override this for each specific Store type
*/
! protected void rawStore(SignedNamedObject obj) throws IOException, NeudistException {
;
}
! private Receiver next;
}
--- 190,199 ----
* Override this for each specific Store type
*/
! protected void rawStore(NamedObjectBuilder obj) throws IOException, NeudistException {
;
}
! private RawReceiver next;
!
! abstract SignedNamedObject fetch(String name) throws NeudistException;
}
|