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-04-07 17:35:12
|
Update of /cvsroot/neuclear/neuclear-commons In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14664 Modified Files: project.xml Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/project.xml,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** project.xml 29 Mar 2004 23:48:32 -0000 1.25 --- project.xml 7 Apr 2004 17:22:10 -0000 1.26 *************** *** 4,8 **** <name>NeuClear Commons</name> <id>neuclear-commons</id> ! <currentVersion>0.6.1-SNAPSHOT</currentVersion> <inceptionYear>2003</inceptionYear> <package>org.neuclear.commons</package> --- 4,8 ---- <name>NeuClear Commons</name> <id>neuclear-commons</id> ! <currentVersion>0.7-SNAPSHOT</currentVersion> <inceptionYear>2003</inceptionYear> <package>org.neuclear.commons</package> |
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14664/src/java/org/neuclear/commons/crypto/passphraseagents Modified Files: ConsoleAgent.java GuiDialogAgent.java InteractiveAgent.java ServletPassPhraseAgent.java Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. Index: GuiDialogAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/GuiDialogAgent.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GuiDialogAgent.java 29 Mar 2004 23:48:32 -0000 1.8 --- GuiDialogAgent.java 7 Apr 2004 17:22:10 -0000 1.9 *************** *** 1,5 **** package org.neuclear.commons.crypto.passphraseagents; ! import org.neuclear.commons.crypto.signers.Signer; import java.awt.*; --- 1,6 ---- package org.neuclear.commons.crypto.passphraseagents; ! import org.neuclear.commons.crypto.signers.BrowsableSigner; ! import org.neuclear.commons.crypto.signers.SetPublicKeyCallBack; import java.awt.*; *************** *** 31,34 **** --- 32,39 ---- $Id$ $Log$ + Revision 1.9 2004/04/07 17:22:10 pelle + Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. + The XMLSig classes have also been updated to support this. + Revision 1.8 2004/03/29 23:48:32 pelle InteractiveAgent now has a new method which allows signers to ask for a passphrase without specifying alias. *************** *** 256,263 **** * a list of included aliases or even create a new keypair. * ! * @return * @throws UserCancellationException */ ! public char[] getPassPhrase(Signer signer) throws UserCancellationException { nameLabel.setVisible(false); createNew.setVisible(true); --- 261,268 ---- * a list of included aliases or even create a new keypair. * ! * @return * @throws UserCancellationException */ ! public char[] getPassPhrase(BrowsableSigner signer) throws UserCancellationException { nameLabel.setVisible(false); createNew.setVisible(true); *************** *** 266,269 **** --- 271,285 ---- } + /** + * The User is asked to pick a name by the PassPhraseAgent. The PassPhraseAgent can query the given signer for + * a list of included aliases or even create a new keypair. + * + * @return + * @throws UserCancellationException + */ + public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { + return new byte[0]; + } + private final TextField passphrase; private final Button ok; Index: ConsoleAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/ConsoleAgent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ConsoleAgent.java 31 Mar 2004 23:14:03 -0000 1.4 --- ConsoleAgent.java 7 Apr 2004 17:22:09 -0000 1.5 *************** *** 2,6 **** import org.neuclear.commons.Utility; ! import org.neuclear.commons.crypto.signers.Signer; import java.io.BufferedReader; --- 2,7 ---- import org.neuclear.commons.Utility; ! import org.neuclear.commons.crypto.signers.BrowsableSigner; ! import org.neuclear.commons.crypto.signers.SetPublicKeyCallBack; import java.io.BufferedReader; *************** *** 30,33 **** --- 31,38 ---- $Id$ $Log$ + Revision 1.5 2004/04/07 17:22:09 pelle + Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. + The XMLSig classes have also been updated to support this. + Revision 1.4 2004/03/31 23:14:03 pelle misc changes *************** *** 138,141 **** --- 143,147 ---- } + /** * The User is asked to pick a name by the PassPhraseAgent. The PassPhraseAgent can query the given signer for *************** *** 145,151 **** * @throws UserCancellationException */ ! public char[] getPassPhrase(Signer signer) throws UserCancellationException { return new char[0]; } } --- 151,168 ---- * @throws UserCancellationException */ ! public char[] getPassPhrase(BrowsableSigner signer) throws UserCancellationException { return new char[0]; } + /** + * The User is asked to pick a name by the PassPhraseAgent. The PassPhraseAgent can query the given signer for + * a list of included aliases or even create a new keypair. + * + * @return + * @throws UserCancellationException + */ + public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { + return new byte[0]; + } + } Index: InteractiveAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/InteractiveAgent.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** InteractiveAgent.java 29 Mar 2004 23:48:32 -0000 1.4 --- InteractiveAgent.java 7 Apr 2004 17:22:10 -0000 1.5 *************** *** 1,5 **** package org.neuclear.commons.crypto.passphraseagents; ! import org.neuclear.commons.crypto.signers.Signer; /* --- 1,6 ---- package org.neuclear.commons.crypto.passphraseagents; ! import org.neuclear.commons.crypto.signers.BrowsableSigner; ! import org.neuclear.commons.crypto.signers.SetPublicKeyCallBack; /* *************** *** 23,26 **** --- 24,31 ---- $Id$ $Log$ + Revision 1.5 2004/04/07 17:22:10 pelle + Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. + The XMLSig classes have also been updated to support this. + Revision 1.4 2004/03/29 23:48:32 pelle InteractiveAgent now has a new method which allows signers to ask for a passphrase without specifying alias. *************** *** 65,69 **** * @throws UserCancellationException */ ! char[] getPassPhrase(final Signer signer) throws UserCancellationException; --- 70,74 ---- * @throws UserCancellationException */ ! byte[] sign(final BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException; Index: ServletPassPhraseAgent.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/ServletPassPhraseAgent.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ServletPassPhraseAgent.java 31 Mar 2004 23:14:03 -0000 1.5 --- ServletPassPhraseAgent.java 7 Apr 2004 17:22:10 -0000 1.6 *************** *** 1,5 **** package org.neuclear.commons.crypto.passphraseagents; ! import org.neuclear.commons.crypto.signers.Signer; import javax.servlet.http.HttpServletRequest; --- 1,6 ---- package org.neuclear.commons.crypto.passphraseagents; ! import org.neuclear.commons.crypto.signers.BrowsableSigner; ! import org.neuclear.commons.crypto.signers.SetPublicKeyCallBack; import javax.servlet.http.HttpServletRequest; *************** *** 60,65 **** * @throws UserCancellationException */ ! public char[] getPassPhrase(Signer signer) throws UserCancellationException { return new char[0]; } } --- 61,77 ---- * @throws UserCancellationException */ ! public char[] getPassPhrase(BrowsableSigner signer) throws UserCancellationException { return new char[0]; } + + /** + * The User is asked to pick a name by the PassPhraseAgent. The PassPhraseAgent can query the given signer for + * a list of included aliases or even create a new keypair. + * + * @return + * @throws UserCancellationException + */ + public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { + return new byte[0]; + } } |
|
From: Pelle B. <pe...@us...> - 2004-04-07 17:35:11
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14664/src/java/org/neuclear/commons/crypto/signers Modified Files: BrowsableSigner.java JCESigner.java Added Files: SetPublicKeyCallBack.java Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. Index: JCESigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/JCESigner.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** JCESigner.java 22 Mar 2004 20:09:05 -0000 1.18 --- JCESigner.java 7 Apr 2004 17:22:10 -0000 1.19 *************** *** 2,5 **** --- 2,9 ---- * $Id$ * $Log$ + * Revision 1.19 2004/04/07 17:22:10 pelle + * Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. + * The XMLSig classes have also been updated to support this. + * * Revision 1.18 2004/03/22 20:09:05 pelle * Added simple ledger for unit testing and in memory use *************** *** 171,179 **** import java.security.interfaces.DSAPublicKey; import java.security.interfaces.RSAPublicKey; /** * Wrapper around JCE KeyStore */ ! public class JCESigner implements org.neuclear.commons.crypto.signers.Signer, PublicKeySource { /** --- 175,185 ---- import java.security.interfaces.DSAPublicKey; import java.security.interfaces.RSAPublicKey; + import java.util.Enumeration; + import java.util.Iterator; /** * Wrapper around JCE KeyStore */ ! public class JCESigner implements org.neuclear.commons.crypto.signers.Signer, BrowsableSigner, PublicKeySource { /** *************** *** 421,424 **** --- 427,451 ---- } + public byte[] sign(byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { + return ((InteractiveAgent) agent).sign(this, data, callback); + } + + public byte[] sign(String name, char pass[], byte data[], SetPublicKeyCallBack callback) throws InvalidPassphraseException { + try { + if (callback != null) + callback.setPublicKey(getPublicKey(name)); + return CryptoTools.sign(getKey(name, pass), data); + } catch (UnrecoverableKeyException e) { + throw new InvalidPassphraseException(name); + } catch (NoSuchAlgorithmException e) { + throw new LowLevelException(e); + } catch (KeyStoreException e) { + // Could try to reload it here but I wont for now + throw new LowLevelException(e); + } catch (CryptoException e) { + throw new LowLevelException(e); + } + } + public void save() { try { *************** *** 441,444 **** --- 468,489 ---- } + public Iterator iterator() throws KeyStoreException { + final Enumeration enum = ks.aliases(); + return new Iterator() { + public void remove() { + + } + + public boolean hasNext() { + return enum.hasMoreElements(); + } + + public Object next() { + return enum.nextElement(); + } + + }; + } + private final KeyStore ks; private final KeyCache cache; --- NEW FILE: SetPublicKeyCallBack.java --- package org.neuclear.commons.crypto.signers; import java.security.PublicKey; /* $Id: SetPublicKeyCallBack.java,v 1.1 2004/04/07 17:22:10 pelle Exp $ $Log: SetPublicKeyCallBack.java,v $ Revision 1.1 2004/04/07 17:22:10 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. */ /** * User: pelleb * Date: Apr 7, 2004 * Time: 11:23:55 AM */ public interface SetPublicKeyCallBack { public void setPublicKey(PublicKey pub); } Index: BrowsableSigner.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/signers/BrowsableSigner.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BrowsableSigner.java 29 Mar 2004 23:48:33 -0000 1.1 --- BrowsableSigner.java 7 Apr 2004 17:22:10 -0000 1.2 *************** *** 1,5 **** --- 1,8 ---- package org.neuclear.commons.crypto.signers; + import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; + import java.security.KeyStoreException; + import java.security.PublicKey; import java.util.Iterator; *************** *** 24,27 **** --- 27,34 ---- $Id$ $Log$ + Revision 1.2 2004/04/07 17:22:10 pelle + Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. + The XMLSig classes have also been updated to support this. + Revision 1.1 2004/03/29 23:48:33 pelle InteractiveAgent now has a new method which allows signers to ask for a passphrase without specifying alias. *************** *** 38,40 **** --- 45,54 ---- public interface BrowsableSigner { Iterator iterator() throws KeyStoreException; + + PublicKey getPublicKey(String name) throws NonExistingSignerException; + + byte[] sign(byte data[], SetPublicKeyCallBack callback) throws UserCancellationException; + + byte[] sign(String alias, char passphrase[], byte data[], SetPublicKeyCallBack callback) throws InvalidPassphraseException; + } |
|
From: Pelle B. <pe...@us...> - 2004-04-07 17:35:10
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14664/src/java/org/neuclear/commons/crypto/passphraseagents/swing Added Files: SwingAgent.java Log Message: Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. --- NEW FILE: SwingAgent.java --- package org.neuclear.commons.crypto.passphraseagents.swing; import com.jgoodies.forms.builder.ButtonBarBuilder; import com.jgoodies.forms.builder.PanelBuilder; import com.jgoodies.forms.layout.CellConstraints; import com.jgoodies.forms.layout.FormLayout; import org.neuclear.commons.crypto.Base64; import org.neuclear.commons.crypto.passphraseagents.InteractiveAgent; import org.neuclear.commons.crypto.passphraseagents.UserCancellationException; import org.neuclear.commons.crypto.signers.BrowsableSigner; import org.neuclear.commons.crypto.signers.InvalidPassphraseException; import org.neuclear.commons.crypto.signers.SetPublicKeyCallBack; import org.neuclear.commons.crypto.signers.TestCaseSigner; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.URL; import java.security.KeyStoreException; import java.security.PublicKey; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Vector; /* $Id: SwingAgent.java,v 1.1 2004/04/07 17:22:08 pelle Exp $ $Log: SwingAgent.java,v $ Revision 1.1 2004/04/07 17:22:08 pelle Added support for the new improved interactive signing model. A new Agent is also available with SwingAgent. The XMLSig classes have also been updated to support this. */ /** * User: pelleb * Date: Apr 7, 2004 * Time: 9:55:37 AM */ public class SwingAgent implements InteractiveAgent { public SwingAgent() { try { UIManager.setLookAndFeel("com.jgoodies.plaf.plastic.PlasticXPLookAndFeel"); } catch (Exception e) { // Likely PlasticXP is not in the class path; ignore. } cache = new HashMap(); sign = new JButton("Sign"); cancel = new JButton("Cancel"); newId = new JButton("New ..."); list = new JList(new String[]{"bob", "carol", "alice"}); list.setBorder(BorderFactory.createLoweredBevelBorder()); passphrase = new JPasswordField(); final URL imageurl = this.getClass().getClassLoader().getResource("org/neuclear/commons/crypto/passphraseagents/neuclear.png"); if (imageurl != null) icon = new JLabel(new ImageIcon(imageurl)); else icon = new JLabel("NeuClear"); frame = new JFrame(); frame.setTitle("NeuClear Signing Agent"); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.getContentPane().add(buildPanel()); frame.pack(); cancel.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { passphrase.setText(""); isCancel = true; passphrase.notifyAll(); } } }); final ActionListener action = new ActionListener() { public void actionPerformed(final ActionEvent actionEvent) { synchronized (passphrase) { isCancel = false; passphrase.notifyAll(); } } }; sign.addActionListener(action); passphrase.addActionListener(action); // frame.show(); } private Component buildPanel() { FormLayout layout = new FormLayout("right:pref, 3dlu, pref:grow ", "pref,3dlu,pref, 3dlu, fill:pref:grow, 3dlu, pref, 7dlu, pref"); PanelBuilder builder = new PanelBuilder(layout); CellConstraints cc = new CellConstraints(); builder.setDefaultDialogBorder(); builder.add(icon, cc.xyw(1, 5, 1, CellConstraints.LEFT, CellConstraints.TOP)); builder.addSeparator("Identities", cc.xyw(1, 3, 3)); builder.add(list, cc.xyw(3, 5, 1)); builder.addLabel("Passphrase:", cc.xy(1, 7)); builder.add(passphrase, cc.xy(3, 7)); ButtonBarBuilder bb = new ButtonBarBuilder(); bb.addGridded(newId); bb.addGlue(); bb.addUnrelatedGap(); bb.addGridded(sign); bb.addGridded(cancel); builder.add(bb.getPanel(), cc.xyw(1, 9, 3)); return builder.getPanel(); } /** * The User is asked to pick a name by the PassPhraseAgent. The PassPhraseAgent can query the given signer for * a list of included aliases or even create a new keypair. * * @return * @throws org.neuclear.commons.crypto.passphraseagents.UserCancellationException * */ public byte[] sign(BrowsableSigner signer, byte data[], SetPublicKeyCallBack callback) throws UserCancellationException { synchronized (passphrase) {//We dont want multiple agents popping up at the same time try { Iterator iter = signer.iterator(); Vector vector = new Vector(); while (iter.hasNext()) { Object o = iter.next(); vector.add(o); } list.setListData(vector); } catch (KeyStoreException e) { e.printStackTrace(); } // if (cache.containsKey(name)) // passphrase.setText((String) cache.get(name)); // else passphrase.setText(""); isCancel = true; // if (incorrect) // System.err.println("Incorrect passphrase"); // incorrectLabel.setVisible(incorrect); // nameLabel.setVisible(true); // // nameLabel.setText(name); frame.pack(); frame.show(); // frame.setVisible(true); try { passphrase.wait(); } catch (InterruptedException e) { ; } frame.hide(); // frame.setVisible(false); final String phrase = passphrase.getText(); // if (remember.getState()) // cache.put(name, phrase); passphrase.setText(""); try { //Todo handle when an alias hasnt been selected return signer.sign(list.getSelectedValue().toString(), phrase.toCharArray(), data, callback); } catch (InvalidPassphraseException e) { return new byte[0];//TODO handle invalid passphrase } } } /** * Retrieve the PassPhrase for a given name/alias * * @param name * @return */ public char[] getPassPhrase(String name) throws UserCancellationException { return getPassPhrase(name, false); } public char[] getPassPhrase(String name, boolean incorrect) throws UserCancellationException { synchronized (passphrase) {//We dont want multiple agents popping up at the same time if (cache.containsKey(name)) passphrase.setText((String) cache.get(name)); else passphrase.setText(""); isCancel = true; // if (incorrect) // System.err.println("Incorrect passphrase"); // incorrectLabel.setVisible(incorrect); // nameLabel.setVisible(true); // // nameLabel.setText(name); frame.pack(); frame.setVisible(true); try { passphrase.wait(); } catch (InterruptedException e) { ; } frame.setVisible(false); if (isCancel) throw new UserCancellationException(name); final String phrase = passphrase.getText(); // if (remember.getState()) // cache.put(name, phrase); passphrase.setText(""); return phrase.toCharArray(); } } private final JButton sign; private final JButton cancel; private final JButton newId; private final JList list; private final JTextField passphrase; private final JFrame frame; private final Map cache; private boolean isCancel; private final JLabel icon; public static void main(final String[] args) { final InteractiveAgent dia = new SwingAgent(); try { final BrowsableSigner signer = new TestCaseSigner(dia); try { byte sig[] = signer.sign("testdata".getBytes(), new SetPublicKeyCallBack() { public void setPublicKey(PublicKey pub) { System.out.println("PublicKey:"); System.out.println(pub); } }); System.out.println(Base64.encode(sig)); // System.out.println("Getting passphrase... " + new String(dia.getPassPhrase((BrowsableSigner) signer))); // System.out.println("Getting passphrase... " + new String(dia.getPassPhrase("neu://pelle@test", true))); } catch (UserCancellationException e) { System.out.print("User Cancellation by: " + e.getName()); } } catch (InvalidPassphraseException e) { e.printStackTrace(); } System.exit(0); } } |
|
From: <bug...@ve...> - 2004-04-07 17:34:33
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Wed, 7 Apr 2004 10:33 AM
This now works through new EnvelopedSignature(BrowsableSigner signer, Element elem)
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/XMLSIG-14
Here is an overview of the issue:
---------------------------------------------------------------------
Key: XMLSIG-14
Summary: Support new Interactive Signing Model
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear XMLSig
Fix Fors:
0.13
Versions:
0.13
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Tue, 30 Mar 2004 12:32 PM
Updated: Wed, 7 Apr 2004 10:33 AM
Description:
We need to be able to support the new Interactive Signing Model in NeuClear Commons 0.7 this essentially means signing using a Signer without providing an alias as is done now.
That in itself is easy, but then we also need to know the PublicKey that the Signer uses.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-07 17:32:34
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-15 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-15 Summary: Update project.xml with latest dependencies Type: Task Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 7 Apr 2004 10:32 AM Updated: Wed, 7 Apr 2004 10:32 AM Description: We need to add the Jgoodies stuff. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-07 17:32:33
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-14 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-14 Summary: Use different screen layout for normal passphrase in SwingAgent Type: Bug Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 7 Apr 2004 10:31 AM Updated: Wed, 7 Apr 2004 10:31 AM Description: Currently the SwingAgent displays the Alias list even when an alias has been specified such as for keystore passphrases. This should be disabled. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-07 17:30:36
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-13 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-13 Summary: Handle Invalid Passphrase in SwingAgent Type: Bug Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 7 Apr 2004 10:29 AM Updated: Wed, 7 Apr 2004 10:29 AM Description: Re add the support for handling invalid passphrase in SwingAgent. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-07 17:28:38
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-11 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-11 Summary: Add remember Passphrase to SwingAgent Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 7 Apr 2004 10:26 AM Updated: Wed, 7 Apr 2004 10:26 AM Description: Remember passphrase checkbox and functionality should be implemented similarly to the original GUI Agent. In addition it should remember the last alias used. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-07 17:28:37
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-12 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-12 Summary: Add Identity Generator to SwingAgent Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Versions: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 7 Apr 2004 10:28 AM Updated: Wed, 7 Apr 2004 10:28 AM Description: The SwingAgent should be able to generate a new Key and store it in the signer store. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-07 17:26:34
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/COM-10 Here is an overview of the issue: --------------------------------------------------------------------- Key: COM-10 Summary: Create Improved GUI Agent Type: New Feature Status: Open Priority: Major Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Commons Fix Fors: r_0_7 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Wed, 7 Apr 2004 10:25 AM Updated: Wed, 7 Apr 2004 10:25 AM Description: A new GUI agent should be created which supports the new Interactive Signing model. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-07 17:26:34
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Wed, 7 Apr 2004 10:25 AM
This has been created with SwingAgent.
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/COM-10
Here is an overview of the issue:
---------------------------------------------------------------------
Key: COM-10
Summary: Create Improved GUI Agent
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Commons
Fix Fors:
r_0_7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Wed, 7 Apr 2004 10:25 AM
Updated: Wed, 7 Apr 2004 10:25 AM
Description:
A new GUI agent should be created which supports the new Interactive Signing model.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-07 17:24:32
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Wed, 7 Apr 2004 10:23 AM
New Model implemented with the combination of the three interfaces:
BrowsableSigner
InteractiveAgent
SetPublicKeyCallBack
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/COM-4
Here is an overview of the issue:
---------------------------------------------------------------------
Key: COM-4
Summary: Create Completely Interactive Signing Method
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Commons
Fix Fors:
r_0_7
Versions:
r_0_7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Tue, 30 Mar 2004 12:21 PM
Updated: Wed, 7 Apr 2004 10:23 AM
Description:
For interactive situations where the user is signing a message in a gui, he should be able to pick the identity that he wishes to use as well as create new identities.
Thus the Signer should have a sign(byte data[]) method which completely autonomously handles the entire signing process outside of the control of direct application control.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-07 17:22:32
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Wed, 7 Apr 2004 10:21 AM
Created SetPublicKeyCallBack interface which allows the application to retrieve the public key of the signed data when using the new Interactive User Interface.
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/COM-6
Here is an overview of the issue:
---------------------------------------------------------------------
Key: COM-6
Summary: Set PublicKey Callback Method
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Commons
Fix Fors:
r_0_7
Versions:
r_0_7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Tue, 30 Mar 2004 12:29 PM
Updated: Wed, 7 Apr 2004 10:21 AM
Description:
The XMLSig library needs to know the PublicKey of the signer and thus needs to be able to retrieve it in cases, where the signer isnt known, such as the new interactive model.
---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
http://jira.neuclear.org//secure/Administrators.jspa
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
|
|
From: <bug...@ve...> - 2004-04-07 17:20:36
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Wed, 7 Apr 2004 10:20 AM
I have updated InteractiveAgent with a sign() method that takes as it's argument an instance of the new BrowsableSigner Interface, Data to sign and a Callback for returning the PublicKey to the application.
The idea is that sign asks the user which alias it wants to use and allows him to create new identities as well. It handles the interaction with the BrowsableSigner including failed passphrase attempts etc.
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/COM-5
Here is an overview of the issue:
---------------------------------------------------------------------
Key: COM-5
Summary: Support for more advanced passphrase agent
Type: New Feature
Status: Closed
Priority: Major
Resolution: FIXED
Original Estimate: Unknown
Time Spent: Unknown
Remaining: Unknown
Project: NeuClear Commons
Fix Fors:
r_0_7
Versions:
r_0_7
Assignee: Pelle Braendgaard
Reporter: Pelle Braendgaard
Created: Tue, 30 Mar 2004 12:25 PM
Updated: Wed, 7 Apr 2004 10:20 AM
Description:
The new more interactive approach to signing requires more of the passphrase agents.
The passphrase agents need to be able to not just enter passphrases, but also pick aliases and initiate an Identity Creation process.
---------------------------------------------------------------------
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-04-07 15:34:20
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21508/src/java/org/neuclear/commons/crypto/passphraseagents/swing Log Message: Directory /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/crypto/passphraseagents/swing added to the repository |
|
From: Pelle B. <pe...@us...> - 2004-04-06 23:13:53
|
Update of /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/controllers/currency In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5261/src/test/org/neuclear/asset/controllers/currency Modified Files: CurrencyTests.java Added Files: PersistentCurrencyTests.java Log Message: Create new PersistentCurrencyTests TestCase for doing integration testing with various persistent ledgers. Index: CurrencyTests.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-pay/src/test/org/neuclear/asset/controllers/currency/CurrencyTests.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CurrencyTests.java 6 Apr 2004 16:24:35 -0000 1.9 --- CurrencyTests.java 6 Apr 2004 23:01:01 -0000 1.10 *************** *** 36,48 **** * Time: 6:05:04 PM */ ! public final class CurrencyTests extends AbstractSigningTest { ! public CurrencyTests(final String s) throws LowlevelLedgerException, GeneralSecurityException, NeuClearException { super(s); asset = createTestAsset(); shoes = createShoeAsset(); agent = createTestExchangeAgent(); ! ledger = new SimpleLedger("test"); proc = new CurrencyController(ledger, asset, getSigner(), "neu://test/bux"); ! auditLedger = new SimpleLedger("auditor"); auditor = new Auditor(asset, auditLedger); } --- 36,52 ---- * Time: 6:05:04 PM */ ! public class CurrencyTests extends AbstractSigningTest { ! public CurrencyTests(final String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException { ! this(s, new SimpleLedger("asset"), new SimpleLedger("test")); ! } ! ! public CurrencyTests(final String s, final Ledger assetLedger, final Ledger auditLedger) throws LowlevelLedgerException, GeneralSecurityException, NeuClearException { super(s); asset = createTestAsset(); shoes = createShoeAsset(); agent = createTestExchangeAgent(); ! ledger = assetLedger; proc = new CurrencyController(ledger, asset, getSigner(), "neu://test/bux"); ! this.auditLedger = auditLedger; auditor = new Auditor(asset, auditLedger); } *************** *** 143,147 **** assertAudit(getAlice().getName()); ! Builder builder = new ExchangeOrderBuilder(asset, agent, new Amount(20), new Date(System.currentTimeMillis() + 8000), new BidItem[]{new BidItem(shoes, new Amount(10))}, "give me shoes"); SignedNamedObject receipt = process(builder); assertNotNull(receipt); --- 147,151 ---- assertAudit(getAlice().getName()); ! Builder builder = new ExchangeOrderBuilder(asset, agent, new Amount(20), new Date(System.currentTimeMillis() + 10000), new BidItem[]{new BidItem(shoes, new Amount(10))}, "give me shoes"); SignedNamedObject receipt = process(builder); assertNotNull(receipt); --- NEW FILE: PersistentCurrencyTests.java --- package org.neuclear.asset.controllers.currency; import org.neuclear.commons.NeuClearException; import org.neuclear.ledger.LowlevelLedgerException; import org.neuclear.ledger.prevalent.PrevalentLedger; import org.neuclear.ledger.simple.SimpleLedger; import java.io.IOException; import java.security.GeneralSecurityException; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: PersistentCurrencyTests.java,v 1.1 2004/04/06 23:01:01 pelle Exp $ $Log: PersistentCurrencyTests.java,v $ Revision 1.1 2004/04/06 23:01:01 pelle Create new PersistentCurrencyTests TestCase for doing integration testing with various persistent ledgers. */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 8:11:02 PM */ public class PersistentCurrencyTests extends CurrencyTests { public PersistentCurrencyTests(String s) throws GeneralSecurityException, LowlevelLedgerException, NeuClearException, IOException, ClassNotFoundException { super(s, new PrevalentLedger("asset", "target/test-data/pl"), new SimpleLedger("audit")); } } |
Update of /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4374/src/java/org/neuclear/ledger/prevalent Modified Files: AccountHeld.java CancelHeldTransaction.java GetAvailableBalanceQuery.java HoldTable.java LedgerSystem.java PostHeldTransaction.java PostVerifiedTransfer.java PrevalentLedger.java Added Files: DoesHeldTransactionExist.java DoesTransactionExist.java FindHeldTransaction.java SetHeldReceiptId.java SetReceiptId.java Log Message: Updated with new API Changes Index: PostHeldTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PostHeldTransaction.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PostHeldTransaction.java 31 Mar 2004 23:11:20 -0000 1.2 --- PostHeldTransaction.java 6 Apr 2004 22:56:36 -0000 1.3 *************** *** 40,44 **** while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (system.getAvailableBalance(item.getBook()) + item.getAmount() < 0) throw new InsufficientFundsException(null, item.getBook(), item.getAmount()); } --- 40,44 ---- while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! if (system.getAvailableBalance(item.getBook(), executionTime) + item.getAmount() < 0) throw new InsufficientFundsException(null, item.getBook(), item.getAmount()); } --- NEW FILE: FindHeldTransaction.java --- package org.neuclear.ledger.prevalent; import org.prevayler.Query; import java.util.Date; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: FindHeldTransaction.java,v 1.1 2004/04/06 22:56:36 pelle Exp $ $Log: FindHeldTransaction.java,v $ Revision 1.1 2004/04/06 22:56:36 pelle Updated with new API Changes */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 9:30:44 PM */ public class FindHeldTransaction implements Query { public FindHeldTransaction(String id) { this.id = id; } private String id; /** * @param prevalentSystem 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 prevalentSystem, Date executionTime) throws Exception { LedgerSystem system = (LedgerSystem) prevalentSystem; return system.getHoldTable().get(id); } } Index: CancelHeldTransaction.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/CancelHeldTransaction.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CancelHeldTransaction.java 22 Mar 2004 17:27:10 -0000 1.1.1.1 --- CancelHeldTransaction.java 6 Apr 2004 22:56:36 -0000 1.2 *************** *** 2,6 **** ! import org.neuclear.ledger.*; import java.util.Date; --- 2,6 ---- ! import org.neuclear.ledger.PostedHeldTransaction; import java.util.Date; *************** *** 14,18 **** * To change this template use File | Settings | File Templates. */ ! public class CancelHeldTransaction implements org.prevayler.Transaction{ final PostedHeldTransaction tran; --- 14,18 ---- * To change this template use File | Settings | File Templates. */ ! public class CancelHeldTransaction implements org.prevayler.TransactionWithQuery { final PostedHeldTransaction tran; *************** *** 30,38 **** * @param executionTime The time at which this Transaction is being executed. Every Transaction executes completely within a single moment in time. Logically, a Prevalent System's time does not pass during the execution of a Transaction. */ ! public void executeOn(Object prevalentSystem, Date executionTime) { ! LedgerSystem system=(LedgerSystem) prevalentSystem; ! HoldTable table=system.getHoldTable(); System.out.println("Execute Cancel"); table.expire(tran); } } --- 30,39 ---- * @param executionTime The time at which this Transaction is being executed. Every Transaction executes completely within a single moment in time. Logically, a Prevalent System's time does not pass during the execution of a Transaction. */ ! public Object executeAndQuery(Object prevalentSystem, Date executionTime) { ! LedgerSystem system = (LedgerSystem) prevalentSystem; ! HoldTable table = system.getHoldTable(); System.out.println("Execute Cancel"); table.expire(tran); + return executionTime; } } Index: PrevalentLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PrevalentLedger.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PrevalentLedger.java 31 Mar 2004 23:11:20 -0000 1.4 --- PrevalentLedger.java 6 Apr 2004 22:56:36 -0000 1.5 *************** *** 95,99 **** * @return The Transaction object */ ! public Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException, InvalidTransactionException, UnknownBookException { if (system.getTransactionTable().exists(id)) return new Date(system.getTransactionTable().getTransactionTime(id)); --- 95,99 ---- * @return The Transaction object */ ! public Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException { if (system.getTransactionTable().exists(id)) return new Date(system.getTransactionTable().getTransactionTime(id)); *************** *** 158,161 **** --- 158,177 ---- } + public boolean transactionExists(String id) throws LowlevelLedgerException { + try { + return ((Boolean) prevayler.execute(new DoesTransactionExist(id))).booleanValue(); + } catch (Exception e) { + throw new LowlevelLedgerException(e); + } + } + + public boolean heldTransactionExists(String id) throws LowlevelLedgerException { + try { + return ((Boolean) prevayler.execute(new DoesHeldTransactionExist(id))).booleanValue(); + } catch (Exception e) { + throw new LowlevelLedgerException(e); + } + } + /** * Searches for a Held Transaction based on its Transaction ID *************** *** 165,173 **** */ public PostedHeldTransaction findHeldTransaction(String idstring) throws LowlevelLedgerException, UnknownTransactionException { ! return system.getHoldTable().get(idstring); //To change body of implemented methods use File | Settings | File Templates. } public void setReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { } --- 181,201 ---- */ public PostedHeldTransaction findHeldTransaction(String idstring) throws LowlevelLedgerException, UnknownTransactionException { ! try { ! final PostedHeldTransaction t = (PostedHeldTransaction) prevayler.execute(new FindHeldTransaction(idstring)); ! return t; ! } catch (Exception e) { ! if (e instanceof UnknownTransactionException) ! throw (UnknownTransactionException) e; ! throw new LowlevelLedgerException(e); ! } } public void setReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { + prevayler.execute(new SetReceiptId(id, receipt)); + + } + public void setHeldReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { + prevayler.execute(new SetHeldReceiptId(id, receipt)); } *************** *** 181,189 **** * */ ! public void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { try { System.out.println("Perform Cancel"); ! prevayler.execute(new CancelHeldTransaction(hold)); } catch (Exception e) { if (e instanceof UnknownTransactionException) --- 209,217 ---- * */ ! public Date performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { try { System.out.println("Perform Cancel"); ! return (Date) prevayler.execute(new CancelHeldTransaction(hold)); } catch (Exception e) { if (e instanceof UnknownTransactionException) --- NEW FILE: SetHeldReceiptId.java --- package org.neuclear.ledger.prevalent; import org.neuclear.ledger.PostedHeldTransaction; import org.prevayler.Transaction; import java.util.Date; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: SetHeldReceiptId.java,v 1.1 2004/04/06 22:56:36 pelle Exp $ $Log: SetHeldReceiptId.java,v $ Revision 1.1 2004/04/06 22:56:36 pelle Updated with new API Changes */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 10:24:14 PM */ public class SetHeldReceiptId implements Transaction { public SetHeldReceiptId(String requestid, String receiptid) { this.requestid = requestid; this.receiptid = receiptid; } private String requestid; private String receiptid; /** * This method is called by Prevayler.execute(Transaction) to execute this Transaction on the given Prevalent System. See org.prevayler.demos for usage examples. * * @param prevalentSystem The system on which this Transaction will execute. * @param executionTime The time at which this Transaction is being executed. Every Transaction executes completely within a single moment in time. Logically, a Prevalent System's time does not pass during the execution of a Transaction. */ public void executeOn(Object prevalentSystem, Date executionTime) { LedgerSystem system = (LedgerSystem) prevalentSystem; HoldTable table = system.getHoldTable(); PostedHeldTransaction tran = table.get(requestid); if (tran != null && tran.getReceiptId() == null) tran.setReceiptId(receiptid); } } Index: GetAvailableBalanceQuery.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/GetAvailableBalanceQuery.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** GetAvailableBalanceQuery.java 22 Mar 2004 17:27:10 -0000 1.1.1.1 --- GetAvailableBalanceQuery.java 6 Apr 2004 22:56:36 -0000 1.2 *************** *** 12,16 **** * To change this template use File | Settings | File Templates. */ ! public class GetAvailableBalanceQuery implements Query{ public GetAvailableBalanceQuery(String book) { this.book = book; --- 12,16 ---- * To change this template use File | Settings | File Templates. */ ! public class GetAvailableBalanceQuery implements Query { public GetAvailableBalanceQuery(String book) { this.book = book; *************** *** 18,29 **** /** ! * @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 { ! final LedgerSystem ledgsys = ((LedgerSystem)system); ! return new Double(ledgsys.getAvailableBalance(book)); } --- 18,29 ---- /** ! * @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 { ! final LedgerSystem ledgsys = ((LedgerSystem) system); ! return new Double(ledgsys.getAvailableBalance(book, executionTime)); } --- NEW FILE: DoesTransactionExist.java --- package org.neuclear.ledger.prevalent; import org.prevayler.Query; import java.util.Date; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: DoesTransactionExist.java,v 1.1 2004/04/06 22:56:36 pelle Exp $ $Log: DoesTransactionExist.java,v $ Revision 1.1 2004/04/06 22:56:36 pelle Updated with new API Changes */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 9:30:44 PM */ public class DoesTransactionExist implements Query { public DoesTransactionExist(String id) { this.id = id; } private String id; /** * @param prevalentSystem 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 prevalentSystem, Date executionTime) throws Exception { LedgerSystem system = (LedgerSystem) prevalentSystem; return new Boolean(system.getTransactionTable().exists(id)); } } Index: PostVerifiedTransfer.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/PostVerifiedTransfer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PostVerifiedTransfer.java 31 Mar 2004 23:11:20 -0000 1.3 --- PostVerifiedTransfer.java 6 Apr 2004 22:56:36 -0000 1.4 *************** *** 42,46 **** 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); --- 42,46 ---- while (iter.hasNext()) { TransactionItem item = (TransactionItem) iter.next(); ! final double balance = system.getAvailableBalance(item.getBook(), executionTime); if (item.getAmount() < 0 && balance + item.getAmount() < 0) throw new InsufficientFundsException(null, item.getBook(), item.getAmount(), balance); Index: LedgerSystem.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/LedgerSystem.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** LedgerSystem.java 22 Mar 2004 17:27:10 -0000 1.1.1.1 --- LedgerSystem.java 6 Apr 2004 22:56:36 -0000 1.2 *************** *** 2,5 **** --- 2,6 ---- import java.io.Serializable; + import java.util.Date; /** *************** *** 10,17 **** * To change this template use File | Settings | File Templates. */ ! public final class LedgerSystem implements Serializable{ ! private BalanceTable balances=new BalanceTable(); ! private HoldTable holds=new HoldTable(); ! private TransactionTable transactions=new TransactionTable(); private String ledgerid; --- 11,18 ---- * To change this template use File | Settings | File Templates. */ ! public final class LedgerSystem implements Serializable { ! private BalanceTable balances = new BalanceTable(); ! private HoldTable holds = new HoldTable(); ! private TransactionTable transactions = new TransactionTable(); private String ledgerid; *************** *** 37,46 **** } ! final double getBalance(String book){ return balances.getBalance(book); } ! final double getAvailableBalance(String book){ ! return getBalance(book)+holds.getHeldBalance(book); } } --- 38,47 ---- } ! final double getBalance(String book) { return balances.getBalance(book); } ! final double getAvailableBalance(String book, final Date executionTime) { ! return getBalance(book) + holds.getHeldBalance(book, executionTime); } } Index: AccountHeld.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/AccountHeld.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AccountHeld.java 31 Mar 2004 23:11:20 -0000 1.2 --- AccountHeld.java 6 Apr 2004 22:56:36 -0000 1.3 *************** *** 31,36 **** } ! double getBalance() { ! final Date current = new Date(); Iterator iter = holds.iterator(); double balance = 0; --- 31,35 ---- } ! double getBalance(final Date current) { Iterator iter = holds.iterator(); double balance = 0; *************** *** 39,47 **** PostedHeldTransaction transaction = (PostedHeldTransaction) iter.next(); if (transaction.getExpiryTime().after(current)) { ! Iterator items = transaction.getItems(); ! while (items.hasNext()) { ! TransactionItem item = (TransactionItem) items.next(); ! if (item.getBook().equals(id) && item.getAmount() < 0) ! balance += item.getAmount(); } } else { --- 38,48 ---- PostedHeldTransaction transaction = (PostedHeldTransaction) iter.next(); if (transaction.getExpiryTime().after(current)) { ! if (transaction.getReceiptId() != null) { ! Iterator items = transaction.getItems(); ! while (items.hasNext()) { ! TransactionItem item = (TransactionItem) items.next(); ! if (item.getBook().equals(id) && item.getAmount() < 0) ! balance += item.getAmount(); ! } } } else { --- NEW FILE: SetReceiptId.java --- package org.neuclear.ledger.prevalent; import org.neuclear.ledger.PostedHeldTransaction; import org.prevayler.Transaction; import java.util.Date; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: SetReceiptId.java,v 1.1 2004/04/06 22:56:36 pelle Exp $ $Log: SetReceiptId.java,v $ Revision 1.1 2004/04/06 22:56:36 pelle Updated with new API Changes */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 10:24:14 PM */ public class SetReceiptId implements Transaction { public SetReceiptId(String requestid, String receiptid) { this.requestid = requestid; this.receiptid = receiptid; } private String requestid; private String receiptid; /** * This method is called by Prevayler.execute(Transaction) to execute this Transaction on the given Prevalent System. See org.prevayler.demos for usage examples. * * @param prevalentSystem The system on which this Transaction will execute. * @param executionTime The time at which this Transaction is being executed. Every Transaction executes completely within a single moment in time. Logically, a Prevalent System's time does not pass during the execution of a Transaction. */ public void executeOn(Object prevalentSystem, Date executionTime) { LedgerSystem system = (LedgerSystem) prevalentSystem; HoldTable table = system.getHoldTable(); PostedHeldTransaction tran = table.get(requestid); if (tran != null && tran.getReceiptId() == null) tran.setReceiptId(receiptid); } } --- NEW FILE: DoesHeldTransactionExist.java --- package org.neuclear.ledger.prevalent; import org.prevayler.Query; import java.util.Date; /* NeuClear Distributed Transaction Clearing Platform (C) 2003 Pelle Braendgaard This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA $Id: DoesHeldTransactionExist.java,v 1.1 2004/04/06 22:56:36 pelle Exp $ $Log: DoesHeldTransactionExist.java,v $ Revision 1.1 2004/04/06 22:56:36 pelle Updated with new API Changes */ /** * User: pelleb * Date: Apr 6, 2004 * Time: 9:30:44 PM */ public class DoesHeldTransactionExist implements Query { public DoesHeldTransactionExist(String id) { this.id = id; } private String id; /** * @param prevalentSystem 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 prevalentSystem, Date executionTime) throws Exception { LedgerSystem system = (LedgerSystem) prevalentSystem; return new Boolean(system.getHoldTable().exists(id)); } } Index: HoldTable.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/src/java/org/neuclear/ledger/prevalent/HoldTable.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HoldTable.java 31 Mar 2004 23:11:20 -0000 1.2 --- HoldTable.java 6 Apr 2004 22:56:36 -0000 1.3 *************** *** 6,9 **** --- 6,10 ---- import java.io.Serializable; + import java.util.Date; import java.util.HashMap; import java.util.Iterator; *************** *** 16,23 **** private final HashMap transactions = new HashMap(); ! double getHeldBalance(final String id) { if (!accounts.containsKey(id)) return 0; ! return ((AccountHeld) accounts.get(id)).getBalance(); } --- 17,24 ---- private final HashMap transactions = new HashMap(); ! double getHeldBalance(final String id, final Date current) { if (!accounts.containsKey(id)) return 0; ! return ((AccountHeld) accounts.get(id)).getBalance(current); } |
|
From: Pelle B. <pe...@us...> - 2004-04-06 23:09:29
|
Update of /cvsroot/neuclear/neuclear-ledger-prevalent In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4374 Modified Files: project.xml Log Message: Updated with new API Changes Index: project.xml =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-prevalent/project.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** project.xml 23 Mar 2004 22:02:23 -0000 1.4 --- project.xml 6 Apr 2004 22:56:37 -0000 1.5 *************** *** 80,85 **** <id>prevayler</id> <name>prevayler</name> ! <version>2.0.1.000alpha</version> ! <jar>prevayler2.01.000alpha.jar</jar> </dependency> <dependency> --- 80,85 ---- <id>prevayler</id> <name>prevayler</name> ! <version>2.0.2.000beta</version> ! <jar>prevayler2.02.000beta.jar</jar> </dependency> <dependency> |
|
From: Pelle B. <pe...@us...> - 2004-04-06 23:05:27
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3499/src/java Modified Files: hibernate.properties Log Message: Updated with new API Changes Index: hibernate.properties =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/hibernate.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** hibernate.properties 29 Mar 2004 16:57:00 -0000 1.8 --- hibernate.properties 6 Apr 2004 22:52:34 -0000 1.9 *************** *** 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-04-06 23:05:26
|
Update of /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3499/src/java/org/neuclear/ledger/hibernate Modified Files: HibernateLedger.java Log Message: Updated with new API Changes Index: HibernateLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger-hibernate/src/java/org/neuclear/ledger/hibernate/HibernateLedger.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** HibernateLedger.java 31 Mar 2004 23:11:30 -0000 1.12 --- HibernateLedger.java 6 Apr 2004 22:52:34 -0000 1.13 *************** *** 115,118 **** --- 115,126 ---- 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()); + } + HHeld posted = new HHeld(trans, new Date()); ses.save(posted); *************** *** 135,139 **** * */ ! public void performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { try { Session ses = factory.openSession(); --- 143,147 ---- * */ ! public Date performCancelHold(PostedHeldTransaction hold) throws LowlevelLedgerException, UnknownTransactionException { try { Session ses = factory.openSession(); *************** *** 145,148 **** --- 153,158 ---- ses.saveOrUpdate(posted); t.commit(); + ses.close(); + return new Date(); } else { t.rollback(); *************** *** 151,155 **** } - ses.close(); } catch (HibernateException e) { throw new LowlevelLedgerException(e); --- 161,164 ---- *************** *** 207,211 **** * @return The Transaction object */ ! public Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException, InvalidTransactionException, UnknownBookException { try { Session ses = factory.openSession(); --- 216,220 ---- * @return The Transaction object */ ! public Date getTransactionTime(String id) throws LowlevelLedgerException, UnknownTransactionException { try { Session ses = factory.openSession(); *************** *** 252,256 **** 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(); --- 261,265 ---- try { Session ses = factory.openSession(); ! Query q = ses.createQuery("select sum(item.amount) from HTransactionItem item where item.book = ? and item.transaction.receipt is not null"); q.setString(0, book); Iterator iter = q.iterate(); *************** *** 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()); --- 283,287 ---- 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 and item.held.receipt is not null"); q.setString(0, book); q.setTimestamp(1, new Date()); *************** *** 316,319 **** --- 325,356 ---- } + public boolean transactionExists(String id) throws LowlevelLedgerException { + try { + Session ses = factory.openSession(); + Query q = ses.createQuery("select item.id from HTransaction item where item.id = ?"); + q.setString(0, id); + Iterator iter = q.iterate(); + final boolean answer = (iter.hasNext()); + ses.close(); + return answer; + } catch (HibernateException e) { + throw new LowlevelLedgerException(e); + } + } + + public boolean heldTransactionExists(String id) throws LowlevelLedgerException { + try { + Session ses = factory.openSession(); + Query q = ses.createQuery("select item.id from HHeld item where item.id = ?"); + q.setString(0, id); + Iterator iter = q.iterate(); + final boolean answer = (iter.hasNext()); + ses.close(); + return answer; + } catch (HibernateException e) { + throw new LowlevelLedgerException(e); + } + } + /** * Searches for a Held Transaction based on its Transaction ID *************** *** 357,360 **** --- 394,416 ---- } + public void setHeldReceiptId(String id, String receipt) throws LowlevelLedgerException, UnknownTransactionException { + try { + Session ses = factory.openSession(); + net.sf.hibernate.Transaction t = ses.beginTransaction(); + HHeld tran = (HHeld) ses.get(HHeld.class, id); + if (tran == null) { + ses.close(); + throw new UnknownTransactionException(this, id); + } + tran.setReceipt(receipt); + t.commit(); + ses.close(); + } catch (HibernateException e) { + throw new LowlevelLedgerException(e); + } + + + } + public double getTestBalance() throws LowlevelLedgerException { try { |
|
From: Pelle B. <pe...@us...> - 2004-04-06 23:03:36
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2934/src/java/org/neuclear/ledger/tests Modified Files: AbstractLedgerTest.java Log Message: Updated Unit Tests Index: AbstractLedgerTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/tests/AbstractLedgerTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** AbstractLedgerTest.java 5 Apr 2004 22:06:46 -0000 1.7 --- AbstractLedgerTest.java 6 Apr 2004 22:50:14 -0000 1.8 *************** *** 2,5 **** --- 2,6 ---- import junit.framework.TestCase; + import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.ledger.*; *************** *** 13,19 **** * $Id$ * $Log$ * Revision 1.7 2004/04/05 22:06:46 pelle * added setHeldReceiptId() method to ledger ! * * Revision 1.6 2004/03/31 23:11:09 pelle * Reworked the ID's of the transactions. The primary ID is now the request ID. --- 14,23 ---- * $Id$ * $Log$ + * Revision 1.8 2004/04/06 22:50:14 pelle + * Updated Unit Tests + * * Revision 1.7 2004/04/05 22:06:46 pelle * added setHeldReceiptId() method to ledger ! * <p/> * Revision 1.6 2004/03/31 23:11:09 pelle * Reworked the ID's of the transactions. The primary ID is now the request ID. *************** *** 184,187 **** --- 188,212 ---- public abstract Ledger createLedger() throws LowlevelLedgerException, UnknownLedgerException; + private final PostedTransaction transfer(final String from, final String to, final double amount, final String comment) throws InvalidTransactionException, LowlevelLedgerException { + PostedTransaction tran = ledger.transfer(CryptoTools.createRandomID(), from, to, amount, comment); + try { + ledger.setReceiptId(tran.getRequestId(), CryptoTools.createRandomID()); + } catch (UnknownTransactionException e) { + assertTrue(false); + } + return tran; + + } + + public final PostedHeldTransaction hold(final String from, final String to, final Date expires, final double amount, final String comment) throws InvalidTransactionException, UnBalancedTransactionException, LowlevelLedgerException { + PostedHeldTransaction tran = ledger.hold(CryptoTools.createRandomID(), from, to, expires, amount, comment); + try { + ledger.setHeldReceiptId(tran.getRequestId(), CryptoTools.createRandomID()); + } catch (UnknownTransactionException e) { + assertTrue(false); + } + return tran; + } + public final void testTransfer() throws LedgerException { final double aliceBalance = ledger.getBalance(ALICE); *************** *** 189,200 **** final double amount = 100; ! ledger.transfer(ALICE, BOB, amount, "LOAN"); assertEquals("ALICE BALANCE", aliceBalance - amount, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE", bobBalance + amount, ledger.getBalance(BOB), 0); ! ledger.transfer(BOB, ALICE, amount, "Repayment"); assertEquals("REPAY ALICE BALANCE", aliceBalance, ledger.getBalance(ALICE), 0); assertEquals("REPAY BOB BALANCE", bobBalance, ledger.getBalance(BOB), 0); ! ledger.transfer(BOB, ALICE, 5, "Interest"); System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); --- 214,225 ---- final double amount = 100; ! transfer(ALICE, BOB, amount, "LOAN"); assertEquals("ALICE BALANCE", aliceBalance - amount, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE", bobBalance + amount, ledger.getBalance(BOB), 0); ! transfer(BOB, ALICE, amount, "Repayment"); assertEquals("REPAY ALICE BALANCE", aliceBalance, ledger.getBalance(ALICE), 0); assertEquals("REPAY BOB BALANCE", bobBalance, ledger.getBalance(BOB), 0); ! transfer(BOB, ALICE, 5, "Interest"); System.out.println("Alice's Balance: " + ledger.getBalance(ALICE)); System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); *************** *** 206,210 **** // Need a positive amount in alice's account if (ledger.getAvailableBalance(ALICE) < 100) ! ledger.transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + 100, "FUND"); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); --- 231,235 ---- // Need a positive amount in alice's account if (ledger.getAvailableBalance(ALICE) < 100) ! transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + 100, "FUND"); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); *************** *** 231,239 **** } ! 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(), "Issuer", CAROL, i, "fund it"); cumulative += i; assertEquals("BOB BALANCE", bobBalance + cumulative, ledger.getBalance(CAROL), 0); --- 256,264 ---- } ! public final void testMultiTransfer() throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException, UnknownTransactionException { final double bobBalance = ledger.getBalance(CAROL); int cumulative = 0; for (int i = 0; i < 100; i++) { ! transfer("Issuer", CAROL, i, "fund it"); cumulative += i; assertEquals("BOB BALANCE", bobBalance + cumulative, ledger.getBalance(CAROL), 0); *************** *** 251,256 **** public final void testHoldAndExpireTransfer() throws LowlevelLedgerException, UnBalancedTransactionException, InvalidTransactionException { ! if (ledger.getAvailableBalance(ALICE) < 100) ! ledger.transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + 100, "FUND"); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); --- 276,280 ---- public final void testHoldAndExpireTransfer() throws LowlevelLedgerException, UnBalancedTransactionException, InvalidTransactionException { ! ensureBalance(100.0); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); *************** *** 259,263 **** System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! ledger.hold(ALICE, BOB, new Date(System.currentTimeMillis() + 5000), amount, "LOAN"); assertEquals("ALICE Available BALANCE", aliceBalance - amount, ledger.getAvailableBalance(ALICE), 0); assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); --- 283,287 ---- System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! hold(ALICE, BOB, new Date(System.currentTimeMillis() + 5000), amount, "LOAN"); assertEquals("ALICE Available BALANCE", aliceBalance - amount, ledger.getAvailableBalance(ALICE), 0); assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); *************** *** 282,288 **** } public final void testHoldAndCancelTransfer() throws LowlevelLedgerException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException { if (ledger.getAvailableBalance(ALICE) < 100) ! ledger.transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + 100, "FUND"); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); --- 306,317 ---- } + private void ensureBalance(final double target) throws LowlevelLedgerException, InvalidTransactionException { + if (ledger.getAvailableBalance(ALICE) < target) + transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + target, "FUND"); + } + public final void testHoldAndCancelTransfer() throws LowlevelLedgerException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException { if (ledger.getAvailableBalance(ALICE) < 100) ! transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + 100, "FUND"); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); *************** *** 291,295 **** System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! PostedHeldTransaction tran = 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); --- 320,324 ---- System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! PostedHeldTransaction tran = 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); *************** *** 298,302 **** assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); ! ledger.performCancelHold(tran); assertEquals("ALICE BALANCE CANCELLED", aliceBalance, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE CANCELLED", bobBalance, ledger.getBalance(BOB), 0); --- 327,334 ---- assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); ! final Date before = new Date(); ! final Date date = ledger.performCancelHold(tran); ! assertNotNull(date); ! assertTrue(!date.before(before)); assertEquals("ALICE BALANCE CANCELLED", aliceBalance, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE CANCELLED", bobBalance, ledger.getBalance(BOB), 0); *************** *** 313,317 **** public final void testHoldAndCompleteTransfer() throws LowlevelLedgerException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException, TransactionExpiredException { if (ledger.getAvailableBalance(ALICE) < 100) ! ledger.transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + 100, "FUND"); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); --- 345,349 ---- public final void testHoldAndCompleteTransfer() throws LowlevelLedgerException, UnBalancedTransactionException, InvalidTransactionException, UnknownTransactionException, TransactionExpiredException { if (ledger.getAvailableBalance(ALICE) < 100) ! transfer("MONEY PRESS", ALICE, -ledger.getAvailableBalance(ALICE) + 100, "FUND"); final double aliceBalance = ledger.getBalance(ALICE); final double bobBalance = ledger.getBalance(BOB); *************** *** 320,324 **** System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! PostedHeldTransaction tran = 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); --- 352,356 ---- System.out.println("Bob's Balance: " + ledger.getBalance(BOB)); ! PostedHeldTransaction tran = 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); *************** *** 327,331 **** assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); ! ledger.performCompleteHold(tran, 100, "done"); assertEquals("ALICE BALANCE COMPLETED", aliceBalance - amount, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE COMPLETED", bobBalance + amount, ledger.getBalance(BOB), 0); --- 359,365 ---- assertEquals("BOB Available BALANCE", bobBalance, ledger.getAvailableBalance(BOB), 0); ! PostedTransaction pstd = ledger.performCompleteHold(tran, 100, "done"); ! ledger.setReceiptId(pstd.getRequestId(), CryptoTools.createRandomID()); ! assertEquals("ALICE BALANCE COMPLETED", aliceBalance - amount, ledger.getBalance(ALICE), 0); assertEquals("BOB BALANCE COMPLETED", bobBalance + amount, ledger.getBalance(BOB), 0); *************** *** 349,353 **** // Now check that it throws InsufficientFundsException try { ! ledger.hold(ALICE, BOB, new Date(System.currentTimeMillis() + 5000), ledger.getAvailableBalance(ALICE) + 10, "To much"); assertTrue("InssuficientFundsException should have been thrown", false); } catch (InsufficientFundsException e) { --- 383,387 ---- // Now check that it throws InsufficientFundsException try { ! hold(ALICE, BOB, new Date(System.currentTimeMillis() + 5000), ledger.getAvailableBalance(ALICE) + 10, "To much"); assertTrue("InssuficientFundsException should have been thrown", false); } catch (InsufficientFundsException e) { *************** *** 365,375 **** final double bobBalance = ledger.getBalance(BOB); ! PostedTransaction tran = ledger.transfer(ALICE, BOB, 100, "LOAN"); assertNull(tran.getReceiptId()); try { ledger.setReceiptId(tran.getRequestId(), "1234"); } catch (UnknownTransactionException e) { ! assertTrue(true); } } --- 399,460 ---- final double bobBalance = ledger.getBalance(BOB); ! PostedTransaction tran = ledger.transfer(CryptoTools.createRandomID(), ALICE, BOB, 100, "LOAN"); ! ! assertEquals(aliceBalance, ledger.getBalance(ALICE), 0); ! assertEquals(aliceBalance, ledger.getAvailableBalance(ALICE), 0); ! assertEquals(bobBalance, ledger.getBalance(BOB), 0); ! assertEquals(bobBalance, ledger.getAvailableBalance(BOB), 0); ! assertNull(tran.getReceiptId()); try { ledger.setReceiptId(tran.getRequestId(), "1234"); } catch (UnknownTransactionException e) { ! assertTrue(false); ! } ! assertEquals(aliceBalance - 100, ledger.getBalance(ALICE), 0); ! assertEquals(aliceBalance - 100, ledger.getAvailableBalance(ALICE), 0); ! assertEquals(bobBalance + 100, ledger.getBalance(BOB), 0); ! assertEquals(bobBalance + 100, ledger.getAvailableBalance(BOB), 0); ! ! ! } ! ! public final void testTransactionExists() throws LedgerException { ! PostedTransaction tran = transfer("bob", "alice", 100, "does this exist?"); ! assertNotNull(tran); ! assertTrue(ledger.transactionExists(tran.getRequestId())); ! } ! ! public final void testHeldTransactionExists() throws LedgerException { ! ensureBalance(100); ! PostedHeldTransaction tran = hold(ALICE, BOB, new Date(System.currentTimeMillis() + 1000), 100, "does this exist?"); ! assertNotNull(tran); ! assertTrue(ledger.heldTransactionExists(tran.getRequestId())); ! ! } ! ! public final void testSetHeldReceiptId() throws LedgerException { ! ensureBalance(100); ! final double aliceBalance = ledger.getBalance(ALICE); ! final double bobBalance = ledger.getBalance(BOB); ! ! PostedHeldTransaction tran = ledger.hold(ALICE, BOB, new Date(System.currentTimeMillis() + 5000), 100, "LOAN"); ! assertNull(tran.getReceiptId()); ! assertEquals(aliceBalance, ledger.getBalance(ALICE), 0); ! assertEquals(aliceBalance, ledger.getAvailableBalance(ALICE), 0); ! assertEquals(bobBalance, ledger.getBalance(BOB), 0); ! assertEquals(bobBalance, ledger.getAvailableBalance(BOB), 0); ! ! try { ! ledger.setHeldReceiptId(tran.getRequestId(), "1234"); ! } catch (UnknownTransactionException e) { ! assertTrue(false); } + PostedHeldTransaction t2 = ledger.findHeldTransaction(tran.getRequestId()); + assertEquals("1234", t2.getReceiptId()); + assertEquals(aliceBalance, ledger.getBalance(ALICE), 0); + assertEquals(aliceBalance - 100, ledger.getAvailableBalance(ALICE), 0); + assertEquals(bobBalance, ledger.getBalance(BOB), 0); + assertEquals(bobBalance, ledger.getAvailableBalance(BOB), 0); } *************** *** 382,386 **** 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); --- 467,471 ---- final String fundbook = "fund-" + System.currentTimeMillis(); final double fundbalance = ledger.getBalance(fundbook); ! transfer(fundbook, book, fundamount, "fund the benchmark"); System.out.println("Start Balance: " + ledger.getBalance(book)); assertEquals(fundamount, ledger.getAvailableBalance(book), 0); |
|
From: Pelle B. <pe...@us...> - 2004-04-06 23:03:18
|
Update of /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2934/src/java/org/neuclear/ledger/simple Modified Files: SimpleLedger.java Log Message: Updated Unit Tests Index: SimpleLedger.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-ledger/src/java/org/neuclear/ledger/simple/SimpleLedger.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SimpleLedger.java 5 Apr 2004 22:54:14 -0000 1.11 --- SimpleLedger.java 6 Apr 2004 22:50:14 -0000 1.12 *************** *** 4,7 **** --- 4,10 ---- * $Id$ * $Log$ + * Revision 1.12 2004/04/06 22:50:14 pelle + * Updated Unit Tests + * * Revision 1.11 2004/04/05 22:54:14 pelle * API changes in Ledger to support Auditor and CurrencyController in Pay *************** *** 202,205 **** --- 205,215 ---- */ public PostedHeldTransaction performHeldTransfer(final UnPostedHeldTransaction trans) throws UnBalancedTransactionException, LowlevelLedgerException, InvalidTransactionException { + Iterator iter = trans.getItems(); + 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()); + } + final PostedHeldTransaction posted = new PostedHeldTransaction(trans, new Date()); held.put(posted.getRequestId(), posted); |
|
From: <bug...@ve...> - 2004-04-06 22:05:34
|
Message: The following issue has been closed. --------------------------------------------------------------------- View the issue: http://jira.neuclear.org//browse/GL-37 Here is an overview of the issue: --------------------------------------------------------------------- Key: GL-37 Summary: Bump supported prevayler version to 2.0Rc1 Type: Improvement Status: Closed Priority: Major Resolution: FIXED Original Estimate: Unknown Time Spent: Unknown Remaining: Unknown Project: NeuClear Ledger Components: Prevalent Ledger Fix Fors: r_0_4 Versions: r_0_4 Assignee: Pelle Braendgaard Reporter: Pelle Braendgaard Created: Mon, 5 Apr 2004 4:03 PM Updated: Tue, 6 Apr 2004 3:05 PM Description: Latest prevayler to ensure future compatibility. --------------------------------------------------------------------- JIRA INFORMATION: This message is automatically generated by JIRA. If you think it was sent incorrectly contact one of the administrators: http://jira.neuclear.org//secure/Administrators.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |
|
From: <bug...@ve...> - 2004-04-06 21:37:43
|
Message:
The following issue has been closed.
Resolver: Pelle Braendgaard
Date: Tue, 6 Apr 2004 2:36 PM
Implemented and works.
---------------------------------------------------------------------
View the issue:
http://jira.neuclear.org//browse/GL-36
Here is an overview of the issue:
---------------------------------------------------------------------
Key: GL-36
Summary: Update Hibernate Ledger with lastest API changes
Type: Improvement
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: Mon, 5 Apr 2004 4:02 PM
Updated: Tue, 6 Apr 2004 2:36 PM
Description:
Update the Hibernate Ledger with the latest API changes:
- Dont count transactions in balances without receipt id
- Return Cancellation Date when Cancelling a Held transaction
- transactionExists()
- heldTransactionExists()
---------------------------------------------------------------------
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
|