|
From: <pe...@us...> - 2004-02-19 15:40:53
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16761/src/java/org/neuclear/senders Modified Files: Sender.java Log Message: Various cleanups and corrections Index: Sender.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/Sender.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Sender.java 16 Dec 2003 15:05:00 -0000 1.14 --- Sender.java 19 Feb 2004 15:30:21 -0000 1.15 *************** *** 8,11 **** --- 8,14 ---- * $Id$ * $Log$ + * 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. *************** *** 109,115 **** 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"; --- 112,118 ---- 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"; *************** *** 117,145 **** public static Sender getSender(final String protocol) { ! if (SENDERS == null) { ! SENDERS = new HashMap(); ! SENDERS.put("soap", new SoapSender()); ! SENDERS.put("http", new SoapSender()); ! SENDERS.put("mailto", new SmtpSender()); ! SENDERS.put("neu", new NeuSender()); ! } return (Sender) SENDERS.get(protocol); } ! private static Map SENDERS; ! public static void main(final String[] args) { ! /* ! try { ! NameSpace pelle=(NameSpace)NamedObjectFactory.fetchNamedObject("neu://free/pelle"); ! NamedObject free=NamedObjectFactory.fetchNamedObject("neu://free"); ! pelle.receive(free); ! } catch (NeuClearException e) { ! e.printStackTrace(); //To change body of catch statement use Options | File Templates. ! } ! */ - } } --- 120,139 ---- 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(); } |