|
From: Pelle B. <pe...@us...> - 2004-04-17 19:28:30
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/targets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30148/src/java/org/neuclear/id/targets Modified Files: Target.java Targets.java Log Message: Identity is now fully html based as is the ServiceBuilder. VerifyingReader correctly identifies html files and parses them as such. Targets and Target now parse html link tags AssetBuilder and ExchangeAgentBuilder have been updated to support it and provide html formatted contracts. The Asset.Reader and ExchangeAgent.Reader still need to be updated. Index: Target.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/targets/Target.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Target.java 19 Feb 2004 15:30:20 -0000 1.2 --- Target.java 17 Apr 2004 19:28:21 -0000 1.3 *************** *** 25,28 **** --- 25,35 ---- $Id$ $Log$ + Revision 1.3 2004/04/17 19:28:21 pelle + Identity is now fully html based as is the ServiceBuilder. + VerifyingReader correctly identifies html files and parses them as such. + Targets and Target now parse html link tags + AssetBuilder and ExchangeAgentBuilder have been updated to support it and provide html formatted contracts. + The Asset.Reader and ExchangeAgent.Reader still need to be updated. + Revision 1.2 2004/02/19 15:30:20 pelle Various cleanups and corrections *************** *** 64,68 **** final static Target parseElement(Element elem) { ! return make(elem.attributeValue("type"), elem.getTextTrim()); } --- 71,80 ---- final static Target parseElement(Element elem) { ! ! return make(extractType(elem), elem.attributeValue("href")); ! } ! ! private static String extractType(Element elem) { ! return elem.attributeValue("rel").substring(4); } *************** *** 70,81 **** private final int type; ! private final static HashMap TYPEMAP = new HashMap(); // Add further standard TYPES here - private final static String[] TYPES = new String[]{"misc", "auditor", "receiver", "logger"}; ! { for (byte i = 0; i < TYPES.length; i++) ! TYPEMAP.put(TYPES[i], new Byte(i)); } } --- 82,96 ---- private final int type; ! private final static String[] TYPES = new String[]{"misc", "auditor", "receiver", "logger", "controller"}; ! ! private final static HashMap TYPEMAP = makeTypeMap(); // Add further standard TYPES here ! private static HashMap makeTypeMap() { ! HashMap map = new HashMap(); for (byte i = 0; i < TYPES.length; i++) ! map.put(TYPES[i], new Byte(i)); ! return map; } } Index: Targets.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/id/targets/Targets.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Targets.java 2 Mar 2004 18:59:10 -0000 1.2 --- Targets.java 17 Apr 2004 19:28:22 -0000 1.3 *************** *** 28,31 **** --- 28,38 ---- $Id$ $Log$ + Revision 1.3 2004/04/17 19:28:22 pelle + Identity is now fully html based as is the ServiceBuilder. + VerifyingReader correctly identifies html files and parses them as such. + Targets and Target now parse html link tags + AssetBuilder and ExchangeAgentBuilder have been updated to support it and provide html formatted contracts. + The Asset.Reader and ExchangeAgent.Reader still need to be updated. + Revision 1.2 2004/03/02 18:59:10 pelle Further cleanups in neuclear-id. Moved everything under id. *************** *** 43,72 **** */ public final class Targets { ! private Targets(Target list[]){ ! targetlist=list; } public final void send(SignedNamedObject obj) throws NeuClearException { ! for (int i=0;i<targetlist.length;i++){ ! Sender.quickSend(targetlist[i].getHref(),obj); } } ! public final void send(String type,SignedNamedObject obj) throws NeuClearException { ! final int ti=Target.getType(type); ! for (int i=0;i<targetlist.length;i++){ ! if (targetlist[i].getType()==ti) ! Sender.quickSend(targetlist[i].getHref(),obj); } } public final void log(SignedNamedObject obj) throws NeuClearException { ! send("logger",obj); } ! public final static Targets parseList(Element elem){ ! List list=elem.elements("Target"); ! Target targets[]=new Target[list.size()]; ! Target signer=null; ! for (int i=0;i<list.size();i++){ ! targets[i]=Target.parseElement((Element) list.get(i)); } return new Targets(targets); --- 50,89 ---- */ public final class Targets { ! private Targets(Target list[]) { ! targetlist = list; } + public final void send(SignedNamedObject obj) throws NeuClearException { ! for (int i = 0; i < targetlist.length; i++) { ! Sender.quickSend(targetlist[i].getHref(), obj); } } ! ! public final void send(String type, SignedNamedObject obj) throws NeuClearException { ! final int ti = Target.getType(type); ! for (int i = 0; i < targetlist.length; i++) { ! if (targetlist[i].getType() == ti) ! Sender.quickSend(targetlist[i].getHref(), obj); } } + public final void log(SignedNamedObject obj) throws NeuClearException { ! send("logger", obj); } + public final int getSize() { + return targetlist.length; + } ! Target[] getTargets() { ! return targetlist; ! } ! ! public final static Targets parseList(Element elem) { ! List list = elem.selectNodes("//html/head/link[starts-with(@rel,'neu:')]"); ! Target targets[] = new Target[list.size()]; ! Target signer = null; ! for (int i = 0; i < list.size(); i++) { ! targets[i] = Target.parseElement((Element) list.get(i)); } return new Targets(targets); *************** *** 75,79 **** private final Target[] targetlist; ! public static final Targets EMPTY=new Targets(new Target[0]); } --- 92,96 ---- private final Target[] targetlist; ! public static final Targets EMPTY = new Targets(new Target[0]); } |