view src/fdl/test/debug2/ConnectionXMLBuilder.java @ 92:ea4ee892baf5

commit
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Thu, 22 Apr 2010 16:13:03 +0900
parents
children
line wrap: on
line source

package fdl.test.debug2;

import org.w3c.dom.*;

public class ConnectionXMLBuilder extends XMLBuilder {
	private Element connections;
	
	public ConnectionXMLBuilder(int id) {
		super();
		connections = document.createElement("connections");
		connections.setAttribute("id", new Integer(id).toString());
		document.appendChild(connections);
	}
	
	public void appendConnection(TupleId mytid, String host, int port, TupleId tid){
		Element connection = document.createElement("connection");
		connection.setAttribute("id", new Integer(mytid.id).toString());
		Element h = document.createElement("host");
		h.setTextContent(host);
		Element p = document.createElement("port");
		p.setAttribute("id", new Integer(port).toString());
		Element t = document.createElement("tid");
		t.setAttribute("id", new Integer(tid.id).toString());

		connections.appendChild(connection);
		connection.appendChild(h);
		connection.appendChild(p);
		connection.appendChild(t);
	}
	
}