|
From: <pe...@us...> - 2004-01-05 23:47:15
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/exchange/orders/builders
In directory sc8-pr-cvs1:/tmp/cvs-serv15193/src/java/org/neuclear/exchange/orders/builders
Added Files:
CancelExchangeBuilder.java CancelExchangeReceiptBuilder.java
CancelExchangeRequestBuilder.java
CompleteExchangeRequestBuilder.java
ExchangeReceiptBuilder.java ExchangeRequestBuilder.java
Log Message:
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.
--- NEW FILE: CancelExchangeBuilder.java ---
package org.neuclear.exchange.orders.builders;
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.transfers.TransferGlobals;
import org.neuclear.id.builders.NamedObjectBuilder;
import org.neuclear.commons.NeuClearException;
/*
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: CancelExchangeBuilder.java,v 1.1 2004/01/05 23:47:10 pelle Exp $
$Log: CancelExchangeBuilder.java,v $
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.4 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.3 2003/11/12 23:47:04 pelle
Much work done in creating good test environment.
PaymentReceiverTest works, but needs a abit more work in its environment to succeed testing.
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/10 17:42:07 pelle
The AssetController interface has been more or less finalized.
CurrencyController fully implemented
AssetControlClient implementes a remote client for communicating with AssetControllers
Revision 1.2 2003/11/09 03:26:47 pelle
More house keeping and shuffling about mainly pay
Revision 1.1 2003/11/09 03:10:13 pelle
Major changes that apparently didnt get properly checked in earlier.
Revision 1.2 2003/11/06 23:47:43 pelle
Major Refactoring of CurrencyController.
Factored out AssetController to be new abstract parent class together with most of its support classes.
Created (Half way) AssetControlClient, which can perform transactions on external AssetControllers via NeuClear.
Created the first attempt at the ExchangeAgent. This will need use of the AssetControlClient.
SOAPTools was changed to return a stream. This is required by the VerifyingReader in NeuClear.
Revision 1.1 2003/10/03 23:48:29 pelle
Did various security related updates in the pay package with regards to immutability of fields etc.
AssetControllerReceiver should now be operational. Real testing needs to be done including in particular setting the
private key of the Receiver.
A new class TransferGlobals contains usefull settings for making life easier in the other contract based classes.
TransferContract the signed contract is functional and has a matching TransferRequestBuilder class for programmatically creating
TransferRequests for signing.
TransferReceiptBuilder has been created for use by Transfer processors. It is used in the AssetControllerReceiver.
*/
/**
* User: pelleb
* Date: Oct 3, 2003
* Time: 3:13:27 PM
*/
public abstract class CancelExchangeBuilder extends NamedObjectBuilder {
protected CancelExchangeBuilder(final String tagname, final String name, final Asset asset, final String holdid) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(name, TransferGlobals.createQName(tagname));
if (asset == null)
throw new InvalidTransferException("assetName");
if (holdid == null)
throw new InvalidTransferException("holdid");
this.asset = asset;
final Element element = getElement();
element.add(TransferGlobals.createAttribute(element, "assetName", asset.getName()));
element.add(TransferGlobals.createAttribute(element, "holdid", holdid));
}
public final Asset getAsset() {
return asset;
}
private final Asset asset;
}
--- NEW FILE: CancelExchangeReceiptBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.exchange.orders.CancelExchangeOrder;
import org.neuclear.exchange.orders.CancelExchangeOrder;
import org.neuclear.exchange.orders.builders.CancelExchangeBuilder;
import org.neuclear.asset.orders.TransferGlobals;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.commons.NeuClearException;
import org.neuclear.id.NSTools;
/**
* (C) 2003 Antilles Software Ventures SA
* User: pelleb
* Date: Nov 10, 2003
* Time: 10:46:12 AM
* $Id: CancelExchangeReceiptBuilder.java,v 1.1 2004/01/05 23:47:10 pelle Exp $
* $Log: CancelExchangeReceiptBuilder.java,v $
* 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/12/06 00:16:10 pelle
* Updated various areas in NSTools.
* Updated URI Validation in particular to support new expanded format
* Updated createUniqueID and friends to be a lot more unique and more efficient.
* In CryptoTools updated getRandom() to finally use a SecureRandom.
* Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
*
* Revision 1.2 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).
* <p/>
* Revision 1.1 2003/11/10 17:42:07 pelle
* The AssetController interface has been more or less finalized.
* CurrencyController fully implemented
* 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());
}
}
--- NEW FILE: CancelExchangeRequestBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.exchange.orders.ExchangeOrderReceipt;
import org.neuclear.exchange.orders.ExchangeOrderReceipt;
import org.neuclear.exchange.orders.builders.CancelExchangeBuilder;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.commons.NeuClearException;
import org.neuclear.id.NSTools;
/**
* (C) 2003 Antilles Software Ventures SA
* User: pelleb
* Date: Nov 10, 2003
* Time: 10:46:12 AM
* $Id: CancelExchangeRequestBuilder.java,v 1.1 2004/01/05 23:47:10 pelle Exp $
* $Log: CancelExchangeRequestBuilder.java,v $
* 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/12/06 00:16:10 pelle
* Updated various areas in NSTools.
* Updated URI Validation in particular to support new expanded format
* Updated createUniqueID and friends to be a lot more unique and more efficient.
* In CryptoTools updated getRandom() to finally use a SecureRandom.
* Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is.
*
* Revision 1.2 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).
* <p/>
* Revision 1.1 2003/11/10 17:42:07 pelle
* The AssetController interface has been more or less finalized.
* CurrencyController fully implemented
* AssetControlClient implementes a remote client for communicating with AssetControllers
*/
public final class CancelExchangeRequestBuilder extends CancelExchangeBuilder {
public CancelExchangeRequestBuilder(final ExchangeOrderReceipt held) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(NSTools.createUniqueTransactionID(held.getAgent().getName(), held.getAsset().getName()), TransferGlobals.CANCEL_TAGNAME, held.getAsset(), held.getName());
}
}
--- NEW FILE: CompleteExchangeRequestBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.dom4j.Element;
import org.neuclear.asset.orders.TransferReceipt;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.asset.orders.TransferOrder;
import org.neuclear.asset.orders.builders.TransferBuilder;
import org.neuclear.exchange.orders.ExchangeOrderReceipt;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.asset.orders.builders.TransferBuilder;
import org.neuclear.exchange.orders.ExchangeOrderReceipt;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.id.Identity;
import org.neuclear.commons.NeuClearException;
import org.neuclear.exchange.orders.ExchangeOrderReceipt;
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: CompleteExchangeRequestBuilder.java,v 1.1 2004/01/05 23:47:10 pelle Exp $
$Log: CompleteExchangeRequestBuilder.java,v $
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.2 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.1 2003/11/10 17:42:07 pelle
The AssetController interface has been more or less finalized.
CurrencyController fully implemented
AssetControlClient implementes a remote client for communicating with AssetControllers
Revision 1.2 2003/11/09 03:26:47 pelle
More house keeping and shuffling about mainly pay
Revision 1.1 2003/11/09 03:10:13 pelle
Major changes that apparently didnt get properly checked in earlier.
Revision 1.2 2003/11/06 23:47:43 pelle
Major Refactoring of CurrencyController.
Factored out AssetController to be new abstract parent class together with most of its support classes.
Created (Half way) AssetControlClient, which can perform transactions on external AssetControllers via NeuClear.
Created the first attempt at the ExchangeAgent. This will need use of the AssetControlClient.
SOAPTools was changed to return a stream. This is required by the VerifyingReader in NeuClear.
Revision 1.1 2003/10/03 23:48:29 pelle
Did various security related updates in the pay package with regards to immutability of fields etc.
AssetControllerReceiver should now be operational. Real testing needs to be done including in particular setting the
private key of the Receiver.
A new class TransferGlobals contains usefull settings for making life easier in the other contract based classes.
TransferContract the signed contract is functional and has a matching TransferRequestBuilder class for programmatically creating
TransferRequests for signing.
TransferReceiptBuilder has been created for use by Transfer processors. It is used in the AssetControllerReceiver.
*/
/**
* User: pelleb
* Date: Oct 3, 2003
* Time: 6:28:26 PM
*/
public final class CompleteExchangeRequestBuilder extends TransferBuilder {
public CompleteExchangeRequestBuilder(final ExchangeOrderReceipt req,final Identity signatory,final String id,final double amount, final String comment) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(TransferGlobals.COMPLETE_TAGNAME,
req.getAsset(),
signatory,
req.getAgent(),
amount,
comment);
final Element element = getElement();
element.add(TransferGlobals.createAttribute(element, "sender", req.getFrom().getName()));
element.add(TransferGlobals.createAttribute(element, "holdid", req.getName()));
}
}
--- NEW FILE: ExchangeReceiptBuilder.java ---
package org.neuclear.exchange.orders.builders;
import org.dom4j.Element;
import org.neuclear.asset.InvalidTransferException;
import org.neuclear.asset.NegativeTransferException;
import org.neuclear.asset.orders.builders.TransferBuilder;
import org.neuclear.asset.orders.exchanges.ExchangeOrder;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.asset.orders.builders.TransferBuilder;
import org.neuclear.commons.time.TimeTools;
import org.neuclear.commons.NeuClearException;
import java.sql.Timestamp;
/*
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: ExchangeReceiptBuilder.java,v 1.1 2004/01/05 23:47:10 pelle Exp $
$Log: ExchangeReceiptBuilder.java,v $
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 ExchangeReceiptBuilder extends TransferBuilder {
public ExchangeReceiptBuilder(final ExchangeOrder req, final String id,Timestamp valuetime) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(TransferGlobals.HELD_XFER_RCPT_TAGNAME, req.getAsset(),req.getAsset(),req.getAmount());
final Element element = getElement();
element.add(TransferGlobals.createAttribute(element, "helduntil", TimeTools.formatTimeStamp(req.getValidTo())));
}
}
--- NEW FILE: ExchangeRequestBuilder.java ---
package org.neuclear.exchange.orders.builders;
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.builders.TransferBuilder;
import org.neuclear.asset.orders.transfers.TransferGlobals;
import org.neuclear.asset.orders.builders.TransferBuilder;
import org.neuclear.id.Identity;
import org.neuclear.commons.time.TimeTools;
import org.neuclear.commons.NeuClearException;
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: ExchangeRequestBuilder.java,v 1.1 2004/01/05 23:47:10 pelle Exp $
$Log: ExchangeRequestBuilder.java,v $
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: 7:59:13 PM
*/
public final class ExchangeRequestBuilder extends TransferBuilder {
public ExchangeRequestBuilder(final Asset asset, final Identity signer, final Identity agent, final double amount, final String comment, final Date helduntil) throws InvalidTransferException, NegativeTransferException, NeuClearException {
super(TransferGlobals.HELD_XFER_TAGNAME, asset, signer, agent, amount, comment);
final Element element = getElement();
element.add(TransferGlobals.createAttribute(element, "helduntil", TimeTools.formatTimeStamp(helduntil)));
element.add(TransferGlobals.createAttribute(element, "agent", agent.getName()));
}
}
|