|
From: <pe...@us...> - 2003-10-28 23:43:22
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger
In directory sc8-pr-cvs1:/tmp/cvs-serv8557/src/java/org/neuclear/ledger
Modified Files:
Ledger.java LedgerFactory.java UnPostedTransaction.java
Log Message:
The PassPhraseDialogue now works. It simply presents itself as a simple modal dialog box asking for a passphrase.
The two SignerStore implementations both use it for the passphrase.
Index: Ledger.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/Ledger.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Ledger.java 25 Oct 2003 00:39:05 -0000 1.3
--- Ledger.java 28 Oct 2003 23:43:14 -0000 1.4
***************
*** 4,7 ****
--- 4,11 ----
* $Id$
* $Log$
+ * Revision 1.4 2003/10/28 23:43:14 pelle
+ * The PassPhraseDialogue now works. It simply presents itself as a simple modal dialog box asking for a passphrase.
+ * The two SignerStore implementations both use it for the passphrase.
+ *
* Revision 1.3 2003/10/25 00:39:05 pelle
* Fixed SmtpSender it now sends the messages.
***************
*** 317,321 ****
public static Ledger getInstance() throws ConfigurationException {
! return (Ledger) Configuration.getContainer(Ledger.class).getComponentInstance(Ledger.class);
}
}
--- 321,325 ----
public static Ledger getInstance() throws ConfigurationException {
! return (Ledger) Configuration.getComponent(Ledger.class, "neuclear-ledger");
}
}
Index: LedgerFactory.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/LedgerFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** LedgerFactory.java 25 Oct 2003 00:39:05 -0000 1.2
--- LedgerFactory.java 28 Oct 2003 23:43:15 -0000 1.3
***************
*** 8,11 ****
--- 8,15 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/10/28 23:43:15 pelle
+ * The PassPhraseDialogue now works. It simply presents itself as a simple modal dialog box asking for a passphrase.
+ * The two SignerStore implementations both use it for the passphrase.
+ *
* Revision 1.2 2003/10/25 00:39:05 pelle
* Fixed SmtpSender it now sends the messages.
***************
*** 69,73 ****
public final Ledger getLedger(String name) throws LedgerCreationException {
try {
! return (Ledger) Configuration.getContainer(Ledger.class).getComponentInstance(Ledger.class);
} catch (ConfigurationException e) {
throw new LedgerCreationException(e);
--- 73,77 ----
public final Ledger getLedger(String name) throws LedgerCreationException {
try {
! return (Ledger) Configuration.getComponent(Ledger.class, "neuclear-ledger");
} catch (ConfigurationException e) {
throw new LedgerCreationException(e);
Index: UnPostedTransaction.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/UnPostedTransaction.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** UnPostedTransaction.java 1 Oct 2003 17:35:53 -0000 1.2
--- UnPostedTransaction.java 28 Oct 2003 23:43:15 -0000 1.3
***************
*** 8,11 ****
--- 8,15 ----
* $Id$
* $Log$
+ * Revision 1.3 2003/10/28 23:43:15 pelle
+ * The PassPhraseDialogue now works. It simply presents itself as a simple modal dialog box asking for a passphrase.
+ * The two SignerStore implementations both use it for the passphrase.
+ *
* Revision 1.2 2003/10/01 17:35:53 pelle
* Made as much as possible immutable for security and reliability reasons.
***************
*** 37,44 ****
*
*/
import java.util.Date;
import java.util.Iterator;
- import java.util.List;
import java.util.LinkedList;
/**
--- 41,49 ----
*
*/
+
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedList;
+ import java.util.List;
/**
***************
*** 46,50 ****
*/
public class UnPostedTransaction extends Transaction {
! /**
* Basic rules for creating Transactions:
* <ul>
--- 51,55 ----
*/
public class UnPostedTransaction extends Transaction {
! /**
* Basic rules for creating Transactions:
* <ul>
***************
*** 53,72 ****
* <li>if there is an expiryTime it must not be before the transactionTime
* </ul>
! * @param ledger
! * @param comment
! * @param transactionTime
*/
! public UnPostedTransaction(Ledger ledger, String comment, Date transactionTime) throws InvalidTransactionException {
! this(ledger,comment,transactionTime,false);
}
! UnPostedTransaction(Ledger ledger, String comment, Date transactionTime, boolean posted) throws InvalidTransactionException {
! super(ledger,transactionTime,comment);
// if (amount<0)
// throw new TransactionException("Negative Transactions are not allowed");
! if (transactionTime==null)
! throw new InvalidTransactionException(ledger,"Transaction must have a Transaction Time");
! balance=0;
! items=new LinkedList();
}
--- 58,79 ----
* <li>if there is an expiryTime it must not be before the transactionTime
* </ul>
! *
! * @param ledger
! * @param comment
! * @param transactionTime
*/
! public UnPostedTransaction(Ledger ledger, String comment, Date transactionTime) throws InvalidTransactionException {
! this(ledger, comment, transactionTime, false);
}
!
! UnPostedTransaction(Ledger ledger, String comment, Date transactionTime, boolean posted) throws InvalidTransactionException {
! super(ledger, transactionTime, comment);
// if (amount<0)
// throw new TransactionException("Negative Transactions are not allowed");
! if (transactionTime == null)
! throw new InvalidTransactionException(ledger, "Transaction must have a Transaction Time");
! balance = 0;
! items = new LinkedList();
}
***************
*** 74,87 ****
* Posts a Transaction permanently to it's ledger.
* Remeber a Transaction must be balanced to be posted.
* @return A Unique Transaction ID
*/
public synchronized PostedTransaction post() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException {
! PostedTransaction postTransaction=null;
if (isBalanced()) {
getLedger().beginLinkedTransaction();
! postTransaction=postTransaction();
getLedger().endLinkedTransactions();
} else
! throw new UnBalancedTransactionException(getLedger(),this);
return postTransaction;
}
--- 81,95 ----
* Posts a Transaction permanently to it's ledger.
* Remeber a Transaction must be balanced to be posted.
+ *
* @return A Unique Transaction ID
*/
public synchronized PostedTransaction post() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException {
! PostedTransaction postTransaction = null;
if (isBalanced()) {
getLedger().beginLinkedTransaction();
! postTransaction = postTransaction();
getLedger().endLinkedTransactions();
} else
! throw new UnBalancedTransactionException(getLedger(), this);
return postTransaction;
}
***************
*** 93,105 ****
/**
* Is the Transaction Balanced
! * @return
*/
public boolean isBalanced() {
! return (getBalance()==0);
}
/**
* Get the balance of the Transaction. This should be 0 for posting.
! * @return
*/
public double getBalance() {
--- 101,115 ----
/**
* Is the Transaction Balanced
! *
! * @return
*/
public boolean isBalanced() {
! return (getBalance() == 0);
}
/**
* Get the balance of the Transaction. This should be 0 for posting.
! *
! * @return
*/
public double getBalance() {
***************
*** 110,117 ****
return items.iterator();
}
! TransactionItem [] getItemArray() {
! TransactionItem itemarray[]=new TransactionItem[items.size()];
for (int i = 0; i < items.size(); i++) {
! itemarray[0] = (org.neuclear.ledger.TransactionItem) items.get(i);
}
--- 120,128 ----
return items.iterator();
}
!
! TransactionItem[] getItemArray() {
! TransactionItem itemarray[] = new TransactionItem[items.size()];
for (int i = 0; i < items.size(); i++) {
! itemarray[i] = (org.neuclear.ledger.TransactionItem) items.get(i);
}
***************
*** 128,142 ****
* <li>Book must be from the same Ledger as the Transaction
* </ul>
! * @param book
! * @param amount
* @return the new balance
*/
! public synchronized double addItem(Book book,double amount) throws InvalidTransactionException {
! if (book==null)
! throw new InvalidTransactionException(getLedger(),"You must supply a valid Book");
if (!book.getLedger().equals(getLedger()))
! throw new InvalidTransactionException(getLedger(),"The book must be part of the same Ledger as the Transaction");
! items.add(new TransactionItem(book,amount));
! balance+=amount;
return balance;
}
--- 139,154 ----
* <li>Book must be from the same Ledger as the Transaction
* </ul>
! *
! * @param book
! * @param amount
* @return the new balance
*/
! public synchronized double addItem(Book book, double amount) throws InvalidTransactionException {
! if (book == null)
! throw new InvalidTransactionException(getLedger(), "You must supply a valid Book");
if (!book.getLedger().equals(getLedger()))
! throw new InvalidTransactionException(getLedger(), "The book must be part of the same Ledger as the Transaction");
! items.add(new TransactionItem(book, amount));
! balance += amount;
return balance;
}
|