ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Traverse Environment Tree using Java Compute Node

Post new topic  Reply to topic
 Traverse Environment Tree using Java Compute Node « View previous topic :: View next topic » 
Author Message
gaurav.udgir
PostPosted: Thu May 21, 2009 6:23 am    Post subject: Traverse Environment Tree using Java Compute Node Reply with quote

Apprentice

Joined: 18 May 2009
Posts: 32

Hi All,

I would like to traverse a Environment Tree using a Java Compute Node and need to access the values in the code. I will be getting a structure like

Field1
subfield1
subfield2
...
subfieldn
Field2
subfield1
subfield2
...
subfieldn

I will not get how many number of sub-fields will be present in each field type record. I need to calculate these number of subfields under each Field. If some one is having some sample code or any hints, please help.

Regards,
Gaurav
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu May 21, 2009 6:28 am    Post subject: Re: Traverse Environment Tree using Java Compute Node Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

gaurav.udgir wrote:
any hints, please help.


Look at this the same way you would if it was a message structure.

It's straightforward to move through an unknown number of children in a tree (well it is in ESQL, Java who knows? Not me! ). Just go round the siblings until you run out.

Someone who knows Java may be able to offer actual code.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
WMBDEV1
PostPosted: Thu May 21, 2009 7:01 am    Post subject: Reply with quote

Sentinel

Joined: 05 Mar 2009
Posts: 888
Location: UK

As Vitor says, you can use getFirstChild() and getNextSibling() to navigate the tree.

Examples of these methods are shown below:

Code:

MbMessage message = assembly.getGlobalEnvironment();
MbElement element = message.getRootElement();
MeElement child = element.getFirstChild();
MbElement sibling = element.getNextSibling();


It should be easy for you to then navigate the tree by putting these lines into a recursive method and adding some base case checks in there.

I've done this in ESQL before... have you considering doing it in ESQL? I think it will perform better for you (if you are just doing trivial tree navigation).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Traverse Environment Tree using Java Compute Node
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.