Skip to Content.
Sympa Menu

perfsonar-dev - Res: LS GUI

Subject: perfsonar development work

List archive

Res: LS GUI


Chronological Thread 
  • From: Herbert Souza <>
  • To: Maciej Glowiak <>
  • Cc: Perfsonar Development List <>
  • Subject: Res: LS GUI
  • Date: Mon, 22 Jan 2007 11:02:31 -0800 (PST)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=p5KcWrukDeeZ8JjDy/SbFzuT+BetrGfV3oHmNqZu0ijSndnnwe94so6odPhKZR/MAA00xDtAyTMxzy8wmipbdGIqxELcPM/IoW58Vyxapk9zUHyfqDf7HJYvuZUoJO6hFDOHHOzEI/rtRLXbAfAbFUNuzdJMwxnkOdbJ5TCJ6vQ=;

The Query LS explain is about of the Query Message, because I am not seeing
in Query Message the xQuery expression like in old messages.

Thanks

++++++++++++++++++++++++ Query Message +++++++++++++++++++++++++++++
<nmwg:message
type="LSQueryRequest"
id="msg1"
xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/";

xmlns:xquery="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/";>

<nmwg:metadata id="meta1">

<xquery:subject id="sub1">
declare namespace nmwg="http://ggf.org/ns/nmwg/base/2.0/";;
declare namespace
perfsonar="http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/";;
declare namespace
psservice="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/";;
declare namespace
xquery="http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/";;


/nmwg:store/nmwg:metadata

</xquery:subject>
<nmwg:eventType>service.lookup.xquery</nmwg:eventType>

</nmwg:metadata>

<nmwg:data metadataIdRef="meta1"/>

</nmwg:message>

-------------------------------
Herbert Monteiro Souza

Cel Phone: +5571 88029549
Phone: +5571 33304658
-------------------------------
UNIFACS - UNIVERSIDADE SALVADOR
-------------------------------
NUPERC - NÚCLEO DE PESQUISA EM
REDES DE COMPUTADORES
-------------------------------

----- Mensagem original ----
De: Maciej Glowiak
<>
Para: Herbert Souza
<>
Cc: Perfsonar Development List
<>
Enviadas: Terça-feira, 16 de Janeiro de 2007 7:18:30
Assunto: Re: LS GUI

[-- 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/ ||
====================================================================




__________________________________________________
Fale com seus amigos de graça com o novo Yahoo! Messenger
http://br.messenger.yahoo.com/


  • Res: LS GUI, Herbert Souza, 01/22/2007
    • <Possible follow-up(s)>
    • Res: LS GUI, Herbert Souza, 01/22/2007

Archive powered by MHonArc 2.6.16.

Top of Page