|
From: <pe...@us...> - 2004-01-10 00:01:22
|
Update of /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts
In directory sc8-pr-cvs1:/tmp/cvs-serv22932/src/java/org/neuclear/asset/contracts
Modified Files:
Asset.java
Log Message:
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.
Index: Asset.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-pay/src/java/org/neuclear/asset/contracts/Asset.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Asset.java 19 Dec 2003 18:02:35 -0000 1.11
--- Asset.java 10 Jan 2004 00:00:44 -0000 1.12
***************
*** 1,9 ****
package org.neuclear.asset.contracts;
- import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
import org.neuclear.id.*;
import org.neuclear.xml.xmlsec.KeyInfo;
import org.neuclear.xml.xmlsec.XMLSecTools;
--- 1,9 ----
package org.neuclear.asset.contracts;
import org.dom4j.Element;
import org.neuclear.commons.NeuClearException;
import org.neuclear.commons.Utility;
import org.neuclear.id.*;
+ import org.neuclear.senders.Sender;
import org.neuclear.xml.xmlsec.KeyInfo;
import org.neuclear.xml.xmlsec.XMLSecTools;
***************
*** 32,35 ****
--- 32,42 ----
$Id$
$Log$
+ Revision 1.12 2004/01/10 00:00:44 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.11 2003/12/19 18:02:35 pelle
Revamped a lot of exception handling throughout the framework, it has been simplified in most places:
***************
*** 110,115 ****
*/
public final class Asset extends Identity {
! protected Asset(final SignedNamedCore core, final String repository, final String signer, final String logger, final String receiver, final PublicKey pub, final int decimal, final double minimumTransaction) {
! super(core, repository, signer, logger, receiver, pub);
this.decimal = decimal;
this.multiplier = (int) Math.round(Math.pow(10, -decimal));
--- 117,123 ----
*/
public final class Asset extends Identity {
! protected Asset(final SignedNamedCore core, final String serviceurl,final PublicKey pub, final int decimal, final double minimumTransaction) {
! super(core, pub);
! this.serviceurl=serviceurl;
this.decimal = decimal;
this.multiplier = (int) Math.round(Math.pow(10, -decimal));
***************
*** 142,145 ****
--- 150,160 ----
}
+ public final String getServiceurl() {
+ return serviceurl;
+ }
+
+ public final SignedNamedObject send(SignedNamedObject object) throws NeuClearException {
+ return Sender.quickSend(serviceurl,object);
+ }
public static final class Reader implements NamedObjectReader {
***************
*** 153,160 ****
if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET))
throw new InvalidNamedObjectException(core.getName(),"Not in XML NameSpace: "+AssetGlobals.NS_ASSET.getURI());
! final String repository = elem.attributeValue(createNEUIDQName("repository"));
! final String signer = elem.attributeValue(createNEUIDQName("signer"));
! final String logger = elem.attributeValue(createNEUIDQName("logger"));
! final String receiver = elem.attributeValue(createNEUIDQName("receiver"));
final Element allowElement = InvalidNamedObjectException.assertContainsElementQName(core,elem,createNEUIDQName("allow"));
--- 168,172 ----
if (!elem.getNamespace().equals(AssetGlobals.NS_ASSET))
throw new InvalidNamedObjectException(core.getName(),"Not in XML NameSpace: "+AssetGlobals.NS_ASSET.getURI());
! final String serviceurl = elem.attributeValue(createNEUIDQName("serviceurl"));
final Element allowElement = InvalidNamedObjectException.assertContainsElementQName(core,elem,createNEUIDQName("allow"));
***************
*** 166,170 ****
final String min = elem.attributeValue("minimumxact");
final double minimum = (!Utility.isEmpty(min)) ? Double.parseDouble(min) : 0;
! return new Asset(core, repository, signer, logger, receiver, pub, decimal, minimum);
} catch (XMLSecurityException e) {
throw new InvalidNamedObjectException(core.getName(),e);
--- 178,182 ----
final String min = elem.attributeValue("minimumxact");
final double minimum = (!Utility.isEmpty(min)) ? Double.parseDouble(min) : 0;
! return new Asset(core, serviceurl, pub, decimal, minimum);
} catch (XMLSecurityException e) {
throw new InvalidNamedObjectException(core.getName(),e);
***************
*** 175,178 ****
--- 187,191 ----
}
+ private final String serviceurl;
private final int decimal;
private final int multiplier;
|