perfsonar-dev - Re: LS GUI
Subject: perfsonar development work
List archive
- From: Maciej Glowiak <>
- To: Herbert Souza <>
- Cc: Perfsonar Development List <>
- Subject: Re: LS GUI
- Date: Tue, 16 Jan 2007 11:18:30 +0100
- Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA CXBIWXMAAEU1AABFNQF8gVf5AAAAB3RJTUUH1QYQDjo6uEWvwgAAAM5JREFUGNNN0LFqAkEUheGj KRZsfATrvENgYyH4APabxwgWGUUQC99BsNDCInUq7VImbbDZ0kayxBXMuN7jvTuKVh//mZlmQKZ1 EhQ8GAVgZECspEBdWQHRjR70KlgFKkoUaCw3ijSYQ4n5HfBK4a4jDcdDQPol/80Sr9BxZOOL4Fmr Jq8VBx7eopaSPvWGOm67fqol3j1q0XNs7Nk2cs6MU6gPNzf+ZGKQX4Ek8H6rAnFZnXB2vJxJcv8g C2P+WzL4tD+Txc4KydrIkh+eAdo01QbjQ84vAAAAAElFTkSuQmCC
- Organization: Poznan Supercomputing and Networking Center
[-- Herbert, copy of your email goes also on PerfSONAR-dev mailing list as the solution of your problem may be interesting for others --]
Herbert Souza wrote:
Dear Maciej,
I want to construct a GUI to access(register, query...) the LS. I thought on
using the JTree as the primary UI. But I do not want to create an xml file
(like LSRegisterRequest.xml) before I set all the parameters.
So I have to create it in the memory using probably the java Document object
from JDom and them send it to the LS to register it. Do you have any source
code that do that? Could you help me in that initiative?
Hi Herbert,
That's good approach. I started to do such work (I mean constructing messages) some time ago, but it was postponed.
During the last Cambridge meeting we had a duscussion about providing client API for LS. It would be a set of classes and message generators for LS messages.
Some work have been already done.
You may take a look on
org.perfsonar.client.commons.requests.lookupService.LSQueryRequestGenerator;
but it's commented and not used any more. The code inside let us to construct query message basing upon DOM Document.
The better (or maybe easier) idea is to use just NMWG Message class and finally serialize it to String or Document.
The example of it may be seen in
org.perfsonar.client.commons.requests.lookupService.LSRegisterRequestGenerator;
So I suggest you start from code of LSRegisterRequestGenerator class, method generateRequestMessage(). Of course treat it as just an example.
So, the idea is to (please read the code):
========================================================================
// ----------------------------------------------------------------
// create message first
// ----------------------------------------------------------------
Message message = new Message();
message.setId("anId");
message.setType("LSRegisterRequest");
// ------------------------
//fill it by other elements
// ------------------------
//metadata
Metadata metadata = new Metadata();
metadata.setId("serviceLookupInfo");
message.setMetadata(metadata);
Subject subject = new Subject();
subject.setId("commonParameters");
metadata.setSubject(subject);
// .... etc ......
// see example code of LSRegisterRequestGenerator for
// further details
// ----------------------------------------------------------------
// serialize if you want to have String as output (option 1)
// ----------------------------------------------------------------
String result = XMLUtils.serializeXML(message);
// ........
// ----------------------------------------------------------------
// or create document from message object and send it (option 2)
// ----------------------------------------------------------------
try {
//create document
DocumentBuilder builder = DocumentBuilderFactory.
newInstance().newDocumentBuilder();
Document requestDocument = builder.newDocument();
//get content od Document from message object
requestDocument = message.getDOM(requestDocument);
//send request Document to specified url of LS
AxisClient client = new AxisClient();
Document responseDocument =
client.sendRequest(
"http://address.of.the.LS/LookupService/xxx/yyy",
requestDocument);
//return response as Message
String parserFile = configuration.getProperty(
"service.sax_parser.config");
Message msg = XMLUtils.convertToMessage(
responseDocument,
parserFile);
//return message - Response in "msg"
} catch (Exception ex) {
//Error!!!
ex.printStackTrace();
}
========================================================================
I hope this helps.
Maciej
--
--------------------------------------------------------------------
| Maciej Glowiak Network Research and Development ||
|
Poznan Supercomputing and Networking Center ||
| (+48 61) 858 2024 http://monstera.man.poznan.pl/ ||
====================================================================
- Re: LS GUI, Maciej Glowiak, 01/16/2007
- RE: [pS-dev] Re: LS GUI, Michael Michalis, 01/16/2007
Archive powered by MHonArc 2.6.16.