Author |
Message
|
gyadavil |
Posted: Tue Sep 25, 2007 8:45 pm Post subject: How to Extract Environment data from JCN |
|
|
Acolyte
Joined: 01 Feb 2005 Posts: 62
|
I am trying to extract the environment variable inside a JCN which I set in a compute node. But I am always getting null for env. What's wrong with my code. Can someone help me out
ESQL:
Set Environment.Variables = Row(verb As Verb);
here verb is a variable.
JCN Code :
MbMessage inMessage = contact admin.getMessage();
MbMessage outMessage = new MbMessage(inMessage);
MbMessage env = contact admin.getGlobalEnvironment();
MbElement envElem = contact admin.getGlobalEnvironment().getRootElement();
byte[] envByte = envElem.toBitstream(null,null,null,0,1208,0);
String envStr = new String(envByte);
My Compute Node has the following properties set
Compute Mode: LocalEnvironment And Message
What is wrong with my code and why I am getting null for env variable. |
|
Back to top |
|
 |
littlechild |
Posted: Wed Sep 26, 2007 1:44 am Post subject: |
|
|
Novice
Joined: 22 Apr 2007 Posts: 17
|
i have written this code and it is working fine
ublic void evaluate(MbMessageAssembly assembly) throws MbException {
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbMessage message = assembly.getMessage();
// ----------------------------------------------------------
// Add user code below
MbElement rootElement =message.getRootElement();
MbElement rootElement123 = rootElement.getFirstElementByPath("Properties").getFirstElementByPath("MQMD");
MbMessage env = assembly.getGlobalEnvironment();
MbElement envElem = assembly.getGlobalEnvironment().getRootElement();
the value for env is MbMessage |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 26, 2007 3:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The root Environment tree does not have a parser assigned to it.
toBitstream only works on trees that have parsers assigned to them... this is why it has comments in the Javadoc for this method that tell you which trees it MUST be run against. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
gyadavil |
Posted: Wed Sep 26, 2007 10:40 am Post subject: |
|
|
Acolyte
Joined: 01 Feb 2005 Posts: 62
|
[quote="jefflowrey"]The root Environment tree does not have a parser assigned to it.
toBitstream only works on trees that have parsers assigned to them... this is why it has comments in the Javadoc for this method that tell you which trees it MUST be run against.[/quote]
I am trying to do this
MbElement envElem = contact admin.getGlobalEnvironment().getRootElement().getFirstChild();
String envStr = (String) envElem.getValue();
my envStr is null after this.
My ESQL is
Set Environment.Variables = Row(InputRoot.Properties.MessageType As MsgType);
Set Environment.Variables = Row(verb As Verb);
What wrong I am doing. My objective is to copy the values of Verb and MsgType into Java variables. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Sep 26, 2007 10:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Your ESQL doesn't do what you think it does.
Your Java doesn't match up with what your ESQL actually does. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|