Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/senders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1482/src/java/org/neuclear/id/senders Added Files: LogSender.java NeuSender.java Sender.java SmtpSender.java SoapSender.java UnsupportedEndpointException.java Log Message: Further cleanups in neuclear-id. Moved everything under id. --- NEW FILE: LogSender.java --- package org.neuclear.id.senders; import org.neuclear.commons.NeuClearException; import org.neuclear.commons.Utility; import org.neuclear.commons.crypto.Base64; import org.neuclear.commons.time.TimeTools; import org.neuclear.id.SignedNamedObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; import java.sql.Timestamp; import java.text.ParseException; /** * (C) 2003 Antilles Software Ventures SA * User: pelleb * Date: Feb 14, 2003 * Time: 1:23:05 PM * $Id: LogSender.java,v 1.1 2004/03/02 18:59:10 pelle Exp $ * $Log: LogSender.java,v $ * Revision 1.1 2004/03/02 18:59:10 pelle * Further cleanups in neuclear-id. Moved everything under id. * * Revision 1.16 2004/02/18 00:14:33 pelle * Many, many clean ups. I've readded Targets in a new method. * Gotten rid of NamedObjectBuilder and revamped Identity and Resolvers * * Revision 1.15 2004/01/10 00:03:21 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.14 2003/12/19 18:03: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.13 2003/12/10 23:58:52 pelle * Did some cleaning up in the builders * Fixed some stuff in IdentityCreator * New maven goal to create executable jarapp * We are close to 0.8 final of ID, 0.11 final of XMLSIG and 0.5 of commons. * Will release shortly. * * Revision 1.12 2003/11/21 04:45:13 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.11 2003/11/19 23:33:59 pelle * Signers now can generatekeys via the generateKey() method. * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit. * SignedNamedObject now contains the full xml which is returned with getEncoded() * This means that it is now possible to further receive on or process a SignedNamedObject, leaving * NamedObjectBuilder for its original purposes of purely generating new Contracts. * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it. * Updated all major interfaces that used the old model to use the new model. * <p/> * Revision 1.10 2003/11/11 21:18:43 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. * <p/> * Revision 1.9 2003/11/09 03:27:19 pelle * More house keeping and shuffling about mainly pay * <p/> * Revision 1.8 2003/10/21 22:31:13 pelle * Renamed NeudistException to NeuClearException and moved it to org.neuclear.commons where it makes more sense. * Unhooked the XMLException in the xmlsig library from NeuClearException to make all of its exceptions an independent hierarchy. * Obviously had to perform many changes throughout the code to support these changes. * <p/> * Revision 1.7 2003/09/29 23:17:32 pelle * Changes to the senders. Now the senders only work with NamedObjectBuilders * which are the only NamedObject representations that contain full XML. * <p/> * Revision 1.6 2003/09/26 23:53:10 pelle * Changes mainly in receiver and related fun. * First real neuclear stuff in the payment package. Added TransferContract and AssetControllerReceiver. * <p/> * Revision 1.5 2003/09/26 00:22:07 pelle * Cleanups and final changes to code for refactoring of the Verifier and Reader part. * <p/> * Revision 1.4 2003/09/24 23:56:48 pelle * Refactoring nearly done. New model for creating signed objects. * With view for supporting the xmlpull api shortly for performance reasons. * Currently still uses dom4j but that has been refactored out that it * should now be very quick to implement a xmlpull implementation. * <p/> * A side benefit of this is that the API has been further simplified. I still have some work * todo with regards to cleaning up some of the outlying parts of the code. * <p/> * Revision 1.3 2003/09/23 19:16:28 pelle * Changed NameSpace to Identity. * To cause less confusion in the future. * <p/> * Revision 1.2 2003/09/22 19:24:02 pelle * More fixes throughout to problems caused by renaming. * <p/> * Revision 1.1.1.1 2003/09/19 14:41:29 pelle * First import into the neuclear project. This was originally under the SF neuclear * project. This marks a general major refactoring and renaming ahead. * <p/> * The new name for this code is NeuClear Identity and has the general package header of * org.neuclear.id * There are other areas within the current code which will be split out into other subprojects later on. * In particularly the signers will be completely seperated out as well as the contract types. * <p/> * <p/> * Revision 1.2 2003/02/16 00:23:05 pelle * LogSender now works and there is a corresponding server side cgi script to do the logging in * http://neuclear.org/logger/ Site is not yet up but will be soon. * <p/> * Revision 1.1 2003/02/14 21:10:34 pelle * The email sender works. The LogSender and the SoapSender should work but havent been tested yet. * The SignedNamedObject has a new log() method that logs it's contents at it's parent Identity's logger. * The Identity object also has a new method receive() which allows one to receive a named object to the Identity's * default receiver. */ public final class LogSender extends Sender { public final SignedNamedObject send(final String endpoint, final SignedNamedObject obj) throws NeuClearException { try { final String digest = obj.getDigest(); final String name = URLEncoder.encode(obj.getName(), "UTF-8"); final URL url = new URL(Utility.denullString(endpoint, LOGGER) + "?nohtml=1&name=" + name + "&digest=" + digest); url.openStream(); // BufferedReader reader=new BufferedReader(new InputStreamReader(url.openStream())); // String line=reader.readLine(); // if (!line.substring(0,2).equals("OK")) // TODO We need to be able to sense if there is a real error // System.err.println("Error logging: "+line); //throw new NeuClearException("Object wasn't logged"); } catch (MalformedURLException e) { Utility.rethrowException(e); } catch (IOException e) { Utility.rethrowException(e); } return null;// } /* public static void main(String args[]) { try { logObject("neu://free"); logObject("neu://free/pelle"); logObject("neu://pelle"); System.out.println("Object neu://free/pelle was logged at: " + getTimeStamp(NSResolver.resolveIdentity("neu://free/pelle"))); } catch (NeuClearException e) { e.printStackTrace(); //To change body of catch statement use Options | File Templates. } } */ public static Timestamp getTimeStamp(final String endpoint, final byte[] rdigest) throws NeuClearException { try { final String digest = Base64.encode(rdigest); // System.out.println(digest); final String encdigest = URLEncoder.encode(digest, "UTF-8"); URL url = null; url = new URL(LOGGER + "?mode=Query&nohtml=1&digest=" + encdigest); final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream())); final String line = reader.readLine(); // System.out.println(line); final int pos = line.indexOf('\t'); if (pos >= 0) { final String stamp = line.substring(0, pos); return TimeTools.parseTimeStamp(stamp); } } catch (MalformedURLException e) { Utility.rethrowException(e); //To change body of catch statement use Options | File Templates. } catch (IOException e) { Utility.rethrowException(e); //To change body of catch statement use Options | File Templates. } catch (ParseException e) { Utility.rethrowException(e); //To change body of catch statement use Options | File Templates. } return null; } /* public static Timestamp getTimeStamp(final SignedNamedObject obj) throws NeuClearException { return getTimeStamp(Utility.denullString(obj.getSignatory().getLogger(), LOGGER), obj.getEncoded().getBytes()); } */ /* private static void logObject(String name) throws NeuClearException { System.out.print("Fetching..."); SignedNamedObject obj = NSResolver.resolveIdentity(name); System.out.println("Got " + obj.getName()); Sender log = new LogSender(); System.out.print("Logging..."); log.receive(LOGGER, obj); System.out.println("Done"); } */ public static final String LOGGER = "http://logger.neuclear.org/log.cgi"; } --- NEW FILE: NeuSender.java --- package org.neuclear.id.senders; import org.neuclear.id.SignedNamedObject; import org.neuclear.id.NSTools; import org.neuclear.id.Identity; import org.neuclear.id.resolver.NSResolver; import org.neuclear.commons.NeuClearException; import org.neuclear.xml.XMLException; /** * Created by IntelliJ IDEA. * User: pelleb * Date: Dec 16, 2003 * Time: 8:42:56 AM * To change this template use Options | File Templates. */ public class NeuSender extends Sender{ public SignedNamedObject send(String endpoint, SignedNamedObject obj) throws NeuClearException, XMLException, UnsupportedEndpointException { if (NSTools.isValidName(endpoint)){ Identity id=NSResolver.resolveIdentity(endpoint); return id.receive(obj); } throw new UnsupportedEndpointException(this,endpoint); } } --- NEW FILE: Sender.java --- package org.neuclear.id.senders; /** * (C) 2003 Antilles Software Ventures SA * User: pelleb * Date: Feb 14, 2003 * Time: 9:29:29 AM * $Id: Sender.java,v 1.1 2004/03/02 18:59:10 pelle Exp $ * $Log: Sender.java,v $ * Revision 1.1 2004/03/02 18:59:10 pelle * Further cleanups in neuclear-id. Moved everything under id. * * Revision 1.15 2004/02/19 15:30:21 pelle * Various cleanups and corrections * * Revision 1.14 2003/12/16 15:05:00 pelle * Added SignedMessage contract for signing simple textual contracts. * Added NeuSender, updated SmtpSender and Sender to take plain email addresses (without the mailto:) * Added AbstractObjectCreationTest to make it quicker to write unit tests to verify * NamedObjectBuilder/SignedNamedObject Pairs. * Sample application has been expanded with a basic email application. * Updated docs for sample web app. * Added missing LGPL LICENSE.txt files to signer and sample app * * Revision 1.13 2003/12/10 23:58:52 pelle * Did some cleaning up in the builders * Fixed some stuff in IdentityCreator * New maven goal to create executable jarapp * We are close to 0.8 final of ID, 0.11 final of XMLSIG and 0.5 of commons. * Will release shortly. * * Revision 1.12 2003/11/21 04:45:13 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.11 2003/11/19 23:33:59 pelle * Signers now can generatekeys via the generateKey() method. * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit. * SignedNamedObject now contains the full xml which is returned with getEncoded() * This means that it is now possible to further receive on or process a SignedNamedObject, leaving * NamedObjectBuilder for its original purposes of purely generating new Contracts. * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it. * Updated all major interfaces that used the old model to use the new model. * * Revision 1.10 2003/11/11 21:18:43 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.9 2003/11/10 17:42:36 pelle * The AssetController interface has been more or less finalized. * CurrencyController fully implemented * AssetControlClient implementes a remote client for communicating with AssetControllers * * Revision 1.8 2003/11/09 03:27:19 pelle * More house keeping and shuffling about mainly pay * * Revision 1.7 2003/11/08 01:40:52 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. * TransferRequest/Receipt and its Held companions are now SignedNamedObjects. Thus to create them you must use * their matching TransferRequest/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.6 2003/11/06 23:48:59 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.5 2003/10/21 22:31:13 pelle * Renamed NeudistException to NeuClearException and moved it to org.neuclear.commons where it makes more sense. * Unhooked the XMLException in the xmlsig library from NeuClearException to make all of its exceptions an independent hierarchy. * Obviously had to perform many changes throughout the code to support these changes. * * Revision 1.4 2003/09/29 23:17:32 pelle * Changes to the senders. Now the senders only work with NamedObjectBuilders * which are the only NamedObject representations that contain full XML. * */ import org.neuclear.commons.NeuClearException; import org.neuclear.id.SignedNamedObject; import org.neuclear.xml.XMLException; import java.util.HashMap; import java.util.Map; public abstract class Sender { public abstract SignedNamedObject send(String endpoint, SignedNamedObject obj) throws NeuClearException, XMLException, UnsupportedEndpointException; public static SignedNamedObject quickSend(final String endpoint, final SignedNamedObject obj) throws NeuClearException { final String protocol = getProtocol(endpoint); final Sender sender = getSender(protocol); if (sender == null) throw new NeuClearException("Unsupported Send Protocol:" + endpoint.toString()); try { return sender.send(endpoint, obj); } catch (XMLException e) { throw new NeuClearException(e); } } private static String getProtocol(final String endpoint) throws NeuClearException { final int protloc = endpoint.indexOf(":"); final int atloc = endpoint.indexOf("@"); if (protloc < 0 && atloc < 0) throw new NeuClearException(endpoint + "Is not in URL format"); if (protloc >= 0) return endpoint.substring(0, protloc); return "mailto"; } public static Sender getSender(final String protocol) { makeSenders(); return (Sender) SENDERS.get(protocol); } private static HashMap makeSenders() { HashMap map = new HashMap(); map.put("soap", new SoapSender()); map.put("http", new SoapSender()); map.put("mailto", new SmtpSender()); map.put("neu", new NeuSender()); return map; } private static final Map SENDERS = makeSenders(); } --- NEW FILE: SmtpSender.java --- package org.neuclear.id.senders; /** * (C) 2003 Antilles Software Ventures SA * User: pelleb * Date: Feb 14, 2003 * Time: 9:52:38 AM * $Id: SmtpSender.java,v 1.1 2004/03/02 18:59:10 pelle Exp $ * $Log: SmtpSender.java,v $ * Revision 1.1 2004/03/02 18:59:10 pelle * Further cleanups in neuclear-id. Moved everything under id. * * Revision 1.17 2004/02/18 00:14:33 pelle * Many, many clean ups. I've readded Targets in a new method. * Gotten rid of NamedObjectBuilder and revamped Identity and Resolvers * * Revision 1.16 2003/12/16 15:05:00 pelle * Added SignedMessage contract for signing simple textual contracts. * Added NeuSender, updated SmtpSender and Sender to take plain email addresses (without the mailto:) * Added AbstractObjectCreationTest to make it quicker to write unit tests to verify * NamedObjectBuilder/SignedNamedObject Pairs. * Sample application has been expanded with a basic email application. * Updated docs for sample web app. * Added missing LGPL LICENSE.txt files to signer and sample app * * Revision 1.15 2003/12/10 23:58:52 pelle * Did some cleaning up in the builders * Fixed some stuff in IdentityCreator * New maven goal to create executable jarapp * We are close to 0.8 final of ID, 0.11 final of XMLSIG and 0.5 of commons. * Will release shortly. * * Revision 1.14 2003/11/21 04:45:13 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.13 2003/11/19 23:33:59 pelle * Signers now can generatekeys via the generateKey() method. * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit. * SignedNamedObject now contains the full xml which is returned with getEncoded() * This means that it is now possible to further receive on or process a SignedNamedObject, leaving * NamedObjectBuilder for its original purposes of purely generating new Contracts. * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it. * Updated all major interfaces that used the old model to use the new model. * * Revision 1.12 2003/11/11 21:18:43 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.11 2003/11/10 17:42:36 pelle * The AssetController interface has been more or less finalized. * CurrencyController fully implemented * AssetControlClient implementes a remote client for communicating with AssetControllers * * Revision 1.10 2003/11/08 01:40:53 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. * TransferRequest/Receipt and its Held companions are now SignedNamedObjects. Thus to create them you must use * their matching TransferRequest/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.9 2003/11/06 23:48:59 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.8 2003/10/25 00:39:54 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.7 2003/10/21 22:31:13 pelle * Renamed NeudistException to NeuClearException and moved it to org.neuclear.commons where it makes more sense. * Unhooked the XMLException in the xmlsig library from NeuClearException to make all of its exceptions an independent hierarchy. * Obviously had to perform many changes throughout the code to support these changes. * * Revision 1.6 2003/09/29 23:17:32 pelle * Changes to the senders. Now the senders only work with NamedObjectBuilders * which are the only NamedObject representations that contain full XML. * * Revision 1.5 2003/09/26 00:22:07 pelle * Cleanups and final changes to code for refactoring of the Verifier and Reader part. * * Revision 1.4 2003/09/24 23:56:48 pelle * Refactoring nearly done. New model for creating signed objects. * With view for supporting the xmlpull api shortly for performance reasons. * Currently still uses dom4j but that has been refactored out that it * should now be very quick to implement a xmlpull implementation. * * A side benefit of this is that the API has been further simplified. I still have some work * todo with regards to cleaning up some of the outlying parts of the code. * * Revision 1.3 2003/09/23 19:16:28 pelle * Changed NameSpace to Identity. * To cause less confusion in the future. * * Revision 1.2 2003/09/22 19:24:02 pelle * More fixes throughout to problems caused by renaming. * * Revision 1.1.1.1 2003/09/19 14:41:29 pelle * First import into the neuclear project. This was originally under the SF neuclear * project. This marks a general major refactoring and renaming ahead. * * The new name for this code is NeuClear Identity and has the general package header of * org.neuclear.id * There are other areas within the current code which will be split out into other subprojects later on. * In particularly the signers will be completely seperated out as well as the contract types. * * * Revision 1.1 2003/02/14 21:10:35 pelle * The email sender works. The LogSender and the SoapSender should work but havent been tested yet. * The SignedNamedObject has a new log() method that logs it's contents at it's parent Identity's logger. * The Identity object also has a new method receive() which allows one to receive a named object to the Identity's * default receiver. * */ import org.neuclear.commons.NeuClearException; import org.neuclear.commons.Utility; import org.neuclear.id.SignedNamedObject; import javax.mail.*; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import java.util.Date; import java.util.Properties; import java.util.regex.Pattern; public final class SmtpSender extends Sender { public final SignedNamedObject send(String endpoint, final SignedNamedObject obj) throws NeuClearException,UnsupportedEndpointException { final Properties props = System.getProperties(); if (endpoint.startsWith("mailto:")) endpoint = endpoint.substring(7); // -- Attaching to default Session, or we could start a new one -- props.put("mail.smtp.host", "neuclear.org");// TODO Remove this hardcoded mail server final Session session = Session.getDefaultInstance(props, null); try { // -- Create a new message -- final Message msg = new MimeMessage(session); // -- Set the FROM and TO fields -- msg.setFrom(new InternetAddress(getSender(obj)));// TODO Remove this hardcoded email msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(endpoint, false)); // -- We could include CC recipients too -- // if (cc != null) // msg.setRecipients(Message.RecipientType.CC // ,InternetAddress.parse(cc, false)); // -- Set the subject and body text -- msg.setSubject("You have received a New Named Object: " + obj.getName()); final BodyPart body = new MimeBodyPart(); body.setText("This message contains a signed named object. Please see http://neuclear.org for more info."); final Multipart multi = new MimeMultipart(); multi.addBodyPart(body); final BodyPart objpart = new MimeBodyPart(); objpart.setText(obj.getEncoded()); objpart.setHeader("Content-type", "application/nsdl"); multi.addBodyPart(objpart); msg.setContent(multi); msg.setHeader("X-Mailer", "NeuDist Framework"); msg.setSentDate(new Date()); // -- Send the message -- Transport.send(msg); } catch (MessagingException e) { e.printStackTrace(); //To change body of catch statement use Options | File Templates. Utility.rethrowException(e); } return null;// We never receive a response } private String getSender(final SignedNamedObject obj) { // Identity senderid=obj.getSignatory(); // final Matcher matcher = SENDER.matcher(senderid.getReceiver()); // if (matcher.matches()) // return matcher.group(2) ; return "du...@ne..."; } private static final Pattern SENDER = Pattern.compile("^(mailto:)([\\w-.]+\\@[\\w-.]+)"); } --- NEW FILE: SoapSender.java --- package org.neuclear.id.senders; /** * (C) 2003 Antilles Software Ventures SA * User: pelleb * Date: Feb 14, 2003 * Time: 9:50:30 AM * $Id: SoapSender.java,v 1.1 2004/03/02 18:59:10 pelle Exp $ * $Log: SoapSender.java,v $ * Revision 1.1 2004/03/02 18:59:10 pelle * Further cleanups in neuclear-id. Moved everything under id. * * Revision 1.14 2003/12/10 23:58:52 pelle * Did some cleaning up in the builders * Fixed some stuff in IdentityCreator * New maven goal to create executable jarapp * We are close to 0.8 final of ID, 0.11 final of XMLSIG and 0.5 of commons. * Will release shortly. * * Revision 1.13 2003/11/21 04:45:13 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.12 2003/11/19 23:33:59 pelle * Signers now can generatekeys via the generateKey() method. * Refactored the relationship between SignedNamedObject and NamedObjectBuilder a bit. * SignedNamedObject now contains the full xml which is returned with getEncoded() * This means that it is now possible to further receive on or process a SignedNamedObject, leaving * NamedObjectBuilder for its original purposes of purely generating new Contracts. * NamedObjectBuilder.sign() now returns a SignedNamedObject which is the prefered way of processing it. * Updated all major interfaces that used the old model to use the new model. * * Revision 1.11 2003/11/11 21:18:43 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.10 2003/11/10 17:42:36 pelle * The AssetController interface has been more or less finalized. * CurrencyController fully implemented * AssetControlClient implementes a remote client for communicating with AssetControllers * * Revision 1.9 2003/11/08 01:40:53 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. * TransferRequest/Receipt and its Held companions are now SignedNamedObjects. Thus to create them you must use * their matching TransferRequest/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.8 2003/11/06 23:48:59 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.7 2003/10/21 22:31:13 pelle * Renamed NeudistException to NeuClearException and moved it to org.neuclear.commons where it makes more sense. * Unhooked the XMLException in the xmlsig library from NeuClearException to make all of its exceptions an independent hierarchy. * Obviously had to perform many changes throughout the code to support these changes. * * Revision 1.6 2003/09/29 23:17:32 pelle * Changes to the senders. Now the senders only work with NamedObjectBuilders * which are the only NamedObject representations that contain full XML. * * Revision 1.5 2003/09/26 00:22:07 pelle * Cleanups and final changes to code for refactoring of the Verifier and Reader part. * * Revision 1.4 2003/09/24 23:56:48 pelle * Refactoring nearly done. New model for creating signed objects. * With view for supporting the xmlpull api shortly for performance reasons. * Currently still uses dom4j but that has been refactored out that it * should now be very quick to implement a xmlpull implementation. * * A side benefit of this is that the API has been further simplified. I still have some work * todo with regards to cleaning up some of the outlying parts of the code. * * Revision 1.3 2003/09/23 19:16:28 pelle * Changed NameSpace to Identity. * To cause less confusion in the future. * * Revision 1.2 2003/09/22 19:24:02 pelle * More fixes throughout to problems caused by renaming. * * Revision 1.1.1.1 2003/09/19 14:41:29 pelle * First import into the neuclear project. This was originally under the SF neuclear * project. This marks a general major refactoring and renaming ahead. * * The new name for this code is NeuClear Identity and has the general package header of * org.neuclear.id * There are other areas within the current code which will be split out into other subprojects later on. * In particularly the signers will be completely seperated out as well as the contract types. * * * Revision 1.1 2003/02/14 21:10:35 pelle * The email sender works. The LogSender and the SoapSender should work but havent been tested yet. * The SignedNamedObject has a new log() method that logs it's contents at it's parent Identity's logger. * The Identity object also has a new method receive() which allows one to receive a named object to the Identity's * default receiver. * */ import org.neuclear.commons.NeuClearException; import org.neuclear.id.SignedNamedObject; import org.neuclear.id.verifier.VerifyingReader; import org.neuclear.xml.XMLException; import org.neuclear.xml.soap.SOAPTools; public final class SoapSender extends Sender { public final SignedNamedObject send(final String endpoint, final SignedNamedObject obj) throws NeuClearException, XMLException { return VerifyingReader.getInstance().read(SOAPTools.soapRequest(endpoint, obj.getEncoded(), "/receive")); } } --- NEW FILE: UnsupportedEndpointException.java --- package org.neuclear.id.senders; import org.neuclear.commons.NeuClearException; /** * Created by IntelliJ IDEA. * User: pelleb * Date: Dec 16, 2003 * Time: 8:45:31 AM * To change this template use Options | File Templates. */ public class UnsupportedEndpointException extends NeuClearException { public UnsupportedEndpointException(Sender sender,String endpoint) { super("endpoint: "+endpoint+" not supported by: "+sender.getClass().getName()); this.endpoint=endpoint; this.sender=sender; } public String getEndpoint() { return endpoint; } public Sender getSender() { return sender; } private final String endpoint; private final Sender sender; } |