|
From: <pe...@us...> - 2003-09-29 23:17:37
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders
In directory sc8-pr-cvs1:/tmp/cvs-serv8611/src/java/org/neuclear/senders
Modified Files:
LogSender.java Sender.java SmtpSender.java SoapSender.java
Log Message:
Changes to the senders. Now the senders only work with NamedObjectBuilders
which are the only NamedObject representations that contain full XML.
Index: LogSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/LogSender.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** LogSender.java 26 Sep 2003 23:53:10 -0000 1.6
--- LogSender.java 29 Sep 2003 23:17:32 -0000 1.7
***************
*** 2,5 ****
--- 2,7 ----
import org.neuclear.id.SignedNamedObject;
+ import org.neuclear.id.Named;
+ import org.neuclear.id.builders.NamedObjectBuilder;
import org.neuclear.id.resolver.NSResolver;
import org.neuclear.time.TimeTools;
***************
*** 23,26 ****
--- 25,32 ----
* $Id$
* $Log$
+ * 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.
+ *
* Revision 1.6 2003/09/26 23:53:10 pelle
* Changes mainly in receiver and related fun.
***************
*** 68,74 ****
*/
public class LogSender extends Sender {
! public void send(String endpoint, SignedNamedObject obj) throws NeudistException {
try {
! String digest = URLEncoder.encode(Base64.encode(obj.getDigest().getBytes()), "UTF-8");
String name = URLEncoder.encode(obj.getName(), "UTF-8");
URL url = new URL(Utility.denullString(endpoint, LOGGER) + "?nohtml=1&name=" + name + "&digest=" + digest);
--- 74,80 ----
*/
public class LogSender extends Sender {
! public void send(String endpoint, NamedObjectBuilder obj) throws NeudistException {
try {
! String digest = URLEncoder.encode(Base64.encode(obj.getDigest()), "UTF-8");
String name = URLEncoder.encode(obj.getName(), "UTF-8");
URL url = new URL(Utility.denullString(endpoint, LOGGER) + "?nohtml=1&name=" + name + "&digest=" + digest);
***************
*** 88,91 ****
--- 94,98 ----
}
+ /*
public static void main(String args[]) {
try {
***************
*** 98,101 ****
--- 105,109 ----
}
}
+ */
public static Timestamp getTimeStamp(String endpoint, byte rdigest[]) throws NeudistException {
***************
*** 128,131 ****
--- 136,140 ----
}
+ /*
private static void logObject(String name) throws NeudistException {
System.out.print("Fetching...");
***************
*** 138,141 ****
--- 147,151 ----
}
+ */
public static final String LOGGER = "http://logger.neuclear.org/log.cgi";
}
Index: Sender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/Sender.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Sender.java 27 Sep 2003 19:23:11 -0000 1.3
--- Sender.java 29 Sep 2003 23:17:32 -0000 1.4
***************
*** 1,38 ****
package org.neuclear.senders;
! import org.neuclear.id.SignedNamedObject;
! import org.neuclear.id.builders.NamedObjectBuilder;
import org.neudist.utils.NeudistException;
! /*
! 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
! */
! /**
! *
! * User: pelleb
! * Date: Sep 22, 2003
! * Time: 1:28:39 PM
! */
! public abstract class Sender {
! public abstract void send(String endpoint, NamedObjectBuilder obj) throws NeudistException;
- public static void quickSend(String receiver, NamedObjectBuilder obj) {
}
}
--- 1,59 ----
package org.neuclear.senders;
! /**
! * (C) 2003 Antilles Software Ventures SA
! * User: pelleb
! * Date: Feb 14, 2003
! * Time: 9:29:29 AM
! * $Id$
! * $Log$
! * 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.neudist.utils.NeudistException;
+ import org.neuclear.id.builders.NamedObjectBuilder;
! import java.util.HashMap;
! import java.util.Map;
! public abstract class Sender {
! public abstract void send(String endpoint,NamedObjectBuilder obj) throws NeudistException;
! public static void quickSend(String endpoint,NamedObjectBuilder obj) throws NeudistException {
! int protloc=endpoint.indexOf(":");
! if (protloc<0)
! throw new NeudistException(endpoint+"Is not in URL format");
! String protocol=endpoint.substring(0,protloc);
! Sender sender=getSender(protocol);
! if (sender==null)
! throw new NeudistException("Unsupported Send Protocol:" + endpoint.toString());
! sender.send(endpoint,obj);
! }
! public static Sender getSender(String protocol) {
! if (SENDERS==null){
! SENDERS=new HashMap();
! SENDERS.put("soap",new SoapSender());
! SENDERS.put("mailto",new SmtpSender());
! }
! return (Sender) SENDERS.get(protocol);
! }
! private static Map SENDERS;
! public static void main(String args[]){
! /*
! try {
! NameSpace pelle=(NameSpace)NamedObjectFactory.fetchNamedObject("neu://free/pelle");
! NamedObject free=NamedObjectFactory.fetchNamedObject("neu://free");
! pelle.send(free);
! } catch (NeudistException e) {
! e.printStackTrace(); //To change body of catch statement use Options | File Templates.
! }
! */
}
}
+
Index: SmtpSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/SmtpSender.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SmtpSender.java 26 Sep 2003 00:22:07 -0000 1.5
--- SmtpSender.java 29 Sep 2003 23:17:32 -0000 1.6
***************
*** 8,11 ****
--- 8,15 ----
* $Id$
* $Log$
+ * 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.
***************
*** 46,49 ****
--- 50,55 ----
import org.neuclear.id.SignedNamedObject;
+ import org.neuclear.id.Named;
+ import org.neuclear.id.builders.NamedObjectBuilder;
import org.neudist.utils.NeudistException;
import org.neudist.utils.Utility;
***************
*** 58,62 ****
public class SmtpSender extends Sender {
! public void send(String endpoint, SignedNamedObject obj) throws NeudistException {
Properties props = System.getProperties();
if (endpoint.startsWith("mailto:"))
--- 64,68 ----
public class SmtpSender extends Sender {
! public void send(String endpoint, NamedObjectBuilder obj) throws NeudistException {
Properties props = System.getProperties();
if (endpoint.startsWith("mailto:"))
Index: SoapSender.java
===================================================================
RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/senders/SoapSender.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** SoapSender.java 26 Sep 2003 00:22:07 -0000 1.5
--- SoapSender.java 29 Sep 2003 23:17:32 -0000 1.6
***************
*** 8,11 ****
--- 8,15 ----
* $Id$
* $Log$
+ * 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.
***************
*** 46,49 ****
--- 50,55 ----
import org.neuclear.id.SignedNamedObject;
+ import org.neuclear.id.Named;
+ import org.neuclear.id.builders.NamedObjectBuilder;
import org.neudist.utils.NeudistException;
import org.neudist.xml.soap.SOAPTools;
***************
*** 51,56 ****
public class SoapSender extends Sender {
! public void send(String endpoint, SignedNamedObject obj) throws NeudistException {
! //SOAPTools.soapRequest(endpoint, obj.getElement(), "/receive");TODO Rething this
}
}
--- 57,62 ----
public class SoapSender extends Sender {
! public void send(String endpoint, NamedObjectBuilder obj) throws NeudistException {
! SOAPTools.soapRequest(endpoint, obj.getElement(), "/receive");
}
}
|