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: Pelle B. <pe...@us...> - 2004-03-25 22:15:37
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16197/src/java/org/neuclear/ledger/servlets Modified Files: LedgerServlet.java Log Message: The first shell for the HibernateBookBrowser Index: LedgerServlet.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/servlets/LedgerServlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LedgerServlet.java 21 Mar 2004 00:48:36 -0000 1.4 --- LedgerServlet.java 25 Mar 2004 22:04:46 -0000 1.5 *************** *** 44,47 **** --- 44,50 ---- $Id$ $Log$ + Revision 1.5 2004/03/25 22:04:46 pelle + The first shell for the HibernateBookBrowser + Revision 1.4 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. *************** *** 102,106 **** out.print(" class=\"negative\""); out.print("><td style=\"size:small\">"); ! out.print(stmt.getXid()); out.print("</td><td>"); out.print(TimeTools.formatTimeStampShort(stmt.getValuetime())); --- 105,109 ---- out.print(" class=\"negative\""); out.print("><td style=\"size:small\">"); ! out.print(stmt.getId()); out.print("</td><td>"); out.print(TimeTools.formatTimeStampShort(stmt.getValuetime())); |
|
From: Pelle B. <pe...@us...> - 2004-03-25 22:15:36
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/browser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16197/src/java/org/neuclear/ledger/browser Modified Files: BookBrowser.java QueryBookBrowser.java Log Message: The first shell for the HibernateBookBrowser Index: QueryBookBrowser.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/browser/QueryBookBrowser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** QueryBookBrowser.java 21 Mar 2004 00:48:35 -0000 1.2 --- QueryBookBrowser.java 25 Mar 2004 22:04:46 -0000 1.3 *************** *** 30,33 **** --- 30,36 ---- $Id$ $Log$ + Revision 1.3 2004/03/25 22:04:46 pelle + The first shell for the HibernateBookBrowser + Revision 1.2 2004/03/21 00:48:35 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. *************** *** 101,105 **** if (!rs.next()) return false; ! setRow(rs.getString(1), rs.getString(3), rs.getString(4), rs.getTimestamp(2), rs.getBigDecimal(5)); return true; } catch (SQLException e) { --- 104,108 ---- if (!rs.next()) return false; ! setRow(rs.getString(1), rs.getString(2), rs.getString(4), rs.getString(5), rs.getTimestamp(3), rs.getBigDecimal(6)); return true; } catch (SQLException e) { *************** *** 111,115 **** private final Ledger ledger; private boolean next; ! private static final String BASE_QUERY = "select t.id,t.valuetime, r.bookid,t.comment,s.amount from entry s,entry r, transaction t where s.transactionid=t.id and r.transactionid=t.id and r.id<>s.id\nand s.bookid = ? and t.ledgerid=?"; private static final String UNTIL_CLAUSE = " AND t.valuetime<=?"; private static final String FROM_CLAUSE = " AND t.valuetime>?"; --- 114,118 ---- private final Ledger ledger; private boolean next; ! private static final String BASE_QUERY = "select t.id,t.request_id, t.valuetime, r.bookid,t.comment,s.amount from entry s,entry r, transaction t where s.transactionid=t.id and r.transactionid=t.id and r.id<>s.id\nand s.bookid = ? and t.ledgerid=?"; private static final String UNTIL_CLAUSE = " AND t.valuetime<=?"; private static final String FROM_CLAUSE = " AND t.valuetime>?"; Index: BookBrowser.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/browser/BookBrowser.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** BookBrowser.java 21 Mar 2004 00:48:35 -0000 1.2 --- BookBrowser.java 25 Mar 2004 22:04:45 -0000 1.3 *************** *** 26,29 **** --- 26,32 ---- $Id$ $Log$ + Revision 1.3 2004/03/25 22:04:45 pelle + The first shell for the HibernateBookBrowser + Revision 1.2 2004/03/21 00:48:35 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. *************** *** 51,56 **** ! protected final void setRow(String xid, String counterparty, String comment, Timestamp valuetime, BigDecimal amount) { ! this.xid = xid; this.counterparty = counterparty; this.comment = comment; --- 54,60 ---- ! protected final void setRow(String xid, String reqid, String counterparty, String comment, Timestamp valuetime, BigDecimal amount) { ! this.id = xid; ! this.reqid = reqid; this.counterparty = counterparty; this.comment = comment; *************** *** 63,68 **** } ! public String getXid() { ! return xid; } --- 67,76 ---- } ! public String getId() { ! return id; ! } ! ! public String getRequestId() { ! return reqid; } *************** *** 85,89 **** private final String book; ! private String xid; private String counterparty; private String comment; --- 93,98 ---- private final String book; ! private String id; ! private String reqid; private String counterparty; private String comment; |
|
From: <bug...@ve...> - 2004-03-25 22:15:35
|
Message: Work on this issue has been started by Pelle Braendgaard (mailto:pe...@ve...) --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/GL-23 Here is an overview of the issue: --------------------------------------------------------------------- Key: GL-23 Summary: Create Hibernate Book Browser Type: New Feature Status: In Progress Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Ledger Components: Browser Fix Fors: r_0_4 Versions: r_0_4 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 25 Mar 2004 2:01 PM Updated: Thu, 25 Mar 2004 2:14 PM Description: We need to be able to visually browser the Hibernate Ledger --------------------------------------------------------------------- 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-03-25 22:03:34
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/GL-23 Here is an overview of the issue: --------------------------------------------------------------------- Key: GL-23 Summary: Create Hibernate Book Browser Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Ledger Components: Browser Fix Fors: r_0_4 Versions: r_0_4 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Thu, 25 Mar 2004 2:01 PM Updated: Thu, 25 Mar 2004 2:01 PM Description: We need to be able to visually browser the Hibernate Ledger --------------------------------------------------------------------- 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-03-25 21:52:35
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Thu, 25 Mar 2004 1:52 PM
Now passes all unit tests
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/GL-19
Here is an overview of the issue:
---------------------------------------------------------------------
Key: GL-19
Summary: Hibernate Ledger Implementation
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Ledger
Components:
SQL Ledger
Fix Fors:
r_0_4
Versions:
r_0_4
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Sat, 20 Mar 2004 4:23 PM
Updated: Thu, 25 Mar 2004 1:52 PM
Description:
New implementation needed in Hibernate.
This should implement a BrowsableLedger as well for use in Web report generators.
---------------------------------------------------------------------
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-25 21:51:39
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9393/src/java/org/neuclear/ledger/hibernate Modified Files: HHeld.hbm.xml HHeld.java HTransaction.java HibernateLedger.java Log Message: Now passes all unit tests Index: HHeld.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HHeld.java 25 Mar 2004 19:04:17 -0000 1.2 --- HHeld.java 25 Mar 2004 21:40:45 -0000 1.3 *************** *** 27,31 **** this.comment = tran.getComment(); this.cancelled = false; ! this.completed = null; final List ol = tran.getItemList(); this.items = new HashSet(ol.size()); --- 27,31 ---- this.comment = tran.getComment(); this.cancelled = false; ! this.completedId = null; final List ol = tran.getItemList(); this.items = new HashSet(ol.size()); *************** *** 92,101 **** } ! public HTransaction getCompleted() { ! return completed; } ! public void setCompleted(HTransaction transaction) { ! this.completed = transaction; } --- 92,101 ---- } ! public String getCompletedId() { ! return completedId; } ! public void setCompletedId(String completedId) { ! this.completedId = completedId; } *************** *** 117,120 **** private Set items; private boolean cancelled; ! private HTransaction completed; } --- 117,120 ---- private Set items; private boolean cancelled; ! private String completedId; } Index: HHeld.hbm.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.hbm.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HHeld.hbm.xml 25 Mar 2004 19:04:17 -0000 1.4 --- HHeld.hbm.xml 25 Mar 2004 21:40:45 -0000 1.5 *************** *** 30,34 **** not-null="true"/> </property> ! <one-to-one name="completed" class="org.neuclear.ledger.hibernate.HTransaction" cascade="none" foreign-key="completed_id"/> <property name="comment"> <column name="comment" sql-type="varchar(255)" --- 30,37 ---- not-null="true"/> </property> ! <property name="completedId"> ! <column name="completed_id" sql-type="char(32)" ! not-null="false"/> ! </property> <property name="comment"> <column name="comment" sql-type="varchar(255)" Index: HibernateLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HibernateLedger.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HibernateLedger.java 25 Mar 2004 19:04:17 -0000 1.7 --- HibernateLedger.java 25 Mar 2004 21:40:45 -0000 1.8 *************** *** 184,188 **** } final Date time = new Date(); ! if (posted.getExpiryTime().before(time) || posted.isCancelled() || posted.getCompleted() != null) { ses.close(); throw new TransactionExpiredException(this, hold); --- 184,188 ---- } final Date time = new Date(); ! if (posted.getExpiryTime().before(time) || posted.isCancelled() || posted.getCompletedId() != null) { ses.close(); throw new TransactionExpiredException(this, hold); *************** *** 191,195 **** htran.setComment(comment); ses.save(htran); ! posted.setCompleted(htran); ses.update(htran); t.commit(); --- 191,195 ---- htran.setComment(comment); ses.save(htran); ! posted.setCompletedId(htran.getId()); ses.update(htran); t.commit(); *************** *** 274,278 **** try { Session ses = factory.openSession(); ! Query q = ses.createQuery("select sum(item.amount) from HHeldItem item where item.book = ? and item.amount<0 and item.held.expiryTime > ? and item.held.cancelled=false and item.held.completed = null"); q.setString(0, book); q.setTimestamp(1, new Date()); --- 274,278 ---- try { Session ses = factory.openSession(); ! Query q = ses.createQuery("select sum(item.amount) from HHeldItem item where item.book = ? and item.amount<0 and item.held.expiryTime > ? and item.held.cancelled=false and item.held.completedId is null"); q.setString(0, book); q.setTimestamp(1, new Date()); Index: HTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HTransaction.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HTransaction.java 25 Mar 2004 19:04:17 -0000 1.4 --- HTransaction.java 25 Mar 2004 21:40:45 -0000 1.5 *************** *** 38,42 **** this.transactionTime = transactionTime; this.comment = held.getComment(); ! this.items = held.getItems(); } --- 38,47 ---- 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())); ! } } |
|
From: Pelle B. <pe...@us...> - 2004-03-25 21:50:37
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8842/src/java/org/neuclear/ledger/tests Modified Files: AbstractLedgerTest.java Log Message: Modified expire tests a bit to eliminate one cause for an error Index: AbstractLedgerTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests/AbstractLedgerTest.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AbstractLedgerTest.java 25 Mar 2004 19:03:23 -0000 1.4 --- AbstractLedgerTest.java 25 Mar 2004 21:39:43 -0000 1.5 *************** *** 13,20 **** * $Id$ * $Log$ * Revision 1.4 2004/03/25 19:03:23 pelle * PostedTransaction and friend now verify the unpostedtransaction is balanced. * Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. ! * * Revision 1.3 2004/03/25 16:44:21 pelle * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. --- 13,23 ---- * $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. * Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. ! * <p/> * Revision 1.3 2004/03/25 16:44:21 pelle * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. *************** *** 248,259 **** System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! ledger.hold(ALICE, BOB, new Date(System.currentTimeMillis() + 5000), amount, "LOAN"); assertEquals("ALICE BALANCE", aliceBalance, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE", bobBalance, ledger.getBalance(BOB), 0); - assertEquals("ALICE Available BALANCE", aliceBalance - amount, ledger.getAvailableBalance(ALICE), 0); - assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); try { ! Thread.currentThread().sleep(5000); } catch (InterruptedException e) { ; --- 251,262 ---- System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! ledger.hold(ALICE, BOB, new Date(System.currentTimeMillis() + 10000), amount, "LOAN"); ! assertEquals("ALICE Available BALANCE", aliceBalance - amount, ledger.getAvailableBalance(ALICE), 0); ! assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); assertEquals("ALICE BALANCE", aliceBalance, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE", bobBalance, ledger.getBalance(BOB), 0); try { ! Thread.currentThread().sleep(10000); } catch (InterruptedException e) { ; |
|
From: Pelle B. <pe...@us...> - 2004-03-25 19:15:08
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6315 Modified Files: project.xml Log Message: PostedTransaction and friend now verify the unpostedtransaction is balanced. Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/project.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** project.xml 24 Mar 2004 12:33:11 -0000 1.4 --- project.xml 25 Mar 2004 19:04:18 -0000 1.5 *************** *** 98,101 **** --- 98,115 ---- </dependency> <dependency> + <id>odmg</id> + <version>3.0</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> + <id>cglib</id> + <version>2.0-rc2</version> + <properties> + <war.bundle>true</war.bundle> + </properties> + </dependency> + <dependency> <id>commons-collections</id> <version>2.1</version> |
|
From: Pelle B. <pe...@us...> - 2004-03-25 19:15:08
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6315/src/java/org/neuclear/ledger/hibernate Modified Files: HHeld.hbm.xml HHeld.java HTransaction.java HibernateLedger.java Log Message: PostedTransaction and friend now verify the unpostedtransaction is balanced. Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. Index: HHeld.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HHeld.java 23 Mar 2004 21:57:48 -0000 1.1 --- HHeld.java 25 Mar 2004 19:04:17 -0000 1.2 *************** *** 26,29 **** --- 26,31 ---- this.expiryTime = tran.getExpiryTime(); this.comment = tran.getComment(); + this.cancelled = false; + this.completed = null; final List ol = tran.getItemList(); this.items = new HashSet(ol.size()); *************** *** 82,87 **** } public PostedHeldTransaction createPosted() throws InvalidTransactionException { ! UnPostedHeldTransaction unp = new UnPostedHeldTransaction(id, requestId, comment, expiryTime); Iterator iter = items.iterator(); while (iter.hasNext()) { --- 84,105 ---- } + public boolean isCancelled() { + return cancelled; + } + + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } + + public HTransaction getCompleted() { + return completed; + } + + public void setCompleted(HTransaction transaction) { + this.completed = transaction; + } + public PostedHeldTransaction createPosted() throws InvalidTransactionException { ! UnPostedHeldTransaction unp = new UnPostedHeldTransaction(requestId, id, comment, expiryTime); Iterator iter = items.iterator(); while (iter.hasNext()) { *************** *** 98,100 **** --- 116,120 ---- private String comment; private Set items; + private boolean cancelled; + private HTransaction completed; } Index: HHeld.hbm.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HHeld.hbm.xml 25 Mar 2004 16:45:08 -0000 1.3 --- HHeld.hbm.xml 25 Mar 2004 19:04:17 -0000 1.4 *************** *** 26,29 **** --- 26,34 ---- not-null="true"/> </property> + <property name="cancelled" type="boolean"> + <column name="cancelled" + not-null="true"/> + </property> + <one-to-one name="completed" class="org.neuclear.ledger.hibernate.HTransaction" cascade="none" foreign-key="completed_id"/> <property name="comment"> <column name="comment" sql-type="varchar(255)" Index: HibernateLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HibernateLedger.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** HibernateLedger.java 25 Mar 2004 16:45:08 -0000 1.6 --- HibernateLedger.java 25 Mar 2004 19:04:17 -0000 1.7 *************** *** 140,146 **** net.sf.hibernate.Transaction t = ses.beginTransaction(); HHeld posted = (HHeld) ses.get(HHeld.class, hold.getId()); ! if (posted != null) ! ses.delete(posted); ! t.commit(); ses.close(); } catch (HibernateException e) { --- 140,154 ---- net.sf.hibernate.Transaction t = ses.beginTransaction(); HHeld posted = (HHeld) ses.get(HHeld.class, hold.getId()); ! if (posted != null) { ! ! posted.setCancelled(true); ! ses.saveOrUpdate(posted); ! t.commit(); ! } else { ! t.rollback(); ! ses.close(); ! throw new UnknownTransactionException(this, hold.getId()); ! } ! ses.close(); } catch (HibernateException e) { *************** *** 170,177 **** net.sf.hibernate.Transaction t = ses.beginTransaction(); HHeld posted = (HHeld) ses.get(HHeld.class, hold.getId()); final Date time = new Date(); ! if (posted.getExpiryTime().before(time)) { ! ses.delete(posted); ! t.commit(); ses.close(); throw new TransactionExpiredException(this, hold); --- 178,188 ---- 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(); ! if (posted.getExpiryTime().before(time) || posted.isCancelled() || posted.getCompleted() != null) { ses.close(); throw new TransactionExpiredException(this, hold); *************** *** 180,185 **** htran.setComment(comment); ses.save(htran); ! if (posted != null) ! ses.delete(posted); t.commit(); ses.close(); --- 191,196 ---- htran.setComment(comment); ses.save(htran); ! posted.setCompleted(htran); ! ses.update(htran); t.commit(); ses.close(); *************** *** 263,267 **** try { Session ses = factory.openSession(); ! Query q = ses.createQuery("select sum(item.amount) from HHeldItem item where item.book = ? and item.amount<0 and item.held.expiryTime < ?"); q.setString(0, book); q.setTimestamp(1, new Date()); --- 274,278 ---- try { Session ses = factory.openSession(); ! Query q = ses.createQuery("select sum(item.amount) from HHeldItem item where item.book = ? and item.amount<0 and item.held.expiryTime > ? and item.held.cancelled=false and item.held.completed = null"); q.setString(0, book); q.setTimestamp(1, new Date()); Index: HTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HTransaction.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HTransaction.java 24 Mar 2004 23:13:21 -0000 1.3 --- HTransaction.java 25 Mar 2004 19:04:17 -0000 1.4 *************** *** 82,86 **** public PostedTransaction createPosted() throws InvalidTransactionException { ! UnPostedTransaction unp = new UnPostedTransaction(id, requestId, comment); Iterator iter = items.iterator(); while (iter.hasNext()) { --- 82,86 ---- public PostedTransaction createPosted() throws InvalidTransactionException { ! UnPostedTransaction unp = new UnPostedTransaction(requestId, id, comment); Iterator iter = items.iterator(); while (iter.hasNext()) { |
|
From: Pelle B. <pe...@us...> - 2004-03-25 19:15:07
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6315/src/java Modified Files: hibernate.properties Log Message: PostedTransaction and friend now verify the unpostedtransaction is balanced. Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. Index: hibernate.properties =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/hibernate.properties,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** hibernate.properties 25 Mar 2004 16:45:08 -0000 1.4 --- hibernate.properties 25 Mar 2004 19:04:18 -0000 1.5 *************** *** 299,303 **** ## print all generated SQL to the console ! #hibernate.show_sql true --- 299,303 ---- ## print all generated SQL to the console ! hibernate.show_sql true |
|
From: Pelle B. <pe...@us...> - 2004-03-25 19:14:34
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/controllers/currency In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6243/src/java/org/neuclear/asset/controllers/currency Modified Files: CurrencyController.java Log Message: PostedTransaction and friend now verify the unpostedtransaction is balanced. Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. Index: CurrencyController.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/controllers/currency/CurrencyController.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** CurrencyController.java 21 Mar 2004 00:48:44 -0000 1.15 --- CurrencyController.java 25 Mar 2004 19:03:39 -0000 1.16 *************** *** 50,55 **** } catch (InvalidTransactionException e) { throw new InvalidTransferException(e.getSubMessage()); - } catch (UnBalancedTransactionException e) { - throw new InvalidTransferException("unbalanced"); } catch (NegativeTransferException e) { throw new InvalidTransferException("postive amount"); --- 50,53 ---- |
|
From: Pelle B. <pe...@us...> - 2004-03-25 19:14:13
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6162/src/java/org/neuclear/ledger/tests Modified Files: AbstractLedgerTest.java Log Message: PostedTransaction and friend now verify the unpostedtransaction is balanced. Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. Index: AbstractLedgerTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests/AbstractLedgerTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AbstractLedgerTest.java 25 Mar 2004 16:44:21 -0000 1.3 --- AbstractLedgerTest.java 25 Mar 2004 19:03:23 -0000 1.4 *************** *** 13,16 **** --- 13,20 ---- * $Id$ * $Log$ + * Revision 1.4 2004/03/25 19:03:23 pelle + * PostedTransaction and friend now verify the unpostedtransaction is balanced. + * Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. + * * Revision 1.3 2004/03/25 16:44:21 pelle * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. *************** *** 18,22 **** * has included hibernates full hibernate.properties to make it easier to try various databases. * It has now been tested with hsql and mysql. ! * * Revision 1.2 2004/03/24 23:12:34 pelle * Working on Hibernate Implementation. --- 22,26 ---- * has included hibernates full hibernate.properties to make it easier to try various databases. * It has now been tested with hsql and mysql. ! * <p/> * Revision 1.2 2004/03/24 23:12:34 pelle * Working on Hibernate Implementation. *************** *** 347,351 **** public final void testNaiveBenchmark() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { ! final int iterations = 1000; final double amount = 50; final String book = "benchbook-" + System.currentTimeMillis(); --- 351,355 ---- public final void testNaiveBenchmark() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { ! final int iterations = 100; final double amount = 50; final String book = "benchbook-" + System.currentTimeMillis(); |
|
From: Pelle B. <pe...@us...> - 2004-03-25 19:14:13
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6162/src/java/org/neuclear/ledger Modified Files: PostedHeldTransaction.java PostedTransaction.java UnBalancedTransactionException.java Log Message: PostedTransaction and friend now verify the unpostedtransaction is balanced. Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. Index: PostedHeldTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/PostedHeldTransaction.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PostedHeldTransaction.java 21 Mar 2004 00:48:36 -0000 1.6 --- PostedHeldTransaction.java 25 Mar 2004 19:03:23 -0000 1.7 *************** *** 9,13 **** */ public final class PostedHeldTransaction extends PostedTransaction implements HeldTransaction { ! public PostedHeldTransaction(final UnPostedHeldTransaction orig, Date time) throws InvalidTransactionException { super(orig, time); this.expiryTime = orig.getExpiryTime(); --- 9,13 ---- */ public final class PostedHeldTransaction extends PostedTransaction implements HeldTransaction { ! public PostedHeldTransaction(final UnPostedHeldTransaction orig, Date time) throws InvalidTransactionException, UnBalancedTransactionException { super(orig, time); this.expiryTime = orig.getExpiryTime(); Index: PostedTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/PostedTransaction.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** PostedTransaction.java 23 Mar 2004 22:01:43 -0000 1.7 --- PostedTransaction.java 25 Mar 2004 19:03:23 -0000 1.8 *************** *** 8,11 **** --- 8,15 ---- * $Id$ * $Log$ + * Revision 1.8 2004/03/25 19:03:23 pelle + * PostedTransaction and friend now verify the unpostedtransaction is balanced. + * Updated schema for HHeld to include a cancelled field and a completed field. (The latter doesnt yet work right). Need to read more Hibernate docs to find out why. + * * Revision 1.7 2004/03/23 22:01:43 pelle * Bumped version numbers for commons and xmlsig througout. *************** *** 75,81 **** * @param orig */ ! public PostedTransaction(final UnPostedTransaction orig, final Date time) throws InvalidTransactionException { super(orig.getRequestId(), orig.getId(), orig.getComment(), orig.getItemList()); this.transactionTime = time; } --- 79,88 ---- * @param orig */ ! 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; + } Index: UnBalancedTransactionException.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/UnBalancedTransactionException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UnBalancedTransactionException.java 21 Nov 2003 04:43:20 -0000 1.2 --- UnBalancedTransactionException.java 25 Mar 2004 19:03:23 -0000 1.3 *************** *** 8,16 **** * To change this template use Options | File Templates. */ ! public final class UnBalancedTransactionException extends LedgerException { ! public UnBalancedTransactionException(final Ledger ledger,final UnPostedTransaction tran) { ! super(ledger); ! transaction=tran; } private final UnPostedTransaction transaction; --- 8,17 ---- * To change this template use Options | File Templates. */ ! 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; *************** *** 19,24 **** } - public final String getSubMessage() { - return "Transaction was Unbalanced by: "+transaction.getBalance(); - } } --- 20,22 ---- |
|
From: Pelle B. <pe...@us...> - 2004-03-25 16:56:01
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8651/src/java Modified Files: hibernate.properties Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. Index: hibernate.properties =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/hibernate.properties,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** hibernate.properties 24 Mar 2004 23:13:21 -0000 1.3 --- hibernate.properties 25 Mar 2004 16:45:08 -0000 1.4 *************** *** 1,7 **** ! hibernate.connection.username=sa ! hibernate.connection.password= ! hibernate.connection.url=jdbc:hsqldb:target/test-data/hibernate ! hibernate.connection.driver_class=org.hsqldb.jdbcDriver ! hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect #hibernate.show_sql true ! #hibernate.hbm2ddl.auto=create-drop \ No newline at end of file --- 1,413 ---- ! ###################### ! ### Query Language ### ! ###################### ! ! ## define query language constants / function names ! ! hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N' ! ! ! ! ################# ! ### Platforms ### ! ################# ! ! ## JNDI Datasource ! ! #hibernate.connection.datasource jdbc/test ! #hibernate.connection.username db2 ! #hibernate.connection.password db2 ! ! ! ## HypersonicSQL ! ! #hibernate.dialect net.sf.hibernate.dialect.HSQLDialect ! #hibernate.connection.driver_class org.hsqldb.jdbcDriver ! #hibernate.connection.username sa ! #hibernate.connection.password ! #hibernate.connection.url jdbc:hsqldb:hsql://localhost ! #hibernate.connection.url jdbc:hsqldb:test ! #hibernate.connection.url jdbc:hsqldb:. ! ! ! ## PostgreSQL ! ! #hibernate.dialect net.sf.hibernate.dialect.PostgreSQLDialect ! #hibernate.connection.driver_class org.postgresql.Driver ! #hibernate.connection.url jdbc:postgresql:template1 ! #hibernate.connection.username pg ! #hibernate.connection.password ! #hibernate.query.substitutions yes 'Y', no 'N' ! ! ! ## DB2 ! ! #hibernate.dialect net.sf.hibernate.dialect.DB2Dialect ! #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver ! #hibernate.connection.url jdbc:db2:test ! #hibernate.connection.username db2 ! #hibernate.connection.password db2 ! ! ! ## DB2/400 ! ! #hibernate.dialect net.sf.hibernate.dialect.DB2400Dialect ! #hibernate.connection.username user ! #hibernate.connection.password password ! ! ## Native driver ! #hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver ! #hibernate.connection.url jdbc:db2://systemname ! ! ## Toolbox driver ! #hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver ! #hibernate.connection.url jdbc:as400://systemname ! ! ! ## MySQL ! ! hibernate.dialect net.sf.hibernate.dialect.MySQLDialect ! #hibernate.connection.driver_class org.gjt.mm.mysql.Driver ! hibernate.connection.driver_class com.mysql.jdbc.Driver ! hibernate.connection.url jdbc:mysql://localhost/ledger?autoReconnect=true ! hibernate.connection.username ledger ! hibernate.connection.password ledgeruser ! ! ! ## Oracle ! ! #hibernate.dialect net.sf.hibernate.dialect.Oracle9Dialect ! #hibernate.dialect net.sf.hibernate.dialect.OracleDialect ! #hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver ! #hibernate.connection.username ora ! #hibernate.connection.password ora ! #hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test ! ! ! ## Sybase ! ! #hibernate.dialect net.sf.hibernate.dialect.SybaseDialect ! #hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver ! #hibernate.connection.username sa ! #hibernate.connection.password sasasa ! #hibernate.connection.rl jdbc:sybase:Tds:co3061835-a:5000/tempdb ! ! ! ## Mckoi SQL ! ! #hibernate.dialect net.sf.hibernate.dialect.MckoiDialect ! #hibernate.connection.driver_class com.mckoi.JDBCDriver ! #hibernate.connection.url jdbc:mckoi:/// ! #hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf ! #hibernate.connection.username admin ! #hibernate.connection.password nimda ! ! ! ## SAP DB ! ! #hibernate.dialect net.sf.hibernate.dialect.SAPDBDialect ! #hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB ! #hibernate.connection.url jdbc:sapdb://localhost/TST ! #hibernate.connection.username TEST ! #hibernate.connection.password TEST ! #hibernate.query.substitutions yes 'Y', no 'N' ! ! ! ## MS SQL Server ! ! #hibernate.dialect net.sf.hibernate.dialect.SQLServerDialect ! #hibernate.connection.username sa ! #hibernate.connection.password sa ! ! ## JSQL Driver ! #hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver ! #hibernate.connection.url jdbc:JSQLConnect://1E1/test ! ! ## JTURBO Driver ! #hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver ! #hibernate.connection.url jdbc:JTurbo://1E1:1433/test ! ! ## WebLogic Driver ! #hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver ! #hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433 ! ! ## Microsoft Driver (not recommended!) ! #hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver ! #hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor ! ! ## jTDS (not supported!) ! #hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver ! #hibernate.connection.url jdbc:jtds:sqlserver://1E1/test;SelectMethod=cursor ! #hibernate.jdbc.use_scrollable_resultset false ! ! ## Interbase ! ! #hibernate.dialect net.sf.hibernate.dialect.InterbaseDialect ! #hibernate.connection.username sysdba ! #hibernate.connection.password masterkey ! ! ## DO NOT specify hibernate.connection.sqlDialect ! ! ## InterClient ! ! #hibernate.connection.driver_class interbase.interclient.Driver ! #hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb ! ! ## Pure Java ! ! #hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver ! #hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb ! ! ! ## Pointbase ! ! #hibernate.dialect net.sf.hibernate.dialect.PointbaseDialect ! #hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver ! #hibernate.connection.url jdbc:pointbase:embedded:sample ! #hibernate.connection.username PBPUBLIC ! #hibernate.connection.password PBPUBLIC ! ! ! ! ################################# ! ### Hibernate Connection Pool ### ! ################################# ! ! hibernate.connection.pool_size 1 ! ! ! ! ########################### ! ### C3P0 Connection Pool### ! ########################### ! ! #hibernate.c3p0.max_size 2 ! #hibernate.c3p0.min_size 2 ! #hibernate.c3p0.timeout 5000 ! #hibernate.c3p0.max_statements 100 ! #hibernate.c3p0.idle_test_period 3000 ! #hibernate.c3p0.acquire_increment 2 ! ##hibernate.c3p0.validate false ! ! ! ! ################################### ! ### Apache DBCP Connection Pool ### ! ################################### ! ! ## connection pool ! ! #hibernate.dbcp.maxActive 100 ! #hibernate.dbcp.whenExhaustedAction 1 ! #hibernate.dbcp.maxWait 120000 ! #hibernate.dbcp.maxIdle 10 ! ! ## prepared statement cache ! ! #hibernate.dbcp.ps.maxActive 100 ! #hibernate.dbcp.ps.whenExhaustedAction 1 ! #hibernate.dbcp.ps.maxWait 120000 ! #hibernate.dbcp.ps.maxIdle 10 ! ! ## optional query to validate pooled connections: ! ! #hibernate.dbcp.validationQuery select 1 from dual ! #hibernate.dbcp.testOnBorrow true ! #hibernate.dbcp.testOnReturn false ! ! ! ! ############################## ! ### Proxool Connection Pool### ! ############################## ! ! ## Properties for external configuration of Proxool ! ! hibernate.proxool.pool_alias pool1 ! ! ## Only need one of the following ! ! #hibernate.proxool.existing_pool true ! #hibernate.proxool.xml proxool.xml ! #hibernate.proxool.properties proxool.properties ! ! ## Or, alternatively, all of these ! ## Standard configuration properties of Proxool ! ! #hibernate.proxool.house-keeping-sleep-time 30000 ! #hibernate.proxool.house-keeping-test-sql ! #hibernate.proxool.maximum-connection-count 4 ! #hibernate.proxool.maximum-connection-lifetime 4 ! #hibernate.proxool.simultaneous-build-throttle 2 ! #hibernate.proxool.maximum-active-time 500 ! #hibernate.proxool.minimum-connection-count 2 ! #hibernate.proxool.fatal-sql-exception ! #hibernate.proxool.prototype-count ! #hibernate.proxool.statistics ! #hibernate.proxool.recently-started-threshold ! #hibernate.proxool.overload-without-refusal-lifetime ! ! ! ! ################################# ! ### Plugin ConnectionProvider ### ! ################################# ! ! ## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics) ! ! #hibernate.connection.provider_class net.sf.hibernate.connection.DriverManagerConnectionProvider ! #hibernate.connection.provider_class net.sf.hibernate.connection.DatasourceConnectionProvider ! #hibernate.connection.provider_class net.sf.hibernate.connection.C3P0ConnectionProvider ! #hibernate.connection.provider_class net.sf.hibernate.connection.DBCPConnectionProvider ! #hibernate.connection.provider_class net.sf.hibernate.connection.ProxoolConnectionProvider ! ! ! ! ####################### ! ### Transaction API ### ! ####################### ! ! ## the Transaction API abstracts application code from the underlying JTA or JDBC transactions ! ! #hibernate.transaction.factory_class net.sf.hibernate.transaction.JTATransactionFactory ! #hibernate.transaction.factory_class net.sf.hibernate.transaction.JDBCTransactionFactory ! ! ! ## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI ! ## default is java:comp/UserTransaction ! ## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class ! ! #jta.UserTransaction jta/usertransaction ! #jta.UserTransaction javax.transaction.UserTransaction ! #jta.UserTransaction UserTransaction ! ! ! ## to use JCS caching with JTA, Hibernate must be able to obtain the JTA TransactionManager ! ! #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.JBossTransactionManagerLookup ! #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WeblogicTransactionManagerLookup ! #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereTransactionManagerLookup ! #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.OrionTransactionManagerLookup ! #hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.ResinTransactionManagerLookup ! ! ! ! ############################## ! ### Miscellaneous Settings ### ! ############################## ! ! ## print all generated SQL to the console ! #hibernate.show_sql true ! ! ! ## auto schema export ! ! #hibernate.hbm2ddl.auto create-drop ! #hibernate.hbm2ddl.auto create ! #hibernate.hbm2ddl.auto update ! ! ! ## specify a JDBC isolation level ! ! #hibernate.connection.isolation 4 ! ! ! ## set the JDBC fetch size ! ! #hibernate.jdbc.fetch_size 25 ! ! ! ## set the maximum JDBC 2 batch size (a nonzero value enables batching) ! ! hibernate.jdbc.batch_size 0 ! ! ! ## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default) ! ! #hibernate.jdbc.use_scrollable_resultset true ! ! ! ## use streams when writing binary types to / from JDBC ! ! hibernate.jdbc.use_streams_for_binary true ! ! ! ## use JDBC 3 PreparedStatement.getGeneratedKeys to get the identifier of an inserted row ! ! #hibernate.jdbc.use_get_generated_keys true ! ! ! ## specify a default schema for unqualified tablenames ! ! #hibernate.default_schema test ! ! ! ## use a custom stylesheet for XML generation (if not specified, hibernate-default.xslt will be used) ! ! #hibernate.xml.output_stylesheet C:/Hibernate/net/sf/hibernate/hibernate-default.xslt ! ! ! ## enable outerjoin fetching (specifying a Dialect will cause Hibernate to use sensible default) ! ! #hibernate.use_outer_join false ! ! ! ## set the maximum depth of the outer join fetch tree ! ! hibernate.max_fetch_depth 1 ! ! ! ## enable CGLIB reflection optimizer (enabled by default) ! ! #hibernate.cglib.use_reflection_optimizer false ! ! ! ! ########################## ! ### Second-level Cache ### ! ########################## ! ! ## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache) ! ! #hibernate.cache.use_minimal_puts true ! ! ! ## enable the query cache ! ! #hibernate.cache.use_query_cache true ! ! ! ## choose a cache implementation ! ! #hibernate.cache.provider_class net.sf.ehcache.hibernate.Provider ! #hibernate.cache.provider_class net.sf.hibernate.cache.EmptyCacheProvider ! #hibernate.cache.provider_class net.sf.hibernate.cache.HashtableCacheProvider ! #hibernate.cache.provider_class net.sf.hibernate.cache.TreeCacheProvider ! #hibernate.cache.provider_class net.sf.hibernate.cache.OSCacheProvider ! #hibernate.cache.provider_class net.sf.hibernate.cache.JCSCacheProvider ! #hibernate.cache.provider_class net.sf.hibernate.cache.SwarmCacheProvider ! ! ! ! ############ ! ### JNDI ### ! ############ ! ! ## specify a JNDI name for the SessionFactory ! ! #hibernate.session_factory_name hibernate/session_factory ! ! ! ## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction; ! ## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which ! ## is the best approach in an application server ! ! #file system ! #hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory ! #hibernate.jndi.url file:/ ! ! #WebSphere ! #hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory ! #hibernate.jndi.url iiop://localhost:900/ ! |
|
From: Pelle B. <pe...@us...> - 2004-03-25 16:55:58
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8651/src/java/org/neuclear/ledger/hibernate Modified Files: HHeld.hbm.xml HTransaction.hbm.xml HibernateLedger.java Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. Index: HTransaction.hbm.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HTransaction.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HTransaction.hbm.xml 24 Mar 2004 12:33:10 -0000 1.2 --- HTransaction.hbm.xml 25 Mar 2004 16:45:08 -0000 1.3 *************** *** 23,27 **** </property> <property name="comment" type="string"> ! <column name="comment" sql-type="varchar(256)" not-null="true"/> </property> --- 23,27 ---- </property> <property name="comment" type="string"> ! <column name="comment" sql-type="varchar(255)" not-null="true"/> </property> Index: HHeld.hbm.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HHeld.hbm.xml 24 Mar 2004 23:13:21 -0000 1.2 --- HHeld.hbm.xml 25 Mar 2004 16:45:08 -0000 1.3 *************** *** 27,31 **** </property> <property name="comment"> ! <column name="comment" sql-type="varchar(256)" not-null="true"/> </property> --- 27,31 ---- </property> <property name="comment"> ! <column name="comment" sql-type="varchar(255)" not-null="true"/> </property> Index: HibernateLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HibernateLedger.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HibernateLedger.java 24 Mar 2004 23:13:21 -0000 1.5 --- HibernateLedger.java 25 Mar 2004 16:45:08 -0000 1.6 *************** *** 328,331 **** --- 328,352 ---- } + public double getTestBalance() throws LowlevelLedgerException { + try { + Session ses = factory.openSession(); + Query q = ses.createQuery("select sum(item.amount) from HTransactionItem item"); + Iterator iter = q.iterate(); + if (iter.hasNext()) { + final Object o = iter.next(); + if (o != null) { + ses.close(); + return ((Double) o).doubleValue(); + } + // throw new LowlevelLedgerException(this,"Query returned more or less than one column"); + } + // throw new LowlevelLedgerException(this,"Query didnt return a row"); + ses.close(); + return 1; //if we have to return something here there has been an error and we better flag it. + } catch (HibernateException e) { + throw new LowlevelLedgerException(e); + } + } + public void close() throws LowlevelLedgerException { try { |
|
From: Pelle B. <pe...@us...> - 2004-03-25 16:55:36
|
Update of /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8554/src/java/org/neuclear/ledger/prevalent Modified Files: BalanceTable.java PrevalentLedger.java Added Files: GetTestBalanceQuery.java Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. --- NEW FILE: GetTestBalanceQuery.java --- package org.neuclear.ledger.prevalent; import org.prevayler.Query; import java.util.Date; /** * Created by IntelliJ IDEA. * User: pelleb * Date: Mar 22, 2004 * Time: 10:00:12 AM * To change this template use File | Settings | File Templates. */ public class GetTestBalanceQuery implements Query { /** * @param system The Prevalent System to be queried. * @param executionTime The "current" time. * @return The result of this Query. * @throws Exception Any Exception encountered by this Query. */ public Object query(Object system, Date executionTime) throws Exception { return new Double(((LedgerSystem) system).getBalanceTable().getTestBalance()); } } Index: PrevalentLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PrevalentLedger.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PrevalentLedger.java 24 Mar 2004 23:13:12 -0000 1.2 --- PrevalentLedger.java 25 Mar 2004 16:44:43 -0000 1.3 *************** *** 206,209 **** --- 206,217 ---- } + public double getTestBalance() throws LowlevelLedgerException { + try { + return ((Double) prevayler.execute(new GetTestBalanceQuery())).doubleValue(); + } catch (Exception e) { + throw new LowlevelLedgerException(e); + } + } + public void close() { try { Index: BalanceTable.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/BalanceTable.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** BalanceTable.java 22 Mar 2004 17:27:11 -0000 1.1.1.1 --- BalanceTable.java 25 Mar 2004 16:44:42 -0000 1.2 *************** *** 1,5 **** --- 1,7 ---- package org.neuclear.ledger.prevalent; + import gnu.trove.TDoubleProcedure; import gnu.trove.TObjectDoubleHashMap; + import org.neuclear.ledger.LowlevelLedgerException; import java.io.Serializable; *************** *** 8,15 **** * This contains the balances of all the accounts */ ! public final class BalanceTable implements Serializable{ ! private final TObjectDoubleHashMap balances=new TObjectDoubleHashMap(); ! double getBalance(final String id){ if (!balances.containsKey(id)) return 0; --- 10,17 ---- * This contains the balances of all the accounts */ ! public final class BalanceTable implements Serializable { ! private final TObjectDoubleHashMap balances = new TObjectDoubleHashMap(); ! double getBalance(final String id) { if (!balances.containsKey(id)) return 0; *************** *** 17,25 **** } ! double add(final String id,final double amount){ if (!balances.containsKey(id)) ! return balances.put(id,amount); ! final double nb=balances.get(id)+amount; ! return balances.put(id,nb); } } --- 19,56 ---- } ! double add(final String id, final double amount) { if (!balances.containsKey(id)) ! return balances.put(id, amount); ! final double nb = balances.get(id) + amount; ! return balances.put(id, nb); ! } ! ! double getTestBalance() throws LowlevelLedgerException { ! TestBalanceCalculator calc = new TestBalanceCalculator(); ! balances.forEachValue(calc); ! return calc.getBalance(); ! } ! ! private static class TestBalanceCalculator implements TDoubleProcedure { ! private double balance = 0; ! ! /** ! * Executes this procedure. A false return value indicates that ! * the application executing this procedure should not invoke this ! * procedure again. ! * ! * @param value a value of type <code>double</code> ! * @return true if additional invocations of the procedure are ! * allowed. ! */ ! public boolean execute(double value) { ! balance += value; ! return true; ! } ! ! private double getBalance() { ! return balance; ! } ! } } |
|
From: Pelle B. <pe...@us...> - 2004-03-25 16:55:11
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8437/src/java/org/neuclear/ledger Modified Files: Ledger.java Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. Index: Ledger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/Ledger.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Ledger.java 23 Mar 2004 22:01:43 -0000 1.13 --- Ledger.java 25 Mar 2004 16:44:22 -0000 1.14 *************** *** 4,7 **** --- 4,13 ---- * $Id$ * $Log$ + * Revision 1.14 2004/03/25 16:44:22 pelle + * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. + * The hibernate implementation has changed the comment size to 255 to work with mysql and now + * has included hibernates full hibernate.properties to make it easier to try various databases. + * It has now been tested with hsql and mysql. + * * Revision 1.13 2004/03/23 22:01:43 pelle * Bumped version numbers for commons and xmlsig througout. *************** *** 264,267 **** --- 270,278 ---- public abstract PostedHeldTransaction findHeldTransaction(String idstring) throws LowlevelLedgerException, UnknownTransactionException; + public abstract double getTestBalance() throws LowlevelLedgerException; + + public final boolean isBalanced() throws LowlevelLedgerException { + return getTestBalance() == 0; + } public final PostedTransaction transfer(String req, String id, String from, String to, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, UnBalancedTransactionException { |
|
From: Pelle B. <pe...@us...> - 2004-03-25 16:55:10
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8437/src/java/org/neuclear/ledger/tests Modified Files: AbstractLedgerTest.java Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. Index: AbstractLedgerTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests/AbstractLedgerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AbstractLedgerTest.java 24 Mar 2004 23:12:34 -0000 1.2 --- AbstractLedgerTest.java 25 Mar 2004 16:44:21 -0000 1.3 *************** *** 13,19 **** * $Id$ * $Log$ * Revision 1.2 2004/03/24 23:12:34 pelle * Working on Hibernate Implementation. ! * * Revision 1.1 2004/03/22 23:20:51 pelle * Working on Hibernate Implementation. --- 13,25 ---- * $Id$ * $Log$ + * Revision 1.3 2004/03/25 16:44:21 pelle + * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. + * The hibernate implementation has changed the comment size to 255 to work with mysql and now + * has included hibernates full hibernate.properties to make it easier to try various databases. + * It has now been tested with hsql and mysql. + * * Revision 1.2 2004/03/24 23:12:34 pelle * Working on Hibernate Implementation. ! * <p/> * Revision 1.1 2004/03/22 23:20:51 pelle * Working on Hibernate Implementation. *************** *** 178,181 **** --- 184,189 ---- System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); + + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 205,208 **** --- 213,217 ---- System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 217,220 **** --- 226,230 ---- } System.out.println("Bob's Balance: " + ledger.getBalance(CAROL)); + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 222,225 **** --- 232,236 ---- System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 253,256 **** --- 264,268 ---- System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 281,284 **** --- 293,297 ---- System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 309,312 **** --- 322,326 ---- System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 329,332 **** --- 343,347 ---- System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); + assertTrue("Ledger is balanced", ledger.isBalanced()); } *************** *** 335,351 **** final double amount = 50; final String book = "benchbook-" + System.currentTimeMillis(); ! final double fundamount = amount * (iterations + 1); ! ledger.transfer("fund", book, fundamount, "fund the benchmark"); System.out.println("Start Balance: " + ledger.getBalance(book)); assertEquals(fundamount, ledger.getAvailableBalance(book), 0); long start = System.currentTimeMillis(); for (int i = 0; i < iterations; i++) { ! ledger.verifiedTransfer(book, "fund", amount, "transaction" + i); } final long duration = System.currentTimeMillis() - start; System.out.println("" + iterations + " iterations took " + duration + " ms"); System.out.println("Each iteration took " + duration / iterations + " ms"); ! assertEquals(amount, ledger.getAvailableBalance(book), 0); } --- 350,373 ---- final double amount = 50; final String book = "benchbook-" + System.currentTimeMillis(); ! final double fundamount = amount * iterations; ! final String fundbook = "fund-" + System.currentTimeMillis(); ! final double fundbalance = ledger.getBalance(fundbook); ! ledger.transfer(fundbook, book, fundamount, "fund the benchmark"); System.out.println("Start Balance: " + ledger.getBalance(book)); assertEquals(fundamount, ledger.getAvailableBalance(book), 0); + assertEquals(fundamount, ledger.getBalance(book), 0); long start = System.currentTimeMillis(); for (int i = 0; i < iterations; i++) { ! ledger.verifiedTransfer(book, fundbook, amount, "transaction" + i); } final long duration = System.currentTimeMillis() - start; System.out.println("" + iterations + " iterations took " + duration + " ms"); System.out.println("Each iteration took " + duration / iterations + " ms"); ! assertEquals(0, ledger.getAvailableBalance(book), 0); ! assertEquals(0, ledger.getBalance(book), 0); ! assertEquals(fundbalance, ledger.getAvailableBalance(fundbook), 0); ! assertEquals(fundbalance, ledger.getBalance(fundbook), 0); ! assertTrue("Ledger is balanced", ledger.isBalanced()); } |
|
From: Pelle B. <pe...@us...> - 2004-03-25 16:55:10
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8437/src/java/org/neuclear/ledger/simple Modified Files: SimpleLedger.java Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. Index: SimpleLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple/SimpleLedger.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SimpleLedger.java 22 Mar 2004 23:20:50 -0000 1.3 --- SimpleLedger.java 25 Mar 2004 16:44:21 -0000 1.4 *************** *** 4,7 **** --- 4,13 ---- * $Id$ * $Log$ + * Revision 1.4 2004/03/25 16:44:21 pelle + * Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. + * The hibernate implementation has changed the comment size to 255 to work with mysql and now + * has included hibernates full hibernate.properties to make it easier to try various databases. + * It has now been tested with hsql and mysql. + * * Revision 1.3 2004/03/22 23:20:50 pelle * Working on Hibernate Implementation. *************** *** 140,144 **** while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (getAvailableBalance(item.getBook()) + item.getAmount() < 0) throw new InsufficientFundsException(this, item.getBook(), item.getAmount()); } --- 146,150 ---- while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (item.getAmount() < 0 && getAvailableBalance(item.getBook()) + item.getAmount() < 0) throw new InsufficientFundsException(this, item.getBook(), item.getAmount()); } *************** *** 292,295 **** --- 298,311 ---- } + public double getTestBalance() throws LowlevelLedgerException { + Iterator iter = balances.keySet().iterator(); + double test = 0; + while (iter.hasNext()) { + String s = (String) iter.next(); + test += ((Double) balances.get(s)).doubleValue(); + } + return test; + } + public void close() { //To change body of implemented methods use File | Settings | File Templates. |
|
From: Pelle B. <pe...@us...> - 2004-03-25 16:54:38
|
Update of /cvsroot/neuclear/neuclear-ledger-sql/src/java/org/neuclear/ledger/sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8339/src/java/org/neuclear/ledger/sql Modified Files: SQLLedger.java Log Message: Added getTestBalance() and isBalanced() to Ledger to see if ledger is balanced. The hibernate implementation has changed the comment size to 255 to work with mysql and now has included hibernates full hibernate.properties to make it easier to try various databases. It has now been tested with hsql and mysql. Index: SQLLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-sql/src/java/org/neuclear/ledger/sql/SQLLedger.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SQLLedger.java 23 Mar 2004 22:01:22 -0000 1.2 --- SQLLedger.java 25 Mar 2004 16:43:49 -0000 1.3 *************** *** 145,148 **** --- 145,169 ---- /** + * 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 PostedTransaction performVerifiedTransfer(UnPostedTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { + return null; + } + + /** + * 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 PostedHeldTransaction performHeldTransfer(UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { + return null; + } + + /** * The basic interface for creating Transactions in the database. * The implementing class takes this transacion information and stores it with an automatically generated uniqueid. *************** *** 199,202 **** --- 220,301 ---- } + /** + * 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 org.neuclear.ledger.InvalidTransactionException + * + * @throws org.neuclear.ledger.LowlevelLedgerException + * + * @throws org.neuclear.ledger.TransactionExpiredException + * + */ + public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException { + return null; + } + + /** + * Searches for a Transaction based on its Transaction ID + * + * @param id A valid ID + * @return The Transaction object + */ + public Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException, InvalidTransactionException, UnknownBookException { + return null; + } + + /** + * 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 double getBalance(String book) throws LowlevelLedgerException { + return 0; + } + + /** + * 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 double getAvailableBalance(String book) throws LowlevelLedgerException { + return 0; + } + public final PostedTransaction performCompleteHold(final PostedHeldTransaction hold, final double amount, final Date time, final String comment) throws TransactionExpiredException, InvalidTransactionException, LowlevelLedgerException { try { *************** *** 358,361 **** --- 457,468 ---- } + public double getTestBalance() throws LowlevelLedgerException { + return 0; + } + + public void close() throws LowlevelLedgerException { + + } + private PreparedStatement prepQuery(final String sql) throws SQLException, LowlevelLedgerException { return fact.prepareStatement(sql); *************** *** 483,486 **** --- 590,605 ---- } + public BookBrowser browse(String book) throws LowlevelLedgerException { + return null; + } + + public BookBrowser browseFrom(String book, Timestamp from) throws LowlevelLedgerException { + return null; + } + + public BookBrowser browseRange(String book, Timestamp from, Timestamp until) throws LowlevelLedgerException { + return null; + } + private final StatementFactory fact; } |
|
From: Pelle B. <pe...@us...> - 2004-03-24 23:24:03
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26129/src/java Modified Files: hibernate.properties Log Message: Working on Hibernate Implementation. Index: hibernate.properties =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/hibernate.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hibernate.properties 24 Mar 2004 12:33:10 -0000 1.2 --- hibernate.properties 24 Mar 2004 23:13:21 -0000 1.3 *************** *** 4,7 **** hibernate.connection.driver_class=org.hsqldb.jdbcDriver hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect ! hibernate.show_sql true #hibernate.hbm2ddl.auto=create-drop \ No newline at end of file --- 4,7 ---- hibernate.connection.driver_class=org.hsqldb.jdbcDriver hibernate.dialect=net.sf.hibernate.dialect.HSQLDialect ! #hibernate.show_sql true #hibernate.hbm2ddl.auto=create-drop \ No newline at end of file |
|
From: Pelle B. <pe...@us...> - 2004-03-24 23:24:03
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26129/src/java/org/neuclear/ledger/hibernate Modified Files: HHeld.hbm.xml HTransaction.java HibernateLedger.java Log Message: Working on Hibernate Implementation. Index: HHeld.hbm.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HHeld.hbm.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** HHeld.hbm.xml 23 Mar 2004 21:57:48 -0000 1.1 --- HHeld.hbm.xml 24 Mar 2004 23:13:21 -0000 1.2 *************** *** 18,27 **** not-null="true"/> </property> ! <property name="transactionTime"> ! <column name="transactiontime" sql-type="double" not-null="true"/> </property> ! <property name="expiryTime"> ! <column name="expirytime" sql-type="double" not-null="true"/> </property> --- 18,27 ---- not-null="true"/> </property> ! <property name="transactionTime" type="timestamp"> ! <column name="transactiontime" not-null="true"/> </property> ! <property name="expiryTime" type="timestamp"> ! <column name="expirytime" not-null="true"/> </property> *************** *** 30,34 **** not-null="true"/> </property> ! <set name="items" table="held_items" inverse="true" cascade="all"> <key column="held_id"/> <one-to-many class="org.neuclear.ledger.hibernate.HHeldItem"/> --- 30,34 ---- not-null="true"/> </property> ! <set name="items" table="held_items" cascade="all"> <key column="held_id"/> <one-to-many class="org.neuclear.ledger.hibernate.HHeldItem"/> Index: HibernateLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HibernateLedger.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** HibernateLedger.java 24 Mar 2004 12:33:10 -0000 1.4 --- HibernateLedger.java 24 Mar 2004 23:13:21 -0000 1.5 *************** *** 38,45 **** Configuration cfg = new Configuration() .addClass(HTransaction.class) ! .addClass(HTransactionItem.class); ! // .addClass(HHeld.class) ! // .addClass(HHeldItem.class); ! // new net.sf.hibernate.tool.hbm2ddl.SchemaExport(cfg).create(create,create); factory = cfg.buildSessionFactory(); } catch (HibernateException e) { --- 38,45 ---- Configuration cfg = new Configuration() .addClass(HTransaction.class) ! .addClass(HTransactionItem.class) ! .addClass(HHeld.class) ! .addClass(HHeldItem.class); ! new net.sf.hibernate.tool.hbm2ddl.SchemaExport(cfg).create(create, create); factory = cfg.buildSessionFactory(); } catch (HibernateException e) { *************** *** 60,68 **** try { Session ses = factory.openSession(); ! // net.sf.hibernate.Transaction t = ses.beginTransaction(); HTransaction posted = new HTransaction(trans, new Date()); ses.save(posted); ! ses.flush(); ! // t.commit(); ses.close(); return posted.createPosted(); --- 60,68 ---- try { Session ses = factory.openSession(); ! net.sf.hibernate.Transaction t = ses.beginTransaction(); HTransaction posted = new HTransaction(trans, new Date()); ses.save(posted); ! // ses.flush(); ! t.commit(); ses.close(); return posted.createPosted(); *************** *** 84,89 **** Session ses = factory.openSession(); net.sf.hibernate.Transaction t = ses.beginTransaction(); HTransaction posted = new HTransaction(trans, new Date()); ! ses.saveOrUpdate(posted); t.commit(); ses.close(); --- 84,97 ---- Session ses = factory.openSession(); net.sf.hibernate.Transaction t = ses.beginTransaction(); + Iterator iter = trans.getItems(); + // First lets check the balances + while (iter.hasNext()) { + TransactionItem item = (TransactionItem) iter.next(); + if (item.getAmount() < 0 && getAvailableBalance(item.getBook()) + item.getAmount() < 0) + throw new InsufficientFundsException(null, item.getBook(), item.getAmount()); + } + HTransaction posted = new HTransaction(trans, new Date()); ! ses.save(posted); t.commit(); ses.close(); *************** *** 106,114 **** try { Session ses = factory.openSession(); ! // net.sf.hibernate.Transaction t = ses.beginTransaction(); HHeld posted = new HHeld(trans, new Date()); ! ses.saveOrUpdate(posted); ! // t.commit(); ! ses.flush(); ses.close(); return posted.createPosted(); --- 114,122 ---- try { Session ses = factory.openSession(); ! net.sf.hibernate.Transaction t = ses.beginTransaction(); HHeld posted = new HHeld(trans, new Date()); ! ses.save(posted); ! t.commit(); ! // ses.flush(); ses.close(); return posted.createPosted(); *************** *** 128,131 **** --- 136,150 ---- */ public void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { + try { + Session ses = factory.openSession(); + net.sf.hibernate.Transaction t = ses.beginTransaction(); + HHeld posted = (HHeld) ses.get(HHeld.class, hold.getId()); + if (posted != null) + ses.delete(posted); + t.commit(); + ses.close(); + } catch (HibernateException e) { + throw new LowlevelLedgerException(e); + } } *************** *** 147,151 **** */ public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException { ! return null; } --- 166,191 ---- */ public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException, UnknownTransactionException { ! try { ! Session ses = factory.openSession(); ! net.sf.hibernate.Transaction t = ses.beginTransaction(); ! HHeld posted = (HHeld) ses.get(HHeld.class, hold.getId()); ! final Date time = new Date(); ! if (posted.getExpiryTime().before(time)) { ! ses.delete(posted); ! t.commit(); ! ses.close(); ! throw new TransactionExpiredException(this, hold); ! } ! HTransaction htran = new HTransaction(posted, time); ! htran.setComment(comment); ! ses.save(htran); ! if (posted != null) ! ses.delete(posted); ! t.commit(); ! ses.close(); ! return htran.createPosted(); ! } catch (HibernateException e) { ! throw new LowlevelLedgerException(this, e); ! } } *************** *** 157,161 **** */ public Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException, InvalidTransactionException, UnknownBookException { ! return null; } --- 197,218 ---- */ public Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException, InvalidTransactionException, UnknownBookException { ! try { ! Session ses = factory.openSession(); ! Query q = ses.createQuery("select transactionTime from HTransaction item where item.id = ?"); ! q.setString(0, id); ! Iterator iter = q.iterate(); ! if (iter.hasNext()) { ! final Object o = iter.next(); ! if (o != null) { ! ses.close(); ! return ((Timestamp) o); ! } ! } ! ses.close(); ! throw new UnknownTransactionException(this, id); ! } catch (HibernateException e) { ! throw new LowlevelLedgerException(e); ! } ! } *************** *** 183,197 **** public double getBalance(String book) throws LowlevelLedgerException { try { ! Session sess = factory.openSession(); ! Query q = sess.createQuery("select sum(item.amount) from HTransactionItem item where item.book = ?"); q.setString(0, book); ! Iterator cats = q.iterate(); ! if (cats.hasNext()) { ! final Object o = cats.next(); ! if (o != null) return ((Double) o).doubleValue(); // throw new LowlevelLedgerException(this,"Query returned more or less than one column"); } // throw new LowlevelLedgerException(this,"Query didnt return a row"); return 0; } catch (HibernateException e) { --- 240,278 ---- public double getBalance(String book) throws LowlevelLedgerException { try { ! Session ses = factory.openSession(); ! Query q = ses.createQuery("select sum(item.amount) from HTransactionItem item where item.book = ?"); q.setString(0, book); ! Iterator iter = q.iterate(); ! if (iter.hasNext()) { ! final Object o = iter.next(); ! if (o != null) { ! ses.close(); return ((Double) o).doubleValue(); + } // throw new LowlevelLedgerException(this,"Query returned more or less than one column"); } // throw new LowlevelLedgerException(this,"Query didnt return a row"); + ses.close(); + return 0; + } catch (HibernateException e) { + throw new LowlevelLedgerException(e); + } + } + + private double getHeldBalance(String book) throws LowlevelLedgerException { + try { + Session ses = factory.openSession(); + Query q = ses.createQuery("select sum(item.amount) from HHeldItem item where item.book = ? and item.amount<0 and item.held.expiryTime < ?"); + q.setString(0, book); + q.setTimestamp(1, new Date()); + Iterator iter = q.iterate(); + if (iter.hasNext()) { + final Object o = iter.next(); + if (o != null) { + ses.close(); + return ((Double) o).doubleValue(); + } + } + ses.close(); return 0; } catch (HibernateException e) { *************** *** 221,225 **** public double getAvailableBalance(String book) throws LowlevelLedgerException { ! return 0; } --- 302,306 ---- public double getAvailableBalance(String book) throws LowlevelLedgerException { ! return getHeldBalance(book) + getBalance(book); } *************** *** 231,235 **** */ public PostedHeldTransaction findHeldTransaction(String idstring) throws LowlevelLedgerException, UnknownTransactionException { ! return null; } --- 312,329 ---- */ public PostedHeldTransaction findHeldTransaction(String idstring) throws LowlevelLedgerException, UnknownTransactionException { ! try { ! Session ses = factory.openSession(); ! HHeld held = (HHeld) ses.get(HHeld.class, idstring); ! if (held == null) { ! ses.close(); ! return held.createPosted(); ! } ! ses.close(); ! throw new UnknownTransactionException(this, idstring); ! } catch (HibernateException e) { ! throw new LowlevelLedgerException(e); ! } catch (InvalidTransactionException e) { ! throw new LowlevelLedgerException(e); ! } } Index: HTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HTransaction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HTransaction.java 24 Mar 2004 12:33:10 -0000 1.2 --- HTransaction.java 24 Mar 2004 23:13:21 -0000 1.3 *************** *** 33,36 **** --- 33,44 ---- } + public HTransaction(HHeld held, Date transactionTime) { + this.id = held.getId(); + this.requestId = held.getRequestId(); + this.transactionTime = transactionTime; + this.comment = held.getComment(); + this.items = held.getItems(); + } + public String getId() { return id; |
|
From: Pelle B. <pe...@us...> - 2004-03-24 23:23:54
|
Update of /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26080/src/java/org/neuclear/ledger/prevalent Modified Files: PostVerifiedTransfer.java PrevalentLedger.java Log Message: Working on Hibernate Implementation. Index: PostVerifiedTransfer.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PostVerifiedTransfer.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PostVerifiedTransfer.java 22 Mar 2004 17:27:10 -0000 1.1.1.1 --- PostVerifiedTransfer.java 24 Mar 2004 23:13:12 -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 PostVerifiedTransfer implements TransactionWithQuery{ final UnPostedTransaction tran; --- 14,18 ---- * To change this template use File | Settings | File Templates. */ ! public class PostVerifiedTransfer implements TransactionWithQuery { final UnPostedTransaction tran; *************** *** 31,60 **** */ 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()); ! Iterator iter=tran.getItems(); // First lets check the balances while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (system.getAvailableBalance(item.getBook())+item.getAmount()<0) ! throw new InsufficientFundsException(null,item.getBook(),item.getAmount()); } // We're ok so lets register them. ! table.register(tran.getId(),executionTime); ! table.register(tran.getRequestId(),executionTime); // Now modify the balances ! iter=tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! system.getBalanceTable().add(item.getBook(),item.getAmount()); } ! return new PostedTransaction(tran,executionTime); } } --- 31,61 ---- */ 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()); ! Iterator iter = tran.getItems(); // First lets check the balances while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! final double balance = system.getAvailableBalance(item.getBook()); ! if (item.getAmount() < 0 && balance + item.getAmount() < 0) ! throw new InsufficientFundsException(null, item.getBook(), item.getAmount(), balance); } // We're ok so lets register them. ! table.register(tran.getId(), executionTime); ! table.register(tran.getRequestId(), executionTime); // Now modify the balances ! iter = tran.getItems(); while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! system.getBalanceTable().add(item.getBook(), item.getAmount()); } ! return new PostedTransaction(tran, executionTime); } } Index: PrevalentLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PrevalentLedger.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** PrevalentLedger.java 22 Mar 2004 17:27:11 -0000 1.1.1.1 --- PrevalentLedger.java 24 Mar 2004 23:13:12 -0000 1.2 *************** *** 2,11 **** import org.neuclear.ledger.*; - import org.prevayler.PrevaylerFactory; import org.prevayler.Prevayler; - import java.util.Date; import java.io.IOException; import java.io.Serializable; /** --- 2,11 ---- import org.neuclear.ledger.*; import org.prevayler.Prevayler; + import org.prevayler.PrevaylerFactory; import java.io.IOException; import java.io.Serializable; + import java.util.Date; /** *************** *** 22,27 **** super(id); prevayler = PrevaylerFactory.createPrevayler(new LedgerSystem(id), basedir); ! system=(LedgerSystem) prevayler.prevalentSystem(); ! } --- 22,26 ---- super(id); prevayler = PrevaylerFactory.createPrevayler(new LedgerSystem(id), basedir); ! system = (LedgerSystem) prevayler.prevalentSystem(); } *************** *** 39,47 **** } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException)e; if (e instanceof UnBalancedTransactionException) ! throw (UnBalancedTransactionException)e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException)e; throw new LowlevelLedgerException(e); } --- 38,46 ---- } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException) e; if (e instanceof UnBalancedTransactionException) ! throw (UnBalancedTransactionException) e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException) e; throw new LowlevelLedgerException(e); } *************** *** 59,67 **** } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException)e; if (e instanceof UnBalancedTransactionException) ! throw (UnBalancedTransactionException)e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException)e; throw new LowlevelLedgerException(e); } --- 58,66 ---- } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException) e; if (e instanceof UnBalancedTransactionException) ! throw (UnBalancedTransactionException) e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException) e; throw new LowlevelLedgerException(e); } *************** *** 81,89 **** } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException)e; if (e instanceof UnBalancedTransactionException) ! throw (UnBalancedTransactionException)e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException)e; throw new LowlevelLedgerException(e); } --- 80,88 ---- } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException) e; if (e instanceof UnBalancedTransactionException) ! throw (UnBalancedTransactionException) e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException) e; throw new LowlevelLedgerException(e); } *************** *** 99,103 **** if (system.getTransactionTable().exists(id)) return new Date(system.getTransactionTable().getTransactionTime(id)); ! throw new UnknownTransactionException(this,id); } --- 98,102 ---- if (system.getTransactionTable().exists(id)) return new Date(system.getTransactionTable().getTransactionTime(id)); ! throw new UnknownTransactionException(this, id); } *************** *** 125,129 **** public double getBalance(String book) throws LowlevelLedgerException { try { ! return ((Double)prevayler.execute(new GetBalanceQuery(book))).doubleValue(); } catch (Exception e) { throw new LowlevelLedgerException(e); --- 124,128 ---- public double getBalance(String book) throws LowlevelLedgerException { try { ! return ((Double) prevayler.execute(new GetBalanceQuery(book))).doubleValue(); } catch (Exception e) { throw new LowlevelLedgerException(e); *************** *** 153,157 **** public double getAvailableBalance(String book) throws LowlevelLedgerException { try { ! return ((Double)prevayler.execute(new GetAvailableBalanceQuery(book))).doubleValue(); } catch (Exception e) { throw new LowlevelLedgerException(e); --- 152,156 ---- public double getAvailableBalance(String book) throws LowlevelLedgerException { try { ! return ((Double) prevayler.execute(new GetAvailableBalanceQuery(book))).doubleValue(); } catch (Exception e) { throw new LowlevelLedgerException(e); *************** *** 185,205 **** } catch (Exception e) { if (e instanceof UnknownTransactionException) ! throw (UnknownTransactionException)e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException)e; throw new LowlevelLedgerException(e); } } ! public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException { try { ! return (PostedTransaction) prevayler.execute(new CompleteHeldTransaction(hold,amount,comment)); } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException)e; if (e instanceof TransactionExpiredException) ! throw (TransactionExpiredException)e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException)e; throw new LowlevelLedgerException(e); --- 184,204 ---- } catch (Exception e) { if (e instanceof UnknownTransactionException) ! throw (UnknownTransactionException) e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException) e; throw new LowlevelLedgerException(e); } } ! public PostedTransaction performCompleteHold(PostedHeldTransaction hold, double amount, String comment) throws InvalidTransactionException, LowlevelLedgerException, TransactionExpiredException { try { ! return (PostedTransaction) prevayler.execute(new CompleteHeldTransaction(hold, amount, comment)); } catch (Exception e) { if (e instanceof InvalidTransactionException) ! throw (InvalidTransactionException) e; if (e instanceof TransactionExpiredException) ! throw (TransactionExpiredException) e; if (e instanceof LowlevelLedgerException) ! throw (LowlevelLedgerException) e; throw new LowlevelLedgerException(e); |
|
From: Pelle B. <pe...@us...> - 2004-03-24 23:23:47
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25877/src/java/org/neuclear/ledger/tests Modified Files: AbstractLedgerTest.java Log Message: Working on Hibernate Implementation. Index: AbstractLedgerTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests/AbstractLedgerTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractLedgerTest.java 22 Mar 2004 23:20:51 -0000 1.1 --- AbstractLedgerTest.java 24 Mar 2004 23:12:34 -0000 1.2 *************** *** 13,19 **** * $Id$ * $Log$ ! * Revision 1.1 2004/03/22 23:20:51 pelle * Working on Hibernate Implementation. * * Revision 1.2 2004/03/22 21:59:38 pelle * SimpleLedger now passes all unit tests --- 13,22 ---- * $Id$ * $Log$ ! * Revision 1.2 2004/03/24 23:12:34 pelle * Working on Hibernate Implementation. * + * Revision 1.1 2004/03/22 23:20:51 pelle + * Working on Hibernate Implementation. + * <p/> * Revision 1.2 2004/03/22 21:59:38 pelle * SimpleLedger now passes all unit tests *************** *** 135,138 **** --- 138,142 ---- static final String BOB = "bob"; static final String ALICE = "alice"; + static final String CAROL = "carol"; *************** *** 193,197 **** try { ledger.verifiedTransfer(ALICE, BOB, ledger.getAvailableBalance(ALICE) + 10, "To much"); ! assertTrue("InssuficientFundsException should have been thrown", false); } catch (InsufficientFundsException e) { ; --- 197,201 ---- try { ledger.verifiedTransfer(ALICE, BOB, ledger.getAvailableBalance(ALICE) + 10, "To much"); ! assertTrue("InssuficientFundsException should have been thrown. Attempted to transfer: " + (ledger.getAvailableBalance(ALICE) + 10), false); } catch (InsufficientFundsException e) { ; *************** *** 204,216 **** public final void testMultiTransfer() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { ! final double bobBalance = ledger.getBalance(BOB); int cumulative = 0; for (int i = 0; i < 100; i++) { ! ledger.transfer("req" + i + System.currentTimeMillis(), "x" + i + System.currentTimeMillis(), "Issuer", "bob", i, "fund it"); cumulative += i; ! assertEquals("BOB BALANCE", bobBalance + cumulative, ledger.getBalance(BOB), 0); ! assertEquals("BOB AVAILABLE BALANCE", ledger.getBalance(BOB), ledger.getAvailableBalance(BOB), 0); } ! System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); } --- 208,220 ---- public final void testMultiTransfer() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { ! final double bobBalance = ledger.getBalance(CAROL); 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); ! assertEquals("BOB AVAILABLE BALANCE", ledger.getBalance(CAROL), ledger.getAvailableBalance(CAROL), 0); } ! System.out.println("Bob's Balance: " + ledger.getBalance(CAROL)); } *************** *** 327,330 **** --- 331,352 ---- } + public final void testNaiveBenchmark() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { + final int iterations = 1000; + final double amount = 50; + final String book = "benchbook-" + System.currentTimeMillis(); + final double fundamount = amount * (iterations + 1); + ledger.transfer("fund", book, fundamount, "fund the benchmark"); + System.out.println("Start Balance: " + ledger.getBalance(book)); + assertEquals(fundamount, ledger.getAvailableBalance(book), 0); + + long start = System.currentTimeMillis(); + for (int i = 0; i < iterations; i++) { + ledger.verifiedTransfer(book, "fund", amount, "transaction" + i); + } + final long duration = System.currentTimeMillis() - start; + System.out.println("" + iterations + " iterations took " + duration + " ms"); + System.out.println("Each iteration took " + duration / iterations + " ms"); + assertEquals(amount, ledger.getAvailableBalance(book), 0); + } protected Ledger ledger; |
|
From: Pelle B. <pe...@us...> - 2004-03-24 23:23:20
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25877/src/java/org/neuclear/ledger Modified Files: InsufficientFundsException.java InvalidTransactionException.java Log Message: Working on Hibernate Implementation. Index: InvalidTransactionException.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/InvalidTransactionException.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InvalidTransactionException.java 21 Mar 2004 00:48:36 -0000 1.3 --- InvalidTransactionException.java 24 Mar 2004 23:12:40 -0000 1.4 *************** *** 11,19 **** public InvalidTransactionException(final Ledger ledger, final String message) { super(ledger); } public final String getSubMessage() { return "Validation Error: " + message; - } --- 11,19 ---- public InvalidTransactionException(final Ledger ledger, final String message) { super(ledger); + this.message = message; } public final String getSubMessage() { return "Validation Error: " + message; } Index: InsufficientFundsException.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/InsufficientFundsException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** InsufficientFundsException.java 22 Mar 2004 17:33:02 -0000 1.1 --- InsufficientFundsException.java 24 Mar 2004 23:12:35 -0000 1.2 *************** *** 9,12 **** --- 9,18 ---- */ public class InsufficientFundsException extends InvalidTransactionException { + public InsufficientFundsException(final Ledger ledger, final String book, final double amount, final double balance) { + super(ledger, " Insufficient funds in account: " + book + " to cover the amount: " + amount + " available: " + balance); + this.amount = amount; + this.book = book; + } + public InsufficientFundsException(final Ledger ledger, final String book, final double amount) { super(ledger, " Insufficient funds in account: " + book + " to cover the amount: " + amount); |