|
From: <pe...@us...> - 2004-01-12 22:39:18
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/exchange/orders/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv12929/src/java/org/neuclear/exchange/orders/builders
Modified Files:
CancelExchangeReceiptBuilder.java ExchangeOrderBuilder.java
Added Files:
CancelExchangeOrderBuilder.java
ExchangeCompletedReceiptBuilder.java
ExchangeCompletionOrderBuilder.java
ExchangeOrderReceiptBuilder.java
Removed Files:
ExchangeReceiptBuilder.java
Log Message:
Completed all the builders and contracts.
Added a new abstract Value class to contain either an amount or a list of serial numbers.
Now ready to finish off the AssetControllers.
--- NEW FILE: CancelExchangeOrderBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.neuclear.id.builders.EmbeddedSignedObjectBuilder;
import org.neuclear.id.SignedNamedObject;
import org.neuclear.exchange.orders.ExchangeOrder;
import org.neuclear.exchange.orders.ExchangeGlobals;
import org.dom4j.QName;
/**
* Created by IntelliJ IDEA.
* User: pelleb
* Date: Jan 12, 2004
* Time: 4:31:10 PM
* To change this template use Options | File Templates.
*/
public class CancelExchangeOrderBuilder extends EmbeddedSignedObjectBuilder {
public CancelExchangeOrderBuilder(final ExchangeOrder embedded) {
super(ExchangeGlobals.createQName(ExchangeGlobals.CANCEL_TAGNAME), embedded);
}
}
--- NEW FILE: ExchangeCompletedReceiptBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.asset.orders.builders.ReceiptBuilder;
import org.neuclear.commons.NeuClearException;
import org.neuclear.exchange.orders.ExchangeGlobals;
import org.neuclear.exchange.orders.ExchangeOrder;
import org.neuclear.exchange.orders.ExchangeCompletionOrder;
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: ExchangeCompletedReceiptBuilder.java,v 1.1 2004/01/12 22:39:14 pelle Exp $
$Log: ExchangeCompletedReceiptBuilder.java,v $
Revision 1.1 2004/01/12 22:39:14 pelle
Completed all the builders and contracts.
Added a new abstract Value class to contain either an amount or a list of serial numbers.
Now ready to finish off the AssetControllers.
Revision 1.3 2004/01/11 00:39:06 pelle
Cleaned up the schemas even more they now all verifiy.
The Order/Receipt pairs for neuclear pay, should now work. They all have Readers using the latest
Schema.
The TransferBuilders are done and the ExchangeBuilders are nearly there.
The new EmbeddedSignedNamedObject builder is useful for creating new Receipts. The new ReceiptBuilder uses
this to create the embedded transaction.
ExchangeOrders now have the concept of BidItem's, you could create an ExchangeOrder bidding on various items at the same time, to be exchanged as one atomic multiparty exchange.
Still doesnt build yet, but very close now ;-)
Revision 1.2 2004/01/10 00:00:46 pelle
Implemented new Schema for Transfer*
Working on it for Exchange*, so far all Receipts are implemented.
Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
Changed SignedNamedObject.getDigest() from byte array to String.
The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
Revision 1.1 2004/01/05 23:47:10 pelle
Create new Document classification "order", which is really just inherint in the new
package layout.
Got rid of much of the inheritance that was lying around and thought a bit further about the format of the exchange orders.
Revision 1.1 2004/01/03 20:36:25 pelle
Renamed HeldTransfer to Exchange
Dropped valuetime from the request objects.
Doesnt yet compile. New commit to follow soon.
Revision 1.3 2003/11/21 04:43:03 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
Otherwise You will Finaliate.
Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
This should hopefully make everything more stable (and secure).
Revision 1.2 2003/11/11 21:17:19 pelle
Further vital reshuffling.
org.neudist.crypto.* and org.neudist.utils.* have been moved to respective areas under org.neuclear.commons
org.neuclear.signers.* as well as org.neuclear.passphraseagents have been moved under org.neuclear.commons.crypto as well.
Did a bit of work on the Canonicalizer and changed a few other minor bits.
Revision 1.1 2003/11/08 01:39:57 pelle
WARNING this rev is majorly unstable and will almost certainly not compile.
More major refactoring in neuclear-pay.
Got rid of neuclear-ledger like features of pay such as Account and Issuer.
Accounts have been replaced by Identity from neuclear-id
Issuer is now Asset which is a subclass of Identity
AssetController supports more than one Asset. Which is important for most non ecurrency implementations.
TransferOrder/Receipt and its Exchange companions are now SignedNamedObjects. Thus to create them you must use
their matching TransferOrder/ReceiptBuilder classes.
PaymentProcessor has been renamed CurrencyController. I will extract a superclass later to be named AbstractLedgerController
which will handle all neuclear-ledger based AssetControllers.
*/
/**
* User: pelleb
* Date: Nov 7, 2003
* Time: 8:05:15 PM
*/
public final class ExchangeCompletedReceiptBuilder extends ReceiptBuilder {
public ExchangeCompletedReceiptBuilder(final ExchangeCompletionOrder order,Date valuetime) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(ExchangeGlobals.createQName(ExchangeGlobals.COMPLETE_RCPT_TAGNAME), order,valuetime);
}
}
--- NEW FILE: ExchangeCompletionOrderBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.neuclear.id.builders.EmbeddedSignedObjectBuilder;
import org.neuclear.id.SignedNamedObject;
import org.neuclear.exchange.orders.ExchangeOrder;
import org.neuclear.exchange.orders.ExchangeGlobals;
import org.neuclear.asset.orders.TransferGlobals;
import org.neuclear.asset.orders.Value;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.commons.Utility;
import org.neuclear.commons.time.TimeTools;
import org.dom4j.QName;
import org.dom4j.Element;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* User: pelleb
* Date: Jan 12, 2004
* Time: 4:33:52 PM
* To change this template use Options | File Templates.
*/
public class ExchangeCompletionOrderBuilder extends EmbeddedSignedObjectBuilder{
public ExchangeCompletionOrderBuilder(final ExchangeOrder embedded, final Date exchangedate,final Value amount, final String comment) throws InvalidTransferException {
super(ExchangeGlobals.createQName(ExchangeGlobals.COMPLETE_TAGNAME), embedded);
final Element element = getElement();
getElement().addElement(ExchangeGlobals.EXCHANGE_TIME_TAGNAME).setText(TimeTools.formatTimeStamp(exchangedate));
element.add(TransferGlobals.createValueTag(amount));
if (!Utility.isEmpty(comment))
element.add(TransferGlobals.createElement(TransferGlobals.COMMENT_TAG, comment));
}
}
--- NEW FILE: ExchangeOrderReceiptBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.asset.orders.builders.ReceiptBuilder;
import org.neuclear.commons.NeuClearException;
import org.neuclear.exchange.orders.ExchangeGlobals;
import org.neuclear.exchange.orders.ExchangeOrder;
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: ExchangeOrderReceiptBuilder.java,v 1.1 2004/01/12 22:39:15 pelle Exp $
$Log: ExchangeOrderReceiptBuilder.java,v $
Revision 1.1 2004/01/12 22:39:15 pelle
Completed all the builders and contracts.
Added a new abstract Value class to contain either an amount or a list of serial numbers.
Now ready to finish off the AssetControllers.
Revision 1.3 2004/01/11 00:39:06 pelle
Cleaned up the schemas even more they now all verifiy.
The Order/Receipt pairs for neuclear pay, should now work. They all have Readers using the latest
Schema.
The TransferBuilders are done and the ExchangeBuilders are nearly there.
The new EmbeddedSignedNamedObject builder is useful for creating new Receipts. The new ReceiptBuilder uses
this to create the embedded transaction.
ExchangeOrders now have the concept of BidItem's, you could create an ExchangeOrder bidding on various items at the same time, to be exchanged as one atomic multiparty exchange.
Still doesnt build yet, but very close now ;-)
Revision 1.2 2004/01/10 00:00:46 pelle
Implemented new Schema for Transfer*
Working on it for Exchange*, so far all Receipts are implemented.
Added SignedNamedDocument which is a generic SignedNamedObject that works with all Signed XML.
Changed SignedNamedObject.getDigest() from byte array to String.
The whole malarchy in neuclear-pay does not build yet. The refactoring is a big job, but getting there.
Revision 1.1 2004/01/05 23:47:10 pelle
Create new Document classification "order", which is really just inherint in the new
package layout.
Got rid of much of the inheritance that was lying around and thought a bit further about the format of the exchange orders.
Revision 1.1 2004/01/03 20:36:25 pelle
Renamed HeldTransfer to Exchange
Dropped valuetime from the request objects.
Doesnt yet compile. New commit to follow soon.
Revision 1.3 2003/11/21 04:43:03 pelle
EncryptedFileStore now works. It uses the PBECipher with DES3 afair.
Otherwise You will Finaliate.
Anything that can be final has been made final throughout everyting. We've used IDEA's Inspector tool to find all instance of variables that could be final.
This should hopefully make everything more stable (and secure).
Revision 1.2 2003/11/11 21:17:19 pelle
Further vital reshuffling.
org.neudist.crypto.* and org.neudist.utils.* have been moved to respective areas under org.neuclear.commons
org.neuclear.signers.* as well as org.neuclear.passphraseagents have been moved under org.neuclear.commons.crypto as well.
Did a bit of work on the Canonicalizer and changed a few other minor bits.
Revision 1.1 2003/11/08 01:39:57 pelle
WARNING this rev is majorly unstable and will almost certainly not compile.
More major refactoring in neuclear-pay.
Got rid of neuclear-ledger like features of pay such as Account and Issuer.
Accounts have been replaced by Identity from neuclear-id
Issuer is now Asset which is a subclass of Identity
AssetController supports more than one Asset. Which is important for most non ecurrency implementations.
TransferOrder/Receipt and its Exchange companions are now SignedNamedObjects. Thus to create them you must use
their matching TransferOrder/ReceiptBuilder classes.
PaymentProcessor has been renamed CurrencyController. I will extract a superclass later to be named AbstractLedgerController
which will handle all neuclear-ledger based AssetControllers.
*/
/**
* User: pelleb
* Date: Nov 7, 2003
* Time: 8:05:15 PM
*/
public final class ExchangeOrderReceiptBuilder extends ReceiptBuilder {
public ExchangeOrderReceiptBuilder(final ExchangeOrder order,Date valuetime) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(ExchangeGlobals.createQName(ExchangeGlobals.EXCHANGE_RCPT_TAGNAME), order,valuetime);
}
}
Index: CancelExchangeReceiptBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/exchange/orders/builders/CancelExchangeReceiptBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** CancelExchangeReceiptBuilder.java 10 Jan 2004 00:00:46 -0000 1.2
--- CancelExchangeReceiptBuilder.java 12 Jan 2004 22:39:14 -0000 1.3
***************
*** 4,7 ****
--- 4,8 ----
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.asset.orders.TransferGlobals;
+ import org.neuclear.asset.orders.builders.ReceiptBuilder;
import org.neuclear.commons.NeuClearException;
import org.neuclear.exchange.orders.CancelExchangeOrder;
***************
*** 15,18 ****
--- 16,24 ----
* $Id$
* $Log$
+ * Revision 1.3 2004/01/12 22:39:14 pelle
+ * Completed all the builders and contracts.
+ * Added a new abstract Value class to contain either an amount or a list of serial numbers.
+ * Now ready to finish off the AssetControllers.
+ *
* Revision 1.2 2004/01/10 00:00:46 pelle
* Implemented new Schema for Transfer*
***************
*** 50,54 ****
* AssetControlClient implementes a remote client for communicating with AssetControllers
*/
! public final class CancelExchangeReceiptBuilder extends CancelExchangeBuilder {
public CancelExchangeReceiptBuilder(final CancelExchangeOrder req) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(NSTools.createUniqueTransactionID(req.getAsset().getName(), req.getSignatory().getName()), TransferGlobals.CANCEL_RCPT_TAGNAME, req.getAsset(), req.getHoldId());
--- 56,60 ----
* AssetControlClient implementes a remote client for communicating with AssetControllers
*/
! public final class CancelExchangeReceiptBuilder extends ReceiptBuilder {
public CancelExchangeReceiptBuilder(final CancelExchangeOrder req) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(NSTools.createUniqueTransactionID(req.getAsset().getName(), req.getSignatory().getName()), TransferGlobals.CANCEL_RCPT_TAGNAME, req.getAsset(), req.getHoldId());
Index: ExchangeOrderBuilder.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/exchange/orders/builders/ExchangeOrderBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ExchangeOrderBuilder.java 11 Jan 2004 00:39:06 -0000 1.1
--- ExchangeOrderBuilder.java 12 Jan 2004 22:39:15 -0000 1.2
***************
*** 2,19 ****
import org.dom4j.Element;
- import org.dom4j.QName;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.asset.contracts.Asset;
- import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.asset.orders.TransferGlobals;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
- import org.neuclear.id.Identity;
- import org.neuclear.id.NSTools;
- import org.neuclear.id.builders.NamedObjectBuilder;
- import org.neuclear.xml.xmlsec.SignedElement;
- import org.neuclear.exchange.orders.ExchangeGlobals;
import org.neuclear.exchange.contracts.ExchangeAgent;
/*
--- 2,17 ----
import org.dom4j.Element;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.asset.contracts.Asset;
import org.neuclear.asset.orders.TransferGlobals;
+ import org.neuclear.asset.orders.Value;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
import org.neuclear.exchange.contracts.ExchangeAgent;
+ import org.neuclear.exchange.orders.ExchangeGlobals;
+ import org.neuclear.exchange.orders.BidItem;
+ import org.neuclear.xml.xmlsec.SignedElement;
+ import org.neuclear.id.builders.Builder;
/*
***************
*** 37,40 ****
--- 35,43 ----
$Id$
$Log$
+ Revision 1.2 2004/01/12 22:39:15 pelle
+ Completed all the builders and contracts.
+ Added a new abstract Value class to contain either an amount or a list of serial numbers.
+ Now ready to finish off the AssetControllers.
+
Revision 1.1 2004/01/11 00:39:06 pelle
Cleaned up the schemas even more they now all verifiy.
***************
*** 124,131 ****
* Time: 3:13:27 PM
*/
! public class ExchangeOrderBuilder extends SignedElement {
! protected ExchangeOrderBuilder(final Asset asset, final ExchangeAgent agent, final double amount, final String comment) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(ExchangeGlobals.createQName(ExchangeGlobals.EXCHANGE_TAGNAME));
! if (amount < 0)
throw new NegativeTransferException(amount);
if (asset==null)
--- 127,134 ----
* Time: 3:13:27 PM
*/
! public class ExchangeOrderBuilder extends Builder {
! protected ExchangeOrderBuilder(final Asset asset, final ExchangeAgent agent, final Value amount, final BidItem items[], final String comment) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(ExchangeGlobals.createQName(ExchangeGlobals.EXCHANGE_TAGNAME));
! if (amount.getAmount() < 0)
throw new NegativeTransferException(amount);
if (asset==null)
***************
*** 137,141 ****
element.add(ExchangeGlobals.createElement(ExchangeGlobals.AGENT_TAG, agent.getName()));
element.add(TransferGlobals.createElement(TransferGlobals.ASSET_TAG, asset.getName()));
! element.add(TransferGlobals.createElement(TransferGlobals.AMOUNT_TAG,Double.toString(amount)));
if (!Utility.isEmpty(comment))
--- 140,151 ----
element.add(ExchangeGlobals.createElement(ExchangeGlobals.AGENT_TAG, agent.getName()));
element.add(TransferGlobals.createElement(TransferGlobals.ASSET_TAG, asset.getName()));
! element.add(TransferGlobals.createValueTag(amount));
!
! for (int i = 0; i < items.length; i++) {
! BidItem item = items[i];
! Element bidelem=element.addElement(ExchangeGlobals.BID_ITEM_TAG);
! bidelem.addElement(TransferGlobals.createQName(TransferGlobals.ASSET_TAG)).setText(item.getAsset().getName());
! bidelem.add(TransferGlobals.createValueTag(item.getAmount()));
! }
if (!Utility.isEmpty(comment))
--- ExchangeReceiptBuilder.java DELETED ---
|