Java tutorial
package org.neuclear.exchange.contracts; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.Namespace; import org.dom4j.QName; import org.neuclear.id.verifier.VerifyingReader; /* 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: ExchangeAgentGlobals.java,v 1.2 2004/04/20 17:47:18 pelle Exp $ $Log: ExchangeAgentGlobals.java,v $ Revision 1.2 2004/04/20 17:47:18 pelle Fixes to ExchangeAgent to make it work with html contracts CurrencyTests fail. Revision 1.1 2004/04/05 16:31:42 pelle Created new ServiceBuilder class for creating services. A service is an identity that has a seperate service URL and Service Public Key. Revision 1.10 2004/04/02 16:58:54 pelle Updated Asset and Asset Builder with semi fully featured functionality. It now has Issuer, Service etc. Revision 1.9 2004/01/05 23:47:09 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.8 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.7 2003/12/19 18:02:35 pelle Revamped a lot of exception handling throughout the framework, it has been simplified in most places: - For most cases the main exception to worry about now is InvalidNamedObjectException. - Most lowerlevel exception that cant be handled meaningful are now wrapped in the LowLevelException, a runtime exception. - Source and Store patterns each now have their own exceptions that generalizes the various physical exceptions that can happen in that area. Revision 1.6 2003/11/22 00:22:28 pelle All unit tests in commons, id and xmlsec now work. AssetController now successfully processes payments in the unit test. Payment Web App has working form that creates a TransferOrder presents it to the signer and forwards it to AssetControlServlet. (Which throws an XML Parser Exception) I think the XMLReaderServlet is bust. Revision 1.5 2003/11/21 04:43:04 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.4 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.3 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/08 01:39:58 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. Revision 1.3 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.2 2003/10/25 00:38:43 pelle Fixed SmtpSender it now sends the messages. Refactored CommandLineSigner. Now it simply signs files read from command line. However new class IdentityCreator is subclassed and creates new Identities. You can subclass CommandLineSigner to create your own variants. Several problems with configuration. Trying to solve at the moment. Updated PicoContainer to beta-2 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:55:06 PM */ public final class ExchangeAgentGlobals { private ExchangeAgentGlobals() { // Instantiation is not allowed } private static Namespace createNameSpace() { return DocumentHelper.createNamespace(EXA_NSPREFIX, EXAGENT_URI); } public static QName createQName(final String name) { return DocumentHelper.createQName(name, NS_EXAGENT); } public static void addAttribute(final Element elem, final String name, final String value) { elem.addAttribute(createQName(name), value); } public static Element createElement(final String name) { return DocumentHelper.createElement(createQName(name)); } public static final String EXCHANGEAGENT_TAGNAME = "exchange"; public static final String EXAGENT_URI = "http://neuclear.org/neu/exchangeagent.xsd"; public static final String EXA_NSPREFIX = "exa"; public static final Namespace NS_EXAGENT = createNameSpace(); public static void registerReaders() { VerifyingReader.getInstance().registerReader(ExchangeAgentGlobals.EXCHANGEAGENT_TAGNAME, new ExchangeAgent.Reader()); } static { registerReaders(); } }