You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(119) |
Oct
(111) |
Nov
(238) |
Dec
(395) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(239) |
Feb
(59) |
Mar
(354) |
Apr
(489) |
May
(23) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(5) |
Jun
(2) |
Jul
|
Aug
|
Sep
(3) |
Oct
(14) |
Nov
(17) |
Dec
(9) |
| 2007 |
Jan
(4) |
Feb
(3) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(1) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(7) |
May
(3) |
Jun
(6) |
Jul
(4) |
Aug
(3) |
Sep
(15) |
Oct
(13) |
Nov
(35) |
Dec
(40) |
| 2009 |
Jan
(19) |
Feb
(21) |
Mar
(16) |
Apr
(18) |
May
(36) |
Jun
(20) |
Jul
(32) |
Aug
(11) |
Sep
(3) |
Oct
(2) |
Nov
(2) |
Dec
(13) |
| 2010 |
Jan
(5) |
Feb
(5) |
Mar
(7) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
(4) |
Nov
|
Dec
(3) |
| 2012 |
Jan
(3) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(8) |
Jun
(4) |
Jul
(9) |
Aug
(2) |
Sep
(8) |
Oct
(3) |
Nov
(8) |
Dec
(4) |
| 2013 |
Jan
(2) |
Feb
(1) |
Mar
(5) |
Apr
(6) |
May
(10) |
Jun
(5) |
Jul
(6) |
Aug
(7) |
Sep
(5) |
Oct
(2) |
Nov
(4) |
Dec
(4) |
| 2014 |
Jan
(13) |
Feb
(4) |
Mar
(7) |
Apr
(9) |
May
(20) |
Jun
(13) |
Jul
(10) |
Aug
(3) |
Sep
(5) |
Oct
(2) |
Nov
(2) |
Dec
(2) |
| 2015 |
Jan
(3) |
Feb
(3) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2016 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
(3) |
Oct
(3) |
Nov
(4) |
Dec
(2) |
| 2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <bug...@ve...> - 2004-04-01 22:14:40
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/NEU-26 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-26 Summary: Create Timestamping Client Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.9 Versions: 0.9 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 1 Apr 2004 2:13 PM Updated: Thu, 1 Apr 2004 2:13 PM Description: Need a Timestamping Client to get the time of a hash from a timestamping service. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-01 22:12:34
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/NEU-25 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-25 Summary: Create Timestamping Servlet Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.9 Versions: 0.9 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 1 Apr 2004 2:11 PM Updated: Thu, 1 Apr 2004 2:11 PM Description: I need a Servlet which can sign an SHA1 Hash together with a timestamp. It should take the data as part of the PATH_INFO: eg. /timestamp/{base32 encoded sha1 hash} It then returns in plain ascii: {sha1 hash} {ISO Timestamp} [Base 64 encoded RSA Signature] --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-01 22:04:41
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Thu, 1 Apr 2004 2:04 PM
Bandaged it into NSResolver, which I took the liberty of renaming as Resolver.
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/NEU-24
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NEU-24
Summary: Create Identity Resolver
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Identity
Fix Fors:
0.9
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Thu, 1 Apr 2004 1:25 PM
Updated: Thu, 1 Apr 2004 2:04 PM
Description:
We need to be able to resolve Identity objects based on the unique SHA1 of the users Public Key.
First implementation will see this as a servlet running on pkyp.org.
The design should be such that it would be simple to plug a distributed hash table in to it using P2P technology.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-01 21:27:41
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/NEU-24 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-24 Summary: Create Identity Resolver Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 1 Apr 2004 1:25 PM Updated: Thu, 1 Apr 2004 1:25 PM Description: We need to be able to resolve Identity objects based on the unique SHA1 of the users Public Key. First implementation will see this as a servlet running on pkyp.org. The design should be such that it would be simple to plug a distributed hash table in to it using P2P technology. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-01 21:23:33
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/NEU-23 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-23 Summary: Create Identity Repository Servlet Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.9 Versions: 0.9 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 1 Apr 2004 1:23 PM Updated: Thu, 1 Apr 2004 1:23 PM Description: We need to be able to look up a users Identity based on their public key. The Servlet should be able to return the latest <Identity/> registered within. The Servlet should also accept Posted Identity objects that it verifies and registers in its database. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-01 21:16:33
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Thu, 1 Apr 2004 1:16 PM
Done.
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/NEU-21
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NEU-21
Summary: Get rid of <Allow/> from <Identity/>
Type: Improvement
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Identity
Fix Fors:
0.9
Versions:
0.9
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Thu, 1 Apr 2004 11:24 AM
Updated: Thu, 1 Apr 2004 1:16 PM
Description:
As we always assume that the Identity is the PublicKey of the signer, we no longer need to embed the PublicKey in an Allow tag.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-01 20:59:33
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Thu, 1 Apr 2004 12:59 PM
This has been done and all tests within neuclear-id still pass (pheww)
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/NEU-22
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NEU-22
Summary: Split Identity into Signatory and Identity objects
Type: Improvement
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Identity
Fix Fors:
0.9
Versions:
0.9
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Thu, 1 Apr 2004 11:54 AM
Updated: Thu, 1 Apr 2004 12:59 PM
Description:
There now is very little sense in using Identity as the main Signatory object. I would like to split out a smaller Signatory class that handles most of what Identity does now.
Identity is still needed and will be used for user certified public information.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-01 19:55:36
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/NEU-22 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-22 Summary: Split Identity into Signatory and Identity objects Type: Improvement Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.9 Versions: 0.9 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 1 Apr 2004 11:54 AM Updated: Thu, 1 Apr 2004 11:54 AM Description: There now is very little sense in using Identity as the main Signatory object. I would like to split out a smaller Signatory class that handles most of what Identity does now. Identity is still needed and will be used for user certified public information. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-01 19:24:33
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/NEU-21 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-21 Summary: Get rid of <Allow/> from <Identity/> Type: Improvement Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.9 Versions: 0.9 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 1 Apr 2004 11:24 AM Updated: Thu, 1 Apr 2004 11:24 AM Description: As we always assume that the Identity is the PublicKey of the signer, we no longer need to embed the PublicKey in an Allow tag. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-01 19:22:32
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/NEU-10 Here is an overview of the issue: --------------------------------------------------------------------- Key: NEU-10 Summary: Need to load the Target elements when constructed from Element Type: Bug Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Identity Fix Fors: 0.9 Versions: 0.7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Tue, 18 Nov 2003 3:52 PM Updated: Thu, 1 Apr 2004 11:21 AM Description: Currently doesnt load Target list --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-01 19:20:44
|
Message:
The following issue has been deleted from JIRA.
---------------------------------------------------------------------
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NEU-8
Summary: Document Source Pattern
Type: Task
Status: Open
Priority: Major
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Identity
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Thu, 13 Nov 2003 4:19 PM
Updated: Thu, 13 Nov 2003 4:19 PM
Description:
Explain function and how to write new Source's
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-01 19:20:43
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Thu, 1 Apr 2004 11:18 AM
Wont fix as we've eliminated the Source pattern.
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/NEU-11
Here is an overview of the issue:
---------------------------------------------------------------------
Key: NEU-11
Summary: Check for freshness in file Cache on CachedSource
Type: Improvement
Status: Closed
Priority: Major
Resolution: WON'T FIX
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Identity
Fix Fors:
0.9
Versions:
0.7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Tue, 18 Nov 2003 3:59 PM
Updated: Thu, 1 Apr 2004 11:18 AM
Description:
Currently it doesnt check for freshness or errors.
It should check for the file date and if it is more than X Time period old reload from Source. The same with errors on objects in the case.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:25:55
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29461/src/java/org/neuclear/commons/crypto/passphraseagents Modified Files: ConsoleAgent.java ServletPassPhraseAgent.java Log Message: misc changes Index: ConsoleAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/ConsoleAgent.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConsoleAgent.java 31 Mar 2004 18:48:23 -0000 1.3 --- ConsoleAgent.java 31 Mar 2004 23:14:03 -0000 1.4 *************** *** 30,33 **** --- 30,36 ---- $Id$ $Log$ + Revision 1.4 2004/03/31 23:14:03 pelle + misc changes + Revision 1.3 2004/03/31 18:48:23 pelle Added various Streams for simplified crypto operations. |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:25:48
|
Update of /cvsroot/neuclear/neuclear-signer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29376 Modified Files: project.xml Log Message: misc changes Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-signer/project.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** project.xml 22 Dec 2003 22:14:11 -0000 1.7 --- project.xml 31 Mar 2004 23:13:55 -0000 1.8 *************** *** 4,8 **** <name>NeuClear Identity Personal Signer</name> <id>neuclear-signer</id> ! <currentVersion>0.8.1</currentVersion> <inceptionYear>2003</inceptionYear> <package>org.neuclear.signers.standalone</package> --- 4,8 ---- <name>NeuClear Identity Personal Signer</name> <id>neuclear-signer</id> ! <currentVersion>0.9-SNAPSHOT</currentVersion> <inceptionYear>2003</inceptionYear> <package>org.neuclear.signers.standalone</package> *************** *** 64,68 **** <id>neuclear-xmlsig</id> <name>neuclear-xmlsig</name> ! <version>0.11.1</version> <properties> <war.bundle>true</war.bundle> --- 64,68 ---- <id>neuclear-xmlsig</id> <name>neuclear-xmlsig</name> ! <version>0.12</version> <properties> <war.bundle>true</war.bundle> *************** *** 72,76 **** <id>neuclear-id</id> <name>neuclear-id</name> ! <version>0.8.1</version> <properties> <war.bundle>true</war.bundle> --- 72,76 ---- <id>neuclear-id</id> <name>neuclear-id</name> ! <version>0.9-SNAPSHOT</version> <properties> <war.bundle>true</war.bundle> *************** *** 80,84 **** <id>neuclear-commons</id> <name>neuclear-commons</name> ! <version>0.5.1</version> <properties> <war.bundle>true</war.bundle> --- 80,84 ---- <id>neuclear-commons</id> <name>neuclear-commons</name> ! <version>0.6.1-SNAPSHOT</version> <properties> <war.bundle>true</war.bundle> *************** *** 124,128 **** <version>0.8.1</version> </dependency> ! <dependency> <id>commons-cli</id> <name>commons-cli</name> --- 124,128 ---- <version>0.8.1</version> </dependency> ! <dependency> <id>commons-cli</id> <name>commons-cli</name> |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:25:47
|
Update of /cvsroot/neuclear/neuclear-signer/src/java/org/neuclear/signers/standalone In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29376/src/java/org/neuclear/signers/standalone Modified Files: StandaloneSigningServlet.java Log Message: misc changes Index: StandaloneSigningServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-signer/src/java/org/neuclear/signers/standalone/StandaloneSigningServlet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StandaloneSigningServlet.java 22 Dec 2003 22:14:10 -0000 1.5 --- StandaloneSigningServlet.java 31 Mar 2004 23:13:55 -0000 1.6 *************** *** 1,23 **** package org.neuclear.signers.standalone; - import org.neuclear.signers.servlet.SigningServlet; - import org.neuclear.commons.crypto.signers.Signer; - import org.neuclear.commons.crypto.signers.DefaultSigner; - import org.neuclear.commons.crypto.signers.InvalidPassphraseException; import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent; import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; ! import org.neuclear.commons.crypto.CryptoException; ! import org.neuclear.commons.NeuClearException; ! import org.neuclear.commons.Utility; import org.neuclear.commons.servlets.ServletTools; import javax.servlet.ServletConfig; import javax.servlet.ServletException; - import javax.servlet.ServletRequest; - import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import java.security.GeneralSecurityException; import java.io.IOException; import java.io.PrintWriter; --- 1,17 ---- package org.neuclear.signers.standalone; import org.neuclear.commons.crypto.passphraseagents.GuiDialogAgent; import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; ! import org.neuclear.commons.crypto.signers.DefaultSigner; ! import org.neuclear.commons.crypto.signers.InvalidPassphraseException; ! import org.neuclear.commons.crypto.signers.Signer; import org.neuclear.commons.servlets.ServletTools; + import org.neuclear.id.signers.SigningServlet; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; *************** *** 43,47 **** } ! protected String getTitle(){ return "NeuClear Personal Signing Service"; } --- 37,41 ---- } ! protected String getTitle() { return "NeuClear Personal Signing Service"; } *************** *** 56,63 **** protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); ! PrintWriter writer=response.getWriter(); ! ServletTools.printHeader(writer, request,"NeuClear Signing Servlet"); } private final InteractiveAgent agent; --- 50,58 ---- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); ! PrintWriter writer = response.getWriter(); ! ServletTools.printHeader(writer, request, "NeuClear Signing Servlet"); } + private final InteractiveAgent agent; |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:23
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28873/src/java/org/neuclear/ledger/hibernate Modified Files: HHeld.hbm.xml HHeld.java HHeldItem.java HTransaction.hbm.xml HTransaction.java HTransactionItem.java HibernateBookBrowser.java HibernateLedger.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: HHeldItem.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeldItem.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HHeldItem.java 23 Mar 2004 21:57:48 -0000 1.1 --- HHeldItem.java 31 Mar 2004 23:11:30 -0000 1.2 *************** *** 13,17 **** this.amount = amount; this.held = held; ! // this.heldId=held.getId(); } --- 13,17 ---- this.amount = amount; this.held = held; ! // this.heldId=held.getRequestId(); } Index: HibernateLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HibernateLedger.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** HibernateLedger.java 29 Mar 2004 16:57:00 -0000 1.11 --- HibernateLedger.java 31 Mar 2004 23:11:30 -0000 1.12 *************** *** 57,61 **** public PostedTransaction performTransaction(UnPostedTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { if (!trans.isBalanced()) ! throw new UnBalancedTransactionException(this, trans); try { Session ses = factory.openSession(); --- 57,61 ---- public PostedTransaction performTransaction(UnPostedTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { if (!trans.isBalanced()) ! throw new UnBalancedTransactionException(this, trans, trans.getBalance()); try { Session ses = factory.openSession(); *************** *** 80,84 **** public PostedTransaction performVerifiedTransfer(UnPostedTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { if (!trans.isBalanced()) ! throw new UnBalancedTransactionException(this, trans); try { Session ses = factory.openSession(); --- 80,84 ---- public PostedTransaction performVerifiedTransfer(UnPostedTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { if (!trans.isBalanced()) ! throw new UnBalancedTransactionException(this, trans, trans.getBalance()); try { Session ses = factory.openSession(); *************** *** 111,115 **** public PostedHeldTransaction performHeldTransfer(UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { if (!trans.isBalanced()) ! throw new UnBalancedTransactionException(this, trans); try { Session ses = factory.openSession(); --- 111,115 ---- public PostedHeldTransaction performHeldTransfer(UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { if (!trans.isBalanced()) ! throw new UnBalancedTransactionException(this, trans, trans.getBalance()); try { Session ses = factory.openSession(); *************** *** 139,143 **** Session ses = factory.openSession(); net.sf.hibernate.Transaction t = ses.beginTransaction(); ! HHeld posted = (HHeld) ses.get(HHeld.class, hold.getId()); if (posted != null) { --- 139,143 ---- Session ses = factory.openSession(); net.sf.hibernate.Transaction t = ses.beginTransaction(); ! HHeld posted = (HHeld) ses.get(HHeld.class, hold.getRequestId()); if (posted != null) { *************** *** 148,152 **** t.rollback(); ses.close(); ! throw new UnknownTransactionException(this, hold.getId()); } --- 148,152 ---- t.rollback(); ses.close(); ! throw new UnknownTransactionException(this, hold.getRequestId()); } *************** *** 177,185 **** Session ses = factory.openSession(); net.sf.hibernate.Transaction t = ses.beginTransaction(); ! HHeld posted = (HHeld) ses.get(HHeld.class, hold.getId()); if (posted == null) { t.rollback(); ses.close(); ! throw new UnknownTransactionException(this, hold.getId()); } final Date time = new Date(); --- 177,185 ---- Session ses = factory.openSession(); net.sf.hibernate.Transaction t = ses.beginTransaction(); ! HHeld posted = (HHeld) ses.get(HHeld.class, hold.getRequestId()); if (posted == null) { t.rollback(); ses.close(); ! throw new UnknownTransactionException(this, hold.getRequestId()); } final Date time = new Date(); *************** *** 188,192 **** throw new TransactionExpiredException(this, hold); } ! HTransaction htran = new HTransaction(posted, time); htran.setComment(comment); ses.save(htran); --- 188,192 ---- throw new TransactionExpiredException(this, hold); } ! HTransaction htran = new HTransaction(hold, time, amount); htran.setComment(comment); ses.save(htran); *************** *** 339,342 **** --- 339,360 ---- } + public void setReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { + try { + Session ses = factory.openSession(); + net.sf.hibernate.Transaction t = ses.beginTransaction(); + HTransaction tran = (HTransaction) ses.get(HTransaction.class, id); + if (tran == null) { + ses.close(); + throw new UnknownTransactionException(this, id); + } + tran.setReceipt(receipt); + t.commit(); + ses.close(); + } catch (HibernateException e) { + throw new LowlevelLedgerException(e); + } + + } + public double getTestBalance() throws LowlevelLedgerException { try { Index: HTransaction.hbm.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HTransaction.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HTransaction.hbm.xml 25 Mar 2004 16:45:08 -0000 1.3 --- HTransaction.hbm.xml 31 Mar 2004 23:11:30 -0000 1.4 *************** *** 14,20 **** <generator class="assigned"/> </id> ! <property name="requestId" type="string"> ! <column name="reqid" sql-type="char(32)" ! not-null="true"/> </property> <property name="transactionTime" type="timestamp"> --- 14,19 ---- <generator class="assigned"/> </id> ! <property name="receipt" type="string"> ! <column name="receipt" sql-type="char(32)"/> </property> <property name="transactionTime" type="timestamp"> Index: HHeld.hbm.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.hbm.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HHeld.hbm.xml 25 Mar 2004 21:40:45 -0000 1.5 --- HHeld.hbm.xml 31 Mar 2004 23:11:30 -0000 1.6 *************** *** 14,20 **** <generator class="assigned"/> </id> ! <property name="requestId"> ! <column name="reqid" sql-type="char(32)" ! not-null="true"/> </property> <property name="transactionTime" type="timestamp"> --- 14,19 ---- <generator class="assigned"/> </id> ! <property name="receipt"> ! <column name="receipt" sql-type="char(32)"/> </property> <property name="transactionTime" type="timestamp"> Index: HHeld.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HHeld.java 25 Mar 2004 21:40:45 -0000 1.3 --- HHeld.java 31 Mar 2004 23:11:30 -0000 1.4 *************** *** 21,26 **** public HHeld(UnPostedHeldTransaction tran, Date transactionTime) { ! this.id = tran.getId(); ! this.requestId = tran.getRequestId(); this.transactionTime = transactionTime; this.expiryTime = tran.getExpiryTime(); --- 21,25 ---- public HHeld(UnPostedHeldTransaction tran, Date transactionTime) { ! this.id = tran.getRequestId(); this.transactionTime = transactionTime; this.expiryTime = tran.getExpiryTime(); *************** *** 44,53 **** } ! public String getRequestId() { ! return requestId; } ! public void setRequestId(String requestId) { ! this.requestId = requestId; } --- 43,52 ---- } ! public String getReceipt() { ! return receipt; } ! public void setReceipt(String receipt) { ! this.receipt = receipt; } *************** *** 101,105 **** public PostedHeldTransaction createPosted() throws InvalidTransactionException { ! UnPostedHeldTransaction unp = new UnPostedHeldTransaction(requestId, id, comment, expiryTime); Iterator iter = items.iterator(); while (iter.hasNext()) { --- 100,104 ---- public PostedHeldTransaction createPosted() throws InvalidTransactionException { ! UnPostedHeldTransaction unp = new UnPostedHeldTransaction(id, comment, expiryTime); Iterator iter = items.iterator(); while (iter.hasNext()) { *************** *** 111,115 **** private String id; ! private String requestId; private Date transactionTime; private Date expiryTime; --- 110,114 ---- private String id; ! private String receipt; private Date transactionTime; private Date expiryTime; Index: HTransactionItem.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HTransactionItem.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HTransactionItem.java 23 Mar 2004 21:57:48 -0000 1.1 --- HTransactionItem.java 31 Mar 2004 23:11:30 -0000 1.2 *************** *** 13,17 **** this.amount = amount; this.transaction = tran; ! // this.transactionId=tran.getId(); } --- 13,17 ---- this.amount = amount; this.transaction = tran; ! // this.transactionId=tran.getRequestId(); } Index: HibernateBookBrowser.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HibernateBookBrowser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HibernateBookBrowser.java 26 Mar 2004 23:36:50 -0000 1.2 --- HibernateBookBrowser.java 31 Mar 2004 23:11:30 -0000 1.3 *************** *** 26,29 **** --- 26,34 ---- $Id$ $Log$ + Revision 1.3 2004/03/31 23:11:30 pelle + Reworked the ID's of the transactions. The primary ID is now the request ID. + Receipt ID's are optional and added using a separate set method. + The various interactive passphrase agents now have shell methods for the new interactive approach. + Revision 1.2 2004/03/26 23:36:50 pelle The simple browse(book) now works on hibernate, I have implemented the other two, which currently don not constrain the query correctly. *************** *** 58,62 **** } } ! setRow(tran.getId(), tran.getRequestId(), counterparty, tran.getComment(), tran.getTransactionTime(), item.getAmount(), null, null, null); return true; } --- 63,67 ---- } } ! setRow(tran.getId(), counterparty, tran.getComment(), tran.getTransactionTime(), item.getAmount(), null, null, null); return true; } Index: HTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HTransaction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HTransaction.java 25 Mar 2004 21:40:45 -0000 1.5 --- HTransaction.java 31 Mar 2004 23:11:30 -0000 1.6 *************** *** 1,8 **** package org.neuclear.ledger.hibernate; ! import org.neuclear.ledger.InvalidTransactionException; ! import org.neuclear.ledger.PostedTransaction; ! import org.neuclear.ledger.TransactionItem; ! import org.neuclear.ledger.UnPostedTransaction; import java.util.*; --- 1,5 ---- package org.neuclear.ledger.hibernate; ! import org.neuclear.ledger.*; import java.util.*; *************** *** 21,26 **** public HTransaction(UnPostedTransaction unp, Date transactionTime) { ! this.id = unp.getId(); ! this.requestId = unp.getRequestId(); this.transactionTime = transactionTime; this.comment = unp.getComment(); --- 18,22 ---- public HTransaction(UnPostedTransaction unp, Date transactionTime) { ! this.id = unp.getRequestId(); this.transactionTime = transactionTime; this.comment = unp.getComment(); *************** *** 33,45 **** } ! public HTransaction(HHeld held, Date transactionTime) { ! this.id = held.getId(); ! this.requestId = held.getRequestId(); this.transactionTime = transactionTime; this.comment = held.getComment(); this.items = new HashSet(); ! Iterator iter = held.getItems().iterator(); while (iter.hasNext()) { ! HHeldItem item = (HHeldItem) iter.next(); items.add(new HTransactionItem(this, item.getBook(), item.getAmount())); } --- 29,40 ---- } ! public HTransaction(final PostedHeldTransaction held, final Date transactionTime, final double amount) throws ExceededHeldAmountException, UnBalancedTransactionException { ! this.id = held.getRequestId(); this.transactionTime = transactionTime; this.comment = held.getComment(); this.items = new HashSet(); ! Iterator iter = held.getAdjustedItems(amount).iterator(); while (iter.hasNext()) { ! TransactionItem item = (TransactionItem) iter.next(); items.add(new HTransactionItem(this, item.getBook(), item.getAmount())); } *************** *** 54,63 **** } ! public String getRequestId() { ! return requestId; } ! public void setRequestId(String requestId) { ! this.requestId = requestId; } --- 49,58 ---- } ! public String getReceipt() { ! return receipt; } ! public void setReceipt(String receipt) { ! this.receipt = receipt; } *************** *** 87,91 **** public PostedTransaction createPosted() throws InvalidTransactionException { ! UnPostedTransaction unp = new UnPostedTransaction(requestId, id, comment); Iterator iter = items.iterator(); while (iter.hasNext()) { --- 82,86 ---- public PostedTransaction createPosted() throws InvalidTransactionException { ! UnPostedTransaction unp = new UnPostedTransaction(id, comment); Iterator iter = items.iterator(); while (iter.hasNext()) { *************** *** 97,101 **** private String id; ! private String requestId; private Date transactionTime; private String comment; --- 92,96 ---- private String id; ! private String receipt; private Date transactionTime; private String comment; |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:14
|
Update of /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28829/src/java/org/neuclear/ledger/prevalent Modified Files: AccountHeld.java BalanceTable.java CompleteHeldTransaction.java HoldTable.java PostHeldTransaction.java PostTransaction.java PostVerifiedTransfer.java PrevalentLedger.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: PostHeldTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PostHeldTransaction.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PostHeldTransaction.java 22 Mar 2004 17:27:11 -0000 1.1.1.1 --- PostHeldTransaction.java 31 Mar 2004 23:11:20 -0000 1.2 *************** *** 1,6 **** package org.neuclear.ledger.prevalent; - import org.prevayler.TransactionWithQuery; import org.neuclear.ledger.*; import java.util.Date; --- 1,6 ---- package org.neuclear.ledger.prevalent; import org.neuclear.ledger.*; + import org.prevayler.TransactionWithQuery; import java.util.Date; *************** *** 14,18 **** * To change this template use File | Settings | File Templates. */ ! public class PostHeldTransaction implements TransactionWithQuery{ final UnPostedHeldTransaction tran; --- 14,18 ---- * To change this template use File | Settings | File Templates. */ ! public class PostHeldTransaction implements TransactionWithQuery { final UnPostedHeldTransaction tran; *************** *** 31,48 **** */ public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception { ! LedgerSystem system=(LedgerSystem) prevalentSystem; ! HoldTable table=system.getHoldTable(); ! if (table.exists(tran.getId())) ! throw new TransactionExistsException(null,tran.getId()); if (table.exists(tran.getRequestId())) ! throw new TransactionExistsException(null,tran.getRequestId()); ! Iterator iter=tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (system.getAvailableBalance(item.getBook())+item.getAmount()<0) ! throw new InsufficientFundsException(null,item.getBook(),item.getAmount()); } ! PostedHeldTransaction posted=new PostedHeldTransaction(tran,executionTime); table.add(posted); return posted; --- 31,48 ---- */ public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception { ! LedgerSystem system = (LedgerSystem) prevalentSystem; ! HoldTable table = system.getHoldTable(); if (table.exists(tran.getRequestId())) ! throw new TransactionExistsException(null, tran.getRequestId()); ! // if (table.exists(tran.getReceiptId())) ! // throw new TransactionExistsException(null,tran.getReceiptId()); ! Iterator iter = tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (system.getAvailableBalance(item.getBook()) + item.getAmount() < 0) ! throw new InsufficientFundsException(null, item.getBook(), item.getAmount()); } ! PostedHeldTransaction posted = new PostedHeldTransaction(tran, executionTime); table.add(posted); return posted; Index: CompleteHeldTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/CompleteHeldTransaction.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CompleteHeldTransaction.java 22 Mar 2004 17:27:10 -0000 1.1.1.1 --- CompleteHeldTransaction.java 31 Mar 2004 23:11:20 -0000 1.2 *************** *** 1,6 **** package org.neuclear.ledger.prevalent; import org.prevayler.TransactionWithQuery; - import org.neuclear.ledger.*; import java.util.Date; --- 1,9 ---- package org.neuclear.ledger.prevalent; + import org.neuclear.ledger.PostedHeldTransaction; + import org.neuclear.ledger.PostedTransaction; + import org.neuclear.ledger.TransactionExistsException; + import org.neuclear.ledger.TransactionItem; import org.prevayler.TransactionWithQuery; import java.util.Date; *************** *** 14,18 **** * To change this template use File | Settings | File Templates. */ ! public class CompleteHeldTransaction implements TransactionWithQuery{ final PostedHeldTransaction tran; --- 17,21 ---- * To change this template use File | Settings | File Templates. */ ! public class CompleteHeldTransaction implements TransactionWithQuery { final PostedHeldTransaction tran; *************** *** 20,27 **** final String comment; ! CompleteHeldTransaction(final PostedHeldTransaction tran,final double amount, final String comment) { this.tran = tran; ! this.amount=amount; ! this.comment=comment; } --- 23,30 ---- final String comment; ! CompleteHeldTransaction(final PostedHeldTransaction tran, final double amount, final String comment) { this.tran = tran; ! this.amount = amount; ! this.comment = comment; } *************** *** 34,56 **** */ public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception { ! LedgerSystem system=(LedgerSystem) prevalentSystem; ! TransactionTable table=system.getTransactionTable(); ! if (table.exists(tran.getId())) ! throw new TransactionExistsException(null,tran.getId()); if (table.exists(tran.getRequestId())) ! throw new TransactionExistsException(null,tran.getRequestId()); ! ! HoldTable holds=system.getHoldTable(); holds.expire(tran); ! table.register(tran.getId(),executionTime); ! table.register(tran.getRequestId(),executionTime); ! Iterator iter=tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! system.getBalanceTable().add(item.getBook(),item.getAmount()); } ! return new PostedTransaction(tran,executionTime,amount,comment); } } --- 37,55 ---- */ public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception { ! LedgerSystem system = (LedgerSystem) prevalentSystem; ! TransactionTable table = system.getTransactionTable(); if (table.exists(tran.getRequestId())) ! throw new TransactionExistsException(null, tran.getRequestId()); ! HoldTable holds = system.getHoldTable(); holds.expire(tran); ! table.register(tran.getRequestId(), executionTime); ! Iterator iter = tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! system.getBalanceTable().add(item.getBook(), item.getAmount()); } ! return new PostedTransaction(tran, executionTime, amount, comment); } } Index: AccountHeld.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/AccountHeld.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** AccountHeld.java 22 Mar 2004 17:27:11 -0000 1.1.1.1 --- AccountHeld.java 31 Mar 2004 23:11:20 -0000 1.2 *************** *** 5,12 **** import java.io.Serializable; - import java.util.List; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; /** --- 5,12 ---- import java.io.Serializable; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; + import java.util.List; /** *************** *** 18,22 **** */ public class AccountHeld implements Serializable { ! private List holds= new ArrayList(1); private HoldTable holdtable; private String id; --- 18,22 ---- */ public class AccountHeld implements Serializable { ! private List holds = new ArrayList(1); private HoldTable holdtable; private String id; *************** *** 26,59 **** this.id = id; } ! public void add(final PostedHeldTransaction tran){ holds.add(tran); } ! double getBalance(){ ! final Date current=new Date(); ! Iterator iter=holds.iterator(); ! double balance=0; ! PostedHeldTransaction expired=null; while (iter.hasNext()) { PostedHeldTransaction transaction = (PostedHeldTransaction) iter.next(); ! if (transaction.getExpiryTime().after(current)){ ! Iterator items=transaction.getItems(); while (items.hasNext()) { TransactionItem item = (TransactionItem) items.next(); ! if(item.getBook().equals(id)&&item.getAmount()<0) ! balance+=item.getAmount(); } } else { ! expired=transaction; } } ! if (expired!=null) holdtable.expire(expired); return balance; } ! void expire(final PostedHeldTransaction dead){ for (int i = 0; i < holds.size(); i++) { PostedHeldTransaction transaction = (PostedHeldTransaction) holds.get(i); ! if (transaction.getId().equals(dead.getId())){ holds.remove(i); return; --- 26,61 ---- this.id = id; } ! ! public void add(final PostedHeldTransaction tran) { holds.add(tran); } ! double getBalance() { ! final Date current = new Date(); ! Iterator iter = holds.iterator(); ! double balance = 0; ! PostedHeldTransaction expired = null; while (iter.hasNext()) { PostedHeldTransaction transaction = (PostedHeldTransaction) iter.next(); ! if (transaction.getExpiryTime().after(current)) { ! Iterator items = transaction.getItems(); while (items.hasNext()) { TransactionItem item = (TransactionItem) items.next(); ! if (item.getBook().equals(id) && item.getAmount() < 0) ! balance += item.getAmount(); } } else { ! expired = transaction; } } ! if (expired != null) holdtable.expire(expired); return balance; } ! ! void expire(final PostedHeldTransaction dead) { for (int i = 0; i < holds.size(); i++) { PostedHeldTransaction transaction = (PostedHeldTransaction) holds.get(i); ! if (transaction.getRequestId().equals(dead.getRequestId())) { holds.remove(i); return; *************** *** 63,67 **** holds.remove(dead); } ! int getHoldCount(){ return holds.size(); } --- 65,70 ---- holds.remove(dead); } ! ! int getHoldCount() { return holds.size(); } Index: PrevalentLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PrevalentLedger.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PrevalentLedger.java 25 Mar 2004 16:44:43 -0000 1.3 --- PrevalentLedger.java 31 Mar 2004 23:11:20 -0000 1.4 *************** *** 168,171 **** --- 168,175 ---- } + public void setReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { + + } + /** * Cancels a Held Transaction. Index: BalanceTable.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/BalanceTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BalanceTable.java 25 Mar 2004 16:44:42 -0000 1.2 --- BalanceTable.java 31 Mar 2004 23:11:20 -0000 1.3 *************** *** 3,7 **** import gnu.trove.TDoubleProcedure; import gnu.trove.TObjectDoubleHashMap; - import org.neuclear.ledger.LowlevelLedgerException; import java.io.Serializable; --- 3,6 ---- *************** *** 26,30 **** } ! double getTestBalance() throws LowlevelLedgerException { TestBalanceCalculator calc = new TestBalanceCalculator(); balances.forEachValue(calc); --- 25,29 ---- } ! double getTestBalance() { TestBalanceCalculator calc = new TestBalanceCalculator(); balances.forEachValue(calc); Index: PostTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PostTransaction.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PostTransaction.java 22 Mar 2004 17:27:16 -0000 1.1.1.1 --- PostTransaction.java 31 Mar 2004 23:11:20 -0000 1.2 *************** *** 1,6 **** package org.neuclear.ledger.prevalent; import org.prevayler.TransactionWithQuery; - import org.neuclear.ledger.*; import java.util.Date; --- 1,9 ---- package org.neuclear.ledger.prevalent; + import org.neuclear.ledger.PostedTransaction; + import org.neuclear.ledger.TransactionExistsException; + import org.neuclear.ledger.TransactionItem; + import org.neuclear.ledger.UnPostedTransaction; import org.prevayler.TransactionWithQuery; import java.util.Date; *************** *** 14,18 **** * To change this template use File | Settings | File Templates. */ ! public class PostTransaction implements TransactionWithQuery{ final UnPostedTransaction tran; --- 17,21 ---- * To change this template use File | Settings | File Templates. */ ! public class PostTransaction implements TransactionWithQuery { final UnPostedTransaction tran; *************** *** 31,51 **** */ public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception { ! LedgerSystem system=(LedgerSystem) prevalentSystem; ! TransactionTable table=system.getTransactionTable(); ! if (table.exists(tran.getId())) ! throw new TransactionExistsException(null,tran.getId()); if (table.exists(tran.getRequestId())) ! throw new TransactionExistsException(null,tran.getRequestId()); ! table.register(tran.getId(),executionTime); ! table.register(tran.getRequestId(),executionTime); ! Iterator iter=tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! system.getBalanceTable().add(item.getBook(),item.getAmount()); } ! return new PostedTransaction(tran,executionTime); } } --- 34,54 ---- */ public Object executeAndQuery(Object prevalentSystem, Date executionTime) throws Exception { ! LedgerSystem system = (LedgerSystem) prevalentSystem; ! TransactionTable table = system.getTransactionTable(); if (table.exists(tran.getRequestId())) ! throw new TransactionExistsException(null, tran.getRequestId()); ! // if (table.exists(tran.getReceiptId())) ! // throw new TransactionExistsException(null,tran.getReceiptId()); ! table.register(tran.getRequestId(), executionTime); ! // table.register(tran.getReceiptId(),executionTime); ! Iterator iter = tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! system.getBalanceTable().add(item.getBook(), item.getAmount()); } ! return new PostedTransaction(tran, executionTime); } } Index: PostVerifiedTransfer.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PostVerifiedTransfer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PostVerifiedTransfer.java 24 Mar 2004 23:13:12 -0000 1.2 --- PostVerifiedTransfer.java 31 Mar 2004 23:11:20 -0000 1.3 *************** *** 33,40 **** LedgerSystem system = (LedgerSystem) prevalentSystem; TransactionTable table = system.getTransactionTable(); - if (table.exists(tran.getId())) - throw new TransactionExistsException(null, tran.getId()); if (table.exists(tran.getRequestId())) throw new TransactionExistsException(null, tran.getRequestId()); Iterator iter = tran.getItems(); --- 33,40 ---- LedgerSystem system = (LedgerSystem) prevalentSystem; TransactionTable table = system.getTransactionTable(); if (table.exists(tran.getRequestId())) throw new TransactionExistsException(null, tran.getRequestId()); + // if (table.exists(tran.getReceiptId())) + // throw new TransactionExistsException(null, tran.getReceiptId()); Iterator iter = tran.getItems(); *************** *** 47,52 **** } // We're ok so lets register them. - table.register(tran.getId(), executionTime); table.register(tran.getRequestId(), executionTime); // Now modify the balances --- 47,52 ---- } // We're ok so lets register them. table.register(tran.getRequestId(), executionTime); + // table.register(tran.getReceiptId(), executionTime); // Now modify the balances Index: HoldTable.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/HoldTable.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HoldTable.java 22 Mar 2004 17:27:11 -0000 1.1.1.1 --- HoldTable.java 31 Mar 2004 23:11:20 -0000 1.2 *************** *** 1,5 **** package org.neuclear.ledger.prevalent; ! import gnu.trove.TObjectDoubleHashMap; import java.io.Serializable; --- 1,7 ---- package org.neuclear.ledger.prevalent; ! import org.neuclear.ledger.PostedHeldTransaction; ! import org.neuclear.ledger.TransactionExistsException; ! import org.neuclear.ledger.TransactionItem; import java.io.Serializable; *************** *** 7,65 **** import java.util.Iterator; - import org.neuclear.ledger.PostedHeldTransaction; - import org.neuclear.ledger.TransactionItem; - import org.neuclear.ledger.TransactionExistsException; - /** * This contains the balances of all the accounts */ ! public final class HoldTable implements Serializable{ ! private final HashMap accounts=new HashMap(); ! private final HashMap transactions=new HashMap(); ! double getHeldBalance(final String id){ if (!accounts.containsKey(id)) return 0; ! return ((AccountHeld)accounts.get(id)).getBalance(); } ! public boolean exists(String id){ return transactions.containsKey(id); } ! public PostedHeldTransaction get(String id){ return (PostedHeldTransaction) transactions.get(id); } void add(PostedHeldTransaction tran) throws TransactionExistsException { ! if (transactions.containsKey(tran.getId())) ! throw new TransactionExistsException(null,tran.getId()); ! Iterator items=tran.getItems(); while (items.hasNext()) { TransactionItem item = (TransactionItem) items.next(); ! AccountHeld held=(AccountHeld) accounts.get(item.getBook()); ! if (held==null){ ! held=new AccountHeld(this,item.getBook()); ! accounts.put(item.getBook(),held); } held.add(tran); } ! transactions.put(tran.getId(),tran); } public void expire(PostedHeldTransaction tran) { ! if (!transactions.containsKey(tran.getId())) return; System.out.println("expire"); ! Iterator items=tran.getItems(); while (items.hasNext()) { TransactionItem item = (TransactionItem) items.next(); ! AccountHeld held=(AccountHeld) accounts.get(item.getBook()); ! if (held!=null){ held.expire(tran); ! if (held.getHoldCount()==0) accounts.remove(item.getBook()); } } ! transactions.remove(tran.getId()); } --- 9,65 ---- import java.util.Iterator; /** * This contains the balances of all the accounts */ ! public final class HoldTable implements Serializable { ! private final HashMap accounts = new HashMap(); ! private final HashMap transactions = new HashMap(); ! double getHeldBalance(final String id) { if (!accounts.containsKey(id)) return 0; ! return ((AccountHeld) accounts.get(id)).getBalance(); } ! public boolean exists(String id) { return transactions.containsKey(id); } ! ! public PostedHeldTransaction get(String id) { return (PostedHeldTransaction) transactions.get(id); } + void add(PostedHeldTransaction tran) throws TransactionExistsException { ! if (transactions.containsKey(tran.getRequestId())) ! throw new TransactionExistsException(null, tran.getRequestId()); ! Iterator items = tran.getItems(); while (items.hasNext()) { TransactionItem item = (TransactionItem) items.next(); ! AccountHeld held = (AccountHeld) accounts.get(item.getBook()); ! if (held == null) { ! held = new AccountHeld(this, item.getBook()); ! accounts.put(item.getBook(), held); } held.add(tran); } ! transactions.put(tran.getRequestId(), tran); } public void expire(PostedHeldTransaction tran) { ! if (!transactions.containsKey(tran.getRequestId())) return; System.out.println("expire"); ! Iterator items = tran.getItems(); while (items.hasNext()) { TransactionItem item = (TransactionItem) items.next(); ! AccountHeld held = (AccountHeld) accounts.get(item.getBook()); ! if (held != null) { held.expire(tran); ! if (held.getHoldCount() == 0) accounts.remove(item.getBook()); } } ! transactions.remove(tran.getRequestId()); } |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:03
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/java/org/neuclear/ledger Modified Files: Ledger.java LedgerController.java PostedHeldTransaction.java PostedTransaction.java Transaction.java TransactionExpiredException.java UnBalancedTransactionException.java UnPostedHeldTransaction.java UnPostedTransaction.java Added Files: ExceededHeldAmountException.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: PostedHeldTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/PostedHeldTransaction.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PostedHeldTransaction.java 25 Mar 2004 19:03:23 -0000 1.7 --- PostedHeldTransaction.java 31 Mar 2004 23:11:10 -0000 1.8 *************** *** 1,5 **** --- 1,7 ---- package org.neuclear.ledger; + import java.util.ArrayList; import java.util.Date; + import java.util.List; /** *************** *** 18,21 **** --- 20,44 ---- } + public List getAdjustedItems(final double amount) throws ExceededHeldAmountException, UnBalancedTransactionException { + final double origAmount = getAmount(); + if (amount > origAmount) + throw new ExceededHeldAmountException(this, amount); + final List ol = getItemList(); + + final List nl = new ArrayList(ol.size()); + + final double ratio = amount / origAmount; + double balance = 0; + for (int i = 0; i < ol.size(); i++) { + TransactionItem item = (TransactionItem) ol.get(i); + final double itemamount = item.getAmount() * ratio; + nl.add(new TransactionItem(item.getBook(), itemamount)); + balance += itemamount; + } + if (balance != 0) + throw new UnBalancedTransactionException(null, this, balance); + return nl; + } + final private Date expiryTime; Index: Ledger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/Ledger.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Ledger.java 25 Mar 2004 16:44:22 -0000 1.14 --- Ledger.java 31 Mar 2004 23:11:10 -0000 1.15 *************** *** 4,7 **** --- 4,12 ---- * $Id$ * $Log$ + * Revision 1.15 2004/03/31 23:11:10 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.14 2004/03/25 16:44:22 pelle * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. *************** *** 270,273 **** --- 275,280 ---- public abstract PostedHeldTransaction findHeldTransaction(String idstring) throws LowlevelLedgerException, UnknownTransactionException; + public abstract void setReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException; + public abstract double getTestBalance() throws LowlevelLedgerException; *************** *** 276,281 **** } ! public final PostedTransaction transfer(String req, String id, String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException { ! UnPostedTransaction tran = new UnPostedTransaction(req, id, comment); tran.addItem(from, -amount); tran.addItem(to, amount); --- 283,288 ---- } ! public final PostedTransaction transfer(String req, String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException { ! UnPostedTransaction tran = new UnPostedTransaction(req, comment); tran.addItem(from, -amount); tran.addItem(to, amount); *************** *** 284,292 **** public final PostedTransaction transfer(String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException { ! return transfer(CryptoTools.createRandomID(), CryptoTools.createRandomID(), from, to, amount, comment); } ! public final PostedTransaction verifiedTransfer(String req, String id, String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException, InsufficientFundsException { ! UnPostedTransaction tran = new UnPostedTransaction(req, id, comment); tran.addItem(from, -amount); tran.addItem(to, amount); --- 291,299 ---- public final PostedTransaction transfer(String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException { ! return transfer(CryptoTools.createRandomID(), from, to, amount, comment); } ! public final PostedTransaction verifiedTransfer(String req, String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException, InsufficientFundsException { ! UnPostedTransaction tran = new UnPostedTransaction(req, comment); tran.addItem(from, -amount); tran.addItem(to, amount); *************** *** 295,303 **** public final PostedTransaction verifiedTransfer(String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException, InsufficientFundsException { ! return verifiedTransfer(CryptoTools.createRandomID(), CryptoTools.createRandomID(), from, to, amount, comment); } ! public final PostedHeldTransaction hold(String req, String id, String from, String to, Date expiry, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException, InsufficientFundsException { ! UnPostedHeldTransaction tran = new UnPostedHeldTransaction(req, id, comment, expiry); tran.addItem(from, -amount); tran.addItem(to, amount); --- 302,310 ---- public final PostedTransaction verifiedTransfer(String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException, InsufficientFundsException { ! return verifiedTransfer(CryptoTools.createRandomID(), from, to, amount, comment); } ! public final PostedHeldTransaction hold(String req, String from, String to, Date expiry, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException, InsufficientFundsException { ! UnPostedHeldTransaction tran = new UnPostedHeldTransaction(req, comment, expiry); tran.addItem(from, -amount); tran.addItem(to, amount); *************** *** 308,312 **** if (getAvailableBalance(from) - amount < 0) throw new InsufficientFundsException(this, from, amount); ! return hold(CryptoTools.createRandomID(), CryptoTools.createRandomID(), from, to, expiry, amount, comment); } --- 315,319 ---- if (getAvailableBalance(from) - amount < 0) throw new InsufficientFundsException(this, from, amount); ! return hold(CryptoTools.createRandomID(), from, to, expiry, amount, comment); } Index: LedgerController.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/LedgerController.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LedgerController.java 29 Mar 2004 23:43:29 -0000 1.1 --- LedgerController.java 31 Mar 2004 23:11:10 -0000 1.2 *************** *** 1,4 **** --- 1,6 ---- package org.neuclear.ledger; + import java.util.Date; + /* NeuClear Distributed Transaction Clearing Platform *************** *** 21,24 **** --- 23,31 ---- $Id$ $Log$ + Revision 1.2 2004/03/31 23:11:10 pelle + Reworked the ID's of the transactions. The primary ID is now the request ID. + Receipt ID's are optional and added using a separate set method. + The various interactive passphrase agents now have shell methods for the new interactive approach. + Revision 1.1 2004/03/29 23:43:29 pelle The servlets now work and display the ledger contents. *************** *** 31,43 **** * Time: 9:35:30 PM */ ! public class LedgerController { ! public Ledger add(String id){ ! return null; ! } ! public Ledger get(String id) { ! return null; ! } ! public boolean exists(String id){ ! return false; ! } } --- 38,162 ---- * Time: 9:35:30 PM */ ! public abstract class LedgerController { ! public abstract void createLedger(String id); ! ! public abstract boolean ledgerExists(String id); ! ! /** ! * The basic interface for creating Transactions in the database. ! * The implementing class takes this transacion information and stores it with an automatically generated uniqueid. ! * ! * @param trans Transaction to perform ! * @return The reference to the transaction ! */ ! public abstract PostedTransaction performTransaction(UnPostedTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException; ! ! /** ! * Similar to a transaction but guarantees that there wont be any negative balances left after the transaction. ! * ! * @param trans Transaction to perform ! * @return The reference to the transaction ! */ ! public abstract PostedTransaction performVerifiedTransfer(UnPostedTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException; ! ! /** ! * The basic interface for creating Transactions in the database. ! * The implementing class takes this transacion information and stores it with an automatically generated uniqueid. ! * This transaction guarantees to not leave a negative balance in any account. ! * ! * @param trans Transaction to perform ! */ ! public abstract PostedHeldTransaction performHeldTransfer(UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException; ! ! /** ! * Cancels a Held Transaction. ! * ! * @param hold ! * @throws org.neuclear.ledger.LowlevelLedgerException ! * ! * @throws org.neuclear.ledger.UnknownTransactionException ! * ! */ ! public abstract void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException; ! ! /** ! * Completes a held transaction. Which means: ! * cancelling the hold and performing the transfer with the given updated amount and comment. ! * ! * @param hold HeldTransaction to complete ! * @param amount The updatd amount. It must be <= than the amount of the hold ! * @param comment ! * @return ! * @throws InvalidTransactionException ! * @throws LowlevelLedgerException ! * @throws TransactionExpiredException ! */ ! public abstract PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException; ! ! /** ! * Searches for a Transaction based on its Transaction ID ! * ! * @param id A valid ID ! * @return The Transaction object ! */ ! public abstract Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException, InvalidTransactionException, UnknownBookException; ! ! /** ! * Calculate the true accounting balance at a given time. This does not take into account any held transactions, thus may not necessarily ! * show the Available balance.<p> ! * Example sql for implementors: <pre> ! * select c.credit - d.debit from ! * ( ! * select sum(amount) as credit ! * from ledger ! * where transactiondate <= sysdate and end_date is null and credit= 'neu://BOB' ! * ) c, ! * ( ! * select sum(amount) as debit ! * from ledger ! * where transactiondate <= sysdate and end_date is null and debit= 'neu://BOB' ! * ) d ! * <p/> ! * </pre> ! * ! * @return the balance as a double ! */ ! ! public abstract double getBalance(String book) throws LowlevelLedgerException; ! ! /** ! * Calculate the available balance at a given time. This DOES take into account any held transactions. ! * Example sql for implementors: <pre> ! * select c.credit - d.debit from ! * ( ! * select sum(amount) as credit ! * from ledger ! * where transactiondate <= sysdate and (end_date is null or end_date>= sysdate) and credit= 'neu://BOB' ! * ) c, ! * ( ! * select sum(amount) as debit ! * from ledger ! * where transactiondate <= sysdate and end_date is null and debit= 'neu://BOB' ! * ) d ! * <p/> ! * </pre> ! * ! * @return the balance as a double ! */ ! ! public abstract double getAvailableBalance(String book) throws LowlevelLedgerException; ! ! /** ! * Searches for a Held Transaction based on its Transaction ID ! * ! * @param idstring A valid ID ! * @return The Transaction object ! */ ! public abstract PostedHeldTransaction findHeldTransaction(String idstring) throws LowlevelLedgerException, UnknownTransactionException; ! ! public abstract double getTestBalance() throws LowlevelLedgerException; ! ! public abstract void close() throws LowlevelLedgerException; ! ! } Index: Transaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/Transaction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Transaction.java 23 Mar 2004 22:01:43 -0000 1.6 --- Transaction.java 31 Mar 2004 23:11:10 -0000 1.7 *************** *** 4,7 **** --- 4,12 ---- * $Id$ * $Log$ + * Revision 1.7 2004/03/31 23:11:10 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.6 2004/03/23 22:01:43 pelle * Bumped version numbers for commons and xmlsig througout. *************** *** 69,75 **** */ public abstract class Transaction implements Serializable { ! protected Transaction(final String req, final String id, final String comment, List items) throws InvalidTransactionException { this.comment = comment; - this.id = id; this.req = req; this.items = items; --- 74,79 ---- */ public abstract class Transaction implements Serializable { ! protected Transaction(final String req, final String comment, List items) { this.comment = comment; this.req = req; this.items = items; *************** *** 85,92 **** ! public String getId() { ! return id; ! } ! public String getRequestId() { return req; --- 89,97 ---- ! /** ! * The ID of the Request. ! * ! * @return ! */ public String getRequestId() { return req; *************** *** 97,103 **** } private final String comment; - private final String id; private final String req; protected final List items; --- 102,120 ---- } + public final double getAmount() { + + double amount = 0; + for (int i = 0; i < items.size(); i++) { + TransactionItem item = (TransactionItem) items.get(i); + if (item.getAmount() >= 0) { + amount += item.getAmount(); + } + } + return amount; + } + private final String comment; private final String req; + protected final List items; Index: UnBalancedTransactionException.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/UnBalancedTransactionException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UnBalancedTransactionException.java 25 Mar 2004 19:03:23 -0000 1.3 --- UnBalancedTransactionException.java 31 Mar 2004 23:11:10 -0000 1.4 *************** *** 9,20 **** */ public final class UnBalancedTransactionException extends InvalidTransactionException { ! public UnBalancedTransactionException(final Ledger ledger, final UnPostedTransaction tran) { ! super(ledger, "Transaction was Unbalanced by: " + tran.getBalance()); transaction = tran; } ! private final UnPostedTransaction transaction; ! public final UnPostedTransaction getTransaction() { return transaction; } --- 9,20 ---- */ public final class UnBalancedTransactionException extends InvalidTransactionException { ! public UnBalancedTransactionException(final Ledger ledger, final Transaction tran, final double amount) { ! super(ledger, "Transaction was Unbalanced by: " + amount); transaction = tran; } ! private final Transaction transaction; ! public final Transaction getTransaction() { return transaction; } --- NEW FILE: ExceededHeldAmountException.java --- package org.neuclear.ledger; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: ExceededHeldAmountException.java,v 1.1 2004/03/31 23:11:10 pelle Exp $ $Log: ExceededHeldAmountException.java,v $ Revision 1.1 2004/03/31 23:11:10 pelle Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. */ /** * User: pelleb * Date: Mar 31, 2004 * Time: 9:33:02 PM */ public class ExceededHeldAmountException extends InvalidTransactionException { public ExceededHeldAmountException(final PostedHeldTransaction tran, final double amount) { super(null, "Invalid Amount for Held Transaction: " + amount + " is higher than held amount: " + tran.getAmount()); } } Index: UnPostedTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/UnPostedTransaction.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UnPostedTransaction.java 21 Mar 2004 00:48:36 -0000 1.8 --- UnPostedTransaction.java 31 Mar 2004 23:11:10 -0000 1.9 *************** *** 8,11 **** --- 8,16 ---- * $Id$ * $Log$ + * Revision 1.9 2004/03/31 23:11:10 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.8 2004/03/21 00:48:36 pelle * The problem with Enveloped signatures has now been fixed. It was a problem in the way transforms work. I have bandaided it, but in the future if better support for transforms need to be made, we need to rethink it a bit. Perhaps using the new crypto channel's in neuclear-commons. *************** *** 83,88 **** * @param comment */ ! public UnPostedTransaction(final String req, final String id, final String comment) throws InvalidTransactionException { ! super(req, id, comment, new ArrayList(2)); balance = 0; --- 88,93 ---- * @param comment */ ! public UnPostedTransaction(final String req, final String comment) throws InvalidTransactionException { ! super(req, comment, new ArrayList(2)); balance = 0; Index: TransactionExpiredException.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/TransactionExpiredException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TransactionExpiredException.java 21 Mar 2004 00:48:36 -0000 1.3 --- TransactionExpiredException.java 31 Mar 2004 23:11:10 -0000 1.4 *************** *** 21,25 **** public final String getSubMessage() { ! return "Transaction: " + transaction.getId() + " expired: " + transaction.getExpiryTime(); } } --- 21,25 ---- public final String getSubMessage() { ! return "Transaction: " + transaction.getRequestId() + " expired: " + transaction.getExpiryTime(); } } Index: PostedTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/PostedTransaction.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** PostedTransaction.java 25 Mar 2004 19:03:23 -0000 1.8 --- PostedTransaction.java 31 Mar 2004 23:11:10 -0000 1.9 *************** *** 8,11 **** --- 8,16 ---- * $Id$ * $Log$ + * Revision 1.9 2004/03/31 23:11:10 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.8 2004/03/25 19:03:23 pelle * PostedTransaction and friend now verify the unpostedtransaction is balanced. *************** *** 80,92 **** */ public PostedTransaction(final UnPostedTransaction orig, final Date time) throws InvalidTransactionException, UnBalancedTransactionException { ! super(orig.getRequestId(), orig.getId(), orig.getComment(), orig.getItemList()); if (!orig.isBalanced()) ! throw new UnBalancedTransactionException(null, orig); this.transactionTime = time; } ! public PostedTransaction(final PostedHeldTransaction orig, final Date time, final double amount, final String comment) throws InvalidTransactionException { ! super(orig.getRequestId(), orig.getId(), comment, orig.getItemList()); this.transactionTime = time; } --- 85,97 ---- */ public PostedTransaction(final UnPostedTransaction orig, final Date time) throws InvalidTransactionException, UnBalancedTransactionException { ! super(orig.getRequestId(), orig.getComment(), orig.getItemList()); if (!orig.isBalanced()) ! throw new UnBalancedTransactionException(null, orig, orig.getBalance()); this.transactionTime = time; } ! public PostedTransaction(final PostedHeldTransaction orig, final Date time, final double amount, final String comment) throws ExceededHeldAmountException, UnBalancedTransactionException { ! super(orig.getRequestId(), comment, orig.getAdjustedItems(amount)); this.transactionTime = time; } *************** *** 96,101 **** --- 101,120 ---- } + /** + * The ID of the Receipt generated after a Transaction has been posted + * + * @return + */ + public String getReceiptId() { + return receipt; + } + + public void setReceiptId(String receipt) { + this.receipt = receipt; + } + private final Date transactionTime; + private String receipt; } Index: UnPostedHeldTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/UnPostedHeldTransaction.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UnPostedHeldTransaction.java 21 Mar 2004 00:48:36 -0000 1.5 --- UnPostedHeldTransaction.java 31 Mar 2004 23:11:10 -0000 1.6 *************** *** 8,11 **** --- 8,16 ---- * $Id$ * $Log$ + * Revision 1.6 2004/03/31 23:11:10 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.5 2004/03/21 00:48:36 pelle * The problem with Enveloped signatures has now been fixed. It was a problem in the way transforms work. I have bandaided it, but in the future if better support for transforms need to be made, we need to rethink it a bit. Perhaps using the new crypto channel's in neuclear-commons. *************** *** 70,75 **** * @param expiryTime */ ! public UnPostedHeldTransaction(final String req, final String id, final String comment, final Date expiryTime) throws InvalidTransactionException { ! super(req, id, comment); this.expiryTime = expiryTime; } --- 75,80 ---- * @param expiryTime */ ! public UnPostedHeldTransaction(final String req, final String comment, final Date expiryTime) throws InvalidTransactionException { ! super(req, comment); this.expiryTime = expiryTime; } |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:02
|
Update of /cvsroot/neuclear/neuclear-ledger/src/test/org/neuclear/ledger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/test/org/neuclear/ledger Added Files: TransactionTest.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. --- NEW FILE: TransactionTest.java --- package org.neuclear.ledger; import junit.framework.TestCase; import java.util.Date; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: TransactionTest.java,v 1.1 2004/03/31 23:11:10 pelle Exp $ $Log: TransactionTest.java,v $ Revision 1.1 2004/03/31 23:11:10 pelle Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. */ /** * User: pelleb * Date: Mar 30, 2004 * Time: 10:33:14 PM */ public class TransactionTest extends TestCase { public TransactionTest(String s) { super(s); } public void testUnposted() throws InvalidTransactionException { UnPostedTransaction tran = new UnPostedTransaction("1234", "test"); assertNotNull(tran); assertEquals("1234", tran.getRequestId()); assertEquals("test", tran.getComment()); assertNotNull(tran.getItemList()); assertEquals(0, tran.getItemList().size()); tran.addItem("bob", 10); assertEquals(1, tran.getItemList().size()); assertFalse(tran.isBalanced()); tran.addItem("alice", -10); assertEquals(2, tran.getItemList().size()); assertTrue(tran.isBalanced()); tran.addItem("alice", -10); assertEquals(3, tran.getItemList().size()); assertFalse(tran.isBalanced()); } public void testPostedBalanced() throws InvalidTransactionException { UnPostedTransaction tran = new UnPostedTransaction("1234", "test"); assertNotNull(tran); assertEquals("1234", tran.getRequestId()); assertEquals("test", tran.getComment()); assertNotNull(tran.getItemList()); assertEquals(0, tran.getItemList().size()); tran.addItem("bob", 10); tran.addItem("alice", -10); assertTrue(tran.isBalanced()); final Date time = new Date(); PostedTransaction posted = new PostedTransaction(tran, time); assertNotNull(posted); assertEquals("1234", posted.getRequestId()); assertEquals("test", posted.getComment()); assertNotNull(posted.getItemList()); assertEquals(2, posted.getItemList().size()); assertNotNull(posted.getTransactionTime()); assertEquals(time.getTime(), posted.getTransactionTime().getTime()); assertNull(posted.getReceiptId()); posted.setReceiptId("2345"); assertNotNull(posted.getReceiptId()); assertEquals("2345", posted.getReceiptId()); } public void testPostedUnBalancedDoesFail() throws InvalidTransactionException { UnPostedTransaction tran = new UnPostedTransaction("1234", "test"); assertNotNull(tran); assertEquals("1234", tran.getRequestId()); assertEquals("test", tran.getComment()); assertNotNull(tran.getItemList()); assertEquals(0, tran.getItemList().size()); tran.addItem("bob", 10); tran.addItem("alice", -30); assertFalse(tran.isBalanced()); final Date time = new Date(); try { PostedTransaction posted = new PostedTransaction(tran, time); assertTrue(false); } catch (UnBalancedTransactionException e) { assertTrue(true); } } public void testUnpostedHeld() throws InvalidTransactionException { final Date time = new Date(); UnPostedHeldTransaction tran = new UnPostedHeldTransaction("1234", "test", time); assertNotNull(tran); assertEquals("1234", tran.getRequestId()); assertEquals("test", tran.getComment()); assertEquals(time, tran.getExpiryTime()); assertNotNull(tran.getItemList()); assertEquals(0, tran.getItemList().size()); tran.addItem("bob", 10); assertEquals(1, tran.getItemList().size()); assertFalse(tran.isBalanced()); tran.addItem("alice", -10); assertEquals(2, tran.getItemList().size()); assertTrue(tran.isBalanced()); tran.addItem("alice", -10); assertEquals(3, tran.getItemList().size()); assertFalse(tran.isBalanced()); } public void testPosteHelddBalanced() throws InvalidTransactionException { final Date time = new Date(); UnPostedHeldTransaction tran = new UnPostedHeldTransaction("1234", "test", time); assertNotNull(tran); assertEquals("1234", tran.getRequestId()); assertEquals("test", tran.getComment()); assertEquals(time, tran.getExpiryTime()); assertNotNull(tran.getItemList()); assertEquals(0, tran.getItemList().size()); tran.addItem("bob", 10); tran.addItem("alice", -10); assertEquals(10.0, tran.getAmount(), 0); assertTrue(tran.isBalanced()); PostedHeldTransaction posted = new PostedHeldTransaction(tran, time); assertNotNull(posted); assertEquals("1234", posted.getRequestId()); assertEquals("test", posted.getComment()); assertEquals(time, posted.getExpiryTime()); assertNotNull(posted.getItemList()); assertEquals(2, posted.getItemList().size()); assertNotNull(posted.getTransactionTime()); assertEquals(time.getTime(), posted.getTransactionTime().getTime()); assertNull(posted.getReceiptId()); posted.setReceiptId("2345"); assertNotNull(posted.getReceiptId()); assertEquals("2345", posted.getReceiptId()); } public void testPostedHeldUnBalancedDoesFail() throws InvalidTransactionException { final Date time = new Date(); UnPostedHeldTransaction tran = new UnPostedHeldTransaction("1234", "test", time); assertNotNull(tran); assertEquals("1234", tran.getRequestId()); assertEquals("test", tran.getComment()); assertEquals(time, tran.getExpiryTime()); assertNotNull(tran.getItemList()); assertEquals(0, tran.getItemList().size()); tran.addItem("bob", 10); tran.addItem("alice", -30); assertFalse(tran.isBalanced()); try { PostedHeldTransaction posted = new PostedHeldTransaction(tran, time); assertTrue(false); } catch (UnBalancedTransactionException e) { assertTrue(true); } } public void testPostedHeldCompleted() throws InvalidTransactionException { final Date time = new Date(); UnPostedHeldTransaction tran = new UnPostedHeldTransaction("1234", "test", time); assertNotNull(tran); assertEquals("1234", tran.getRequestId()); assertEquals("test", tran.getComment()); assertEquals(time, tran.getExpiryTime()); assertNotNull(tran.getItemList()); assertEquals(0, tran.getItemList().size()); tran.addItem("bob", 10); tran.addItem("alice", -10); assertEquals(10.0, tran.getAmount(), 0); assertTrue(tran.isBalanced()); PostedHeldTransaction held = new PostedHeldTransaction(tran, time); assertNotNull(held); Date time2 = new Date(); try { PostedTransaction posted = new PostedTransaction(held, time2, 15, "complete"); assertFalse("Didnt throw Exceeded Amount Transaction ", true); } catch (ExceededHeldAmountException e) { ; } PostedTransaction posted = new PostedTransaction(held, time2, 5, "complete"); assertNotNull(posted); assertEquals("1234", posted.getRequestId()); assertEquals("complete", posted.getComment()); assertNotNull(posted.getItemList()); assertEquals(2, posted.getItemList().size()); assertNotNull(posted.getTransactionTime()); assertEquals(time2.getTime(), posted.getTransactionTime().getTime()); assertEquals(5.0, posted.getAmount(), 0); assertNull(posted.getReceiptId()); posted.setReceiptId("2345"); assertNotNull(posted.getReceiptId()); assertEquals("2345", posted.getReceiptId()); posted = new PostedTransaction(held, time2, 10, "complete"); assertNotNull(posted); assertEquals("1234", posted.getRequestId()); assertEquals("complete", posted.getComment()); assertNotNull(posted.getItemList()); assertEquals(2, posted.getItemList().size()); assertNotNull(posted.getTransactionTime()); assertEquals(time2.getTime(), posted.getTransactionTime().getTime()); assertEquals(10.0, posted.getAmount(), 0); assertNull(posted.getReceiptId()); posted.setReceiptId("2345"); assertNotNull(posted.getReceiptId()); assertEquals("2345", posted.getReceiptId()); } } |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:02
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/java/org/neuclear/ledger/tests Modified Files: AbstractLedgerBrowserTest.java AbstractLedgerTest.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: AbstractLedgerTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests/AbstractLedgerTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AbstractLedgerTest.java 25 Mar 2004 21:39:43 -0000 1.5 --- AbstractLedgerTest.java 31 Mar 2004 23:11:09 -0000 1.6 *************** *** 13,19 **** * $Id$ * $Log$ * Revision 1.5 2004/03/25 21:39:43 pelle * Modified expire tests a bit to eliminate one cause for an error ! * * Revision 1.4 2004/03/25 19:03:23 pelle * PostedTransaction and friend now verify the unpostedtransaction is balanced. --- 13,24 ---- * $Id$ * $Log$ + * Revision 1.6 2004/03/31 23:11:09 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.5 2004/03/25 21:39:43 pelle * Modified expire tests a bit to eliminate one cause for an error ! * <p/> * Revision 1.4 2004/03/25 19:03:23 pelle * PostedTransaction and friend now verify the unpostedtransaction is balanced. *************** *** 227,231 **** int cumulative = 0; for (int i = 0; i < 100; i++) { ! ledger.transfer("req" + i + System.currentTimeMillis(), "x" + i + System.currentTimeMillis(), "Issuer", CAROL, i, "fund it"); cumulative += i; assertEquals("BOB BALANCE", bobBalance + cumulative, ledger.getBalance(CAROL), 0); --- 232,236 ---- int cumulative = 0; for (int i = 0; i < 100; i++) { ! ledger.transfer("req" + i + System.currentTimeMillis(), "Issuer", CAROL, i, "fund it"); cumulative += i; assertEquals("BOB BALANCE", bobBalance + cumulative, ledger.getBalance(CAROL), 0); *************** *** 353,356 **** --- 358,375 ---- } + public final void testSetReceiptId() throws LedgerException { + final double aliceBalance = ledger.getBalance(ALICE); + final double bobBalance = ledger.getBalance(BOB); + + PostedTransaction tran = ledger.transfer(ALICE, BOB, 100, "LOAN"); + assertNull(tran.getReceiptId()); + try { + ledger.setReceiptId(tran.getRequestId(), "1234"); + } catch (UnknownTransactionException e) { + assertTrue(true); + } + + } + public final void testNaiveBenchmark() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { final int iterations = 100; Index: AbstractLedgerBrowserTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests/AbstractLedgerBrowserTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AbstractLedgerBrowserTest.java 29 Mar 2004 16:56:26 -0000 1.3 --- AbstractLedgerBrowserTest.java 31 Mar 2004 23:11:09 -0000 1.4 *************** *** 13,16 **** --- 13,21 ---- $Id$ $Log$ + Revision 1.4 2004/03/31 23:11:09 pelle + Reworked the ID's of the transactions. The primary ID is now the request ID. + Receipt ID's are optional and added using a separate set method. + The various interactive passphrase agents now have shell methods for the new interactive approach. + Revision 1.3 2004/03/29 16:56:26 pelle AbstractLedgerBrowserTest has been extended to test date ranges *************** *** 182,187 **** assertEquals("amount", amount, bb.getAmount(), 0); assertEquals("comment", "test" + total, bb.getComment()); ! assertNotNull("id", bb.getId()); ! assertNotNull("reqid", bb.getRequestId()); assertNotNull("valuetime", bb.getValuetime()); assertNull("expiry", bb.getExpirytime()); --- 187,191 ---- assertEquals("amount", amount, bb.getAmount(), 0); assertEquals("comment", "test" + total, bb.getComment()); ! assertNotNull("request", bb.getRequestId()); assertNotNull("valuetime", bb.getValuetime()); assertNull("expiry", bb.getExpirytime()); |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:02
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/java/org/neuclear/ledger/simple Modified Files: SimpleLedger.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: SimpleLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple/SimpleLedger.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SimpleLedger.java 29 Mar 2004 20:05:17 -0000 1.8 --- SimpleLedger.java 31 Mar 2004 23:11:09 -0000 1.9 *************** *** 4,7 **** --- 4,12 ---- * $Id$ * $Log$ + * Revision 1.9 2004/03/31 23:11:09 pelle + * Reworked the ID's of the transactions. The primary ID is now the request ID. + * Receipt ID's are optional and added using a separate set method. + * The various interactive passphrase agents now have shell methods for the new interactive approach. + * * Revision 1.8 2004/03/29 20:05:17 pelle * LedgerServlet works now at least for a straight non date restricted browse. *************** *** 125,130 **** */ public PostedTransaction performTransaction(final UnPostedTransaction trans) throws UnBalancedTransactionException, InvalidTransactionException { - if (!trans.isBalanced()) - throw new UnBalancedTransactionException(this, trans); final PostedTransaction posted = new PostedTransaction(trans, new Date()); return post(posted); --- 130,133 ---- *************** *** 132,136 **** private PostedTransaction post(final PostedTransaction posted) { ! ledger.put(posted.getId(), posted); postToBook(posted); updateBalances(posted); --- 135,139 ---- private PostedTransaction post(final PostedTransaction posted) { ! ledger.put(posted.getRequestId(), posted); postToBook(posted); updateBalances(posted); *************** *** 191,198 **** */ public PostedHeldTransaction performHeldTransfer(final UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { - if (!trans.isBalanced()) - throw new UnBalancedTransactionException(this, trans); final PostedHeldTransaction posted = new PostedHeldTransaction(trans, new Date()); ! held.put(posted.getId(), posted); postToBook(posted); return posted; --- 194,199 ---- */ public PostedHeldTransaction performHeldTransfer(final UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { final PostedHeldTransaction posted = new PostedHeldTransaction(trans, new Date()); ! held.put(posted.getRequestId(), posted); postToBook(posted); return posted; *************** *** 209,214 **** */ public void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { ! if (held.containsKey(hold.getId())) ! held.remove(hold.getId()); } --- 210,215 ---- */ public void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { ! if (held.containsKey(hold.getRequestId())) ! held.remove(hold.getRequestId()); } *************** *** 229,237 **** */ public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException { ! if (!held.containsKey(hold.getId())) ! throw new UnknownTransactionException(this, hold.getId()); if (hold.getExpiryTime().before(new Date())) throw new TransactionExpiredException(this, hold); ! held.remove(hold.getId()); PostedTransaction posted = new PostedTransaction(hold, new Date(), amount, comment); return post(posted); --- 230,238 ---- */ public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException { ! if (!held.containsKey(hold.getRequestId())) ! throw new UnknownTransactionException(this, hold.getRequestId()); if (hold.getExpiryTime().before(new Date())) throw new TransactionExpiredException(this, hold); ! held.remove(hold.getRequestId()); PostedTransaction posted = new PostedTransaction(hold, new Date(), amount, comment); return post(posted); *************** *** 327,330 **** --- 328,337 ---- } + public void setReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { + if (!ledger.containsKey(id)) + throw new UnknownTransactionException(this, id); + ((PostedTransaction) ledger.get(id)).setReceiptId(receipt); + } + public double getTestBalance() throws LowlevelLedgerException { Iterator iter = balances.keySet().iterator(); *************** *** 426,430 **** } ! setRow(tran.getId(), tran.getRequestId(), counterparty, tran.getComment(), tran.getTransactionTime(), item.getAmount(), null, null, null); } --- 433,437 ---- } ! setRow(tran.getRequestId(), counterparty, tran.getComment(), tran.getTransactionTime(), item.getAmount(), null, null, null); } |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:01
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/java/org/neuclear/ledger/servlets Modified Files: LedgerBrowserServlet.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: LedgerBrowserServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/servlets/LedgerBrowserServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LedgerBrowserServlet.java 29 Mar 2004 23:43:30 -0000 1.1 --- LedgerBrowserServlet.java 31 Mar 2004 23:11:09 -0000 1.2 *************** *** 2,6 **** import org.neuclear.commons.Utility; - import org.neuclear.commons.configuration.ConfigurableContainer; import org.neuclear.commons.servlets.ServletTools; import org.neuclear.commons.time.TimeTools; --- 2,5 ---- *************** *** 8,12 **** import org.neuclear.id.NSTools; import org.neuclear.ledger.LowlevelLedgerException; - import org.neuclear.ledger.Ledger; import org.neuclear.ledger.browser.BookBrowser; import org.neuclear.ledger.browser.LedgerBrowser; --- 7,10 ---- *************** *** 21,27 **** import java.io.PrintWriter; import java.security.Principal; - import java.util.Date; - import java.sql.Timestamp; import java.text.ParseException; /* --- 19,24 ---- import java.io.PrintWriter; import java.security.Principal; import java.text.ParseException; + import java.util.Date; /* *************** *** 45,48 **** --- 42,50 ---- $Id$ $Log$ + Revision 1.2 2004/03/31 23:11:09 pelle + Reworked the ID's of the transactions. The primary ID is now the request ID. + Receipt ID's are optional and added using a separate set method. + The various interactive passphrase agents now have shell methods for the new interactive approach. + Revision 1.1 2004/03/29 23:43:30 pelle The servlets now work and display the ledger contents. *************** *** 84,88 **** // ConfigurableContainer pico=(ConfigurableContainer) getServletContext().getAttribute("pico"); // ledger = (LedgerBrowser) pico.getComponentInstance(Ledger.class) ; ! ledger=new PopulatedSimpleLedger(serviceid); } catch (Exception e) { e.printStackTrace(); --- 86,90 ---- // ConfigurableContainer pico=(ConfigurableContainer) getServletContext().getAttribute("pico"); // ledger = (LedgerBrowser) pico.getComponentInstance(Ledger.class) ; ! ledger = new PopulatedSimpleLedger(serviceid); } catch (Exception e) { e.printStackTrace(); *************** *** 106,116 **** System.out.println("Browsing: " + book); ! String fromStr=request.getParameter("from"); ! String toStr=request.getParameter("to"); ! Date from=parseDate(fromStr); ! Date to=parseDate(toStr); ! BookBrowser stmt = browse(book,from,to); out.println("<table><tr><th>Transaction ID</th><th>Time</th><th>Counterparty</th><th>Comment</th><th>Amount</th></tr>"); while (stmt.next()) { --- 108,118 ---- System.out.println("Browsing: " + book); ! String fromStr = request.getParameter("from"); ! String toStr = request.getParameter("to"); ! Date from = parseDate(fromStr); ! Date to = parseDate(toStr); ! BookBrowser stmt = browse(book, from, to); out.println("<table><tr><th>Transaction ID</th><th>Time</th><th>Counterparty</th><th>Comment</th><th>Amount</th></tr>"); while (stmt.next()) { *************** *** 120,124 **** out.print(" class=\"negative\""); out.print("><td style=\"size:small\">"); ! out.print(stmt.getId()); out.print("</td><td>"); out.print(TimeTools.formatTimeStampShort(stmt.getValuetime())); --- 122,126 ---- out.print(" class=\"negative\""); out.print("><td style=\"size:small\">"); ! out.print(stmt.getRequestId()); out.print("</td><td>"); out.print(TimeTools.formatTimeStampShort(stmt.getValuetime())); *************** *** 146,159 **** } ! private BookBrowser browse(String book,Date from, Date to) throws LowlevelLedgerException { ! if (from!=null){ ! if (to!=null) ! return ledger.browseRange(book,from,to); ! return ledger.browseFrom(book,from); } return ledger.browse(book); } ! private Date parseDate(String fromStr) { if (Utility.isEmpty(fromStr)) return null; --- 148,161 ---- } ! private BookBrowser browse(String book, Date from, Date to) throws LowlevelLedgerException { ! if (from != null) { ! if (to != null) ! return ledger.browseRange(book, from, to); ! return ledger.browseFrom(book, from); } return ledger.browse(book); } ! private Date parseDate(String fromStr) { if (Utility.isEmpty(fromStr)) return null; |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:23:00
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/browser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28687/src/java/org/neuclear/ledger/browser Modified Files: BookBrowser.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: BookBrowser.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/browser/BookBrowser.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** BookBrowser.java 26 Mar 2004 23:36:34 -0000 1.4 --- BookBrowser.java 31 Mar 2004 23:11:09 -0000 1.5 *************** *** 25,28 **** --- 25,33 ---- $Id$ $Log$ + Revision 1.5 2004/03/31 23:11:09 pelle + Reworked the ID's of the transactions. The primary ID is now the request ID. + Receipt ID's are optional and added using a separate set method. + The various interactive passphrase agents now have shell methods for the new interactive approach. + Revision 1.4 2004/03/26 23:36:34 pelle The simple browse(book) now works on hibernate, I have implemented the other two, which currently don not constrain the query correctly. *************** *** 56,61 **** ! protected final void setRow(String xid, String reqid, String counterparty, String comment, Date valuetime, double amount, Date expirytime, Date cancelled, String completedId) { ! this.id = xid; this.reqid = reqid; this.counterparty = counterparty; --- 61,65 ---- ! protected final void setRow(String reqid, String counterparty, String comment, Date valuetime, double amount, Date expirytime, Date cancelled, String completedId) { this.reqid = reqid; this.counterparty = counterparty; *************** *** 72,79 **** } - public String getId() { - return id; - } - public String getRequestId() { return reqid; --- 76,79 ---- *************** *** 114,118 **** private final String book; - private String id; private String reqid; private String counterparty; --- 114,117 ---- |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:22:45
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/controllers/currency In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28622/src/java/org/neuclear/asset/controllers/currency Modified Files: CurrencyController.java Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: CurrencyController.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/controllers/currency/CurrencyController.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CurrencyController.java 25 Mar 2004 19:03:39 -0000 1.16 --- CurrencyController.java 31 Mar 2004 23:10:48 -0000 1.17 *************** *** 8,12 **** import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.signers.Signer; - import org.neuclear.commons.time.TimeTools; import org.neuclear.exchange.orders.*; import org.neuclear.id.Identity; --- 8,11 ---- *************** *** 14,18 **** import org.neuclear.ledger.*; - import java.sql.Timestamp; import java.util.Iterator; --- 13,16 ---- *************** *** 43,49 **** try { ! final Timestamp valuetime = TimeTools.now(); ! final PostedTransaction posted = ledger.transfer("id", req.getName(), req.getSignatory().getName(), req.getRecipient().getName(), req.getAmount().getAmount(), req.getComment()); ! return (TransferReceipt) new TransferReceiptBuilder(req, valuetime).convert(asset.getName(), signer); } catch (LowlevelLedgerException e) { throw new LowLevelPaymentException(e); --- 41,46 ---- try { ! final PostedTransaction posted = ledger.verifiedTransfer("id", req.getSignatory().getName(), req.getRecipient().getName(), req.getAmount().getAmount(), req.getComment()); ! return (TransferReceipt) new TransferReceiptBuilder(req, posted.getTransactionTime()).convert(asset.getName(), signer); } catch (LowlevelLedgerException e) { throw new LowLevelPaymentException(e); |
|
From: Pelle B. <pe...@us...> - 2004-03-31 23:22:44
|
Update of /cvsroot/neuclear/neuclear-pay In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28622 Modified Files: project.xml Log Message: Reworked the ID's of the transactions. The primary ID is now the request ID. Receipt ID's are optional and added using a separate set method. The various interactive passphrase agents now have shell methods for the new interactive approach. Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/project.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** project.xml 23 Mar 2004 22:02:06 -0000 1.22 --- project.xml 31 Mar 2004 23:10:50 -0000 1.23 *************** *** 80,85 **** </dependency> <dependency> <id>picocontainer</id> ! <version>1.0-beta-1</version> <properties> <war.bundle>true</war.bundle> --- 80,93 ---- </dependency> <dependency> + <id>neuclear-ledger</id> + <name>neuclear-ledger</name> + <version>0.6</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> <id>picocontainer</id> ! <version>1.0-beta-5</version> <properties> <war.bundle>true</war.bundle> |