Author |
Message
|
vmurali_au |
Posted: Thu Jun 01, 2006 6:58 am Post subject: Some questions about Java Compute Node |
|
|
 Voyager
Joined: 26 Mar 2004 Posts: 76
|
1) By using XPATH 1.0 syntax can i delete an element? I find that i can change the name & values, but can we delete it?. How?
Still do i have to use the regular DOM way of accessing XML elements like calling getFirstElement() etc functions to do this?
2) Can i propagate multiple messages from Java Compute node?. In ESQL node i can keep propagating multipe messages from a single input. Is it possible in Java Compute node?
3) ESQL compute node supports in-cache memory ("SHARED") variables. Is this available in Java? I found that i can access UDP in Java Compute Node. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 01, 2006 7:24 am Post subject: Re: Some questions about Java Compute Node |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
vmurali_au wrote: |
1) By using XPATH 1.0 syntax can i delete an element? I find that i can change the name & values, but can we delete it?. How?
Still do i have to use the regular DOM way of accessing XML elements like calling getFirstElement() etc functions to do this? |
Using the XPATH syntax gives you back an object of MbElement class. Using getFirstElement, etc, gives you back *the same* object of MbElement class.
vmurali_au wrote: |
2) Can i propagate multiple messages from Java Compute node?. In ESQL node i can keep propagating multipe messages from a single input. Is it possible in Java Compute node? |
I imagine that, if you could do this, you would have to be able to write a loop in Java that then called the propagate method on the output terminal.
vmurali_au wrote: |
3) ESQL compute node supports in-cache memory ("SHARED") variables. Is this available in Java? I found that i can access UDP in Java Compute Node. |
You can not easily access ESQL SHARED variables in Java. You can use MbSQLStatement to run an ESQL statement that will return the value of an ESQL Shared variable. You can likewise use MbSQLStatement to run an ESQL statement that will set the value of an ESQL Shared variable.
This will be slow, as MbSQLStatement does the equivalent of the ESQL EVAL function - which is slow.
You can use any normal Java mechanism to store objects in the execution group JVM - like a Singleton pattern, or a static object or etc. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
mgk |
Posted: Thu Jun 01, 2006 7:57 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
This statement is not correct:
Quote: |
You can use MbSQLStatement to run an ESQL statement that will return the va lue of an ESQL Shared variable |
This is because SHARED variables must be declared at MODULE or SCHEMA scope and you cannot declare an ESQL MODULE, SCHEMA (or Function or Procedure) from Java.
Currently there is no way to access an ESQL SHARED variable from a Java Node. However, Java has its own mechanisms for sharing data (Class Static variables) but you have to make sure access is thread safe.
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Jun 01, 2006 8:03 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I said "access", not "declare".
But I'll take your word for it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
vmurali_au |
Posted: Thu Jun 01, 2006 8:42 am Post subject: |
|
|
 Voyager
Joined: 26 Mar 2004 Posts: 76
|
Thanks Jeff & MGK.
What i want to know is, Is there a way to delete XML or MRM elements using XPATH? In ESQL code assigning NULL value to an element deletes it. So if i go for a Java Compute Node and manipulate elements using XPATH then is there an option/function provided to delete elements?
I dont want to use DOM like way of accessing elements like getFirstElement().getLastChild() etc and silimlar functions to access the elements and delete it. How can i do it using XPATH?
If i call the XPATH function "set-value(null)" on an XPATH element will it delete it?
So in Java Compute Node i can declare static java objects to store the shared data. Now this is clear.
Also as u said, I guess calling propagate() in a loop will help to generate multiple output messages.
I've one more doubt now. In all the ODBC DB access examples in a Java Compute Node, i see that the SQL statement is passed as a parameter to PASSTHRU statement in the MbSQLStatement. Do i have to use the PASSTHRU everytime i execute an SQL on DB? As far my undertstanding goes PASSTHRU is used to pass the SQL statement directly to the DB and execute it. The Broker wont try to interpret that SQL statement. But if i want to access DB without using PASSTHRU then do i have to access the Table name as "Database.schema.tablename" like we do in ESQL compute node? I tried this syntax and it didnt work. |
|
Back to top |
|
 |
JohnSmith |
Posted: Wed Apr 21, 2010 7:30 pm Post subject: |
|
|
Voyager
Joined: 17 Mar 2010 Posts: 86
|
I too have a question regarding JCN.
We are having a JCN in our main flow and it been deploed to Broker and working fine. Now, due to some logic change, we changed the propeties file present in our "Java Project" belonging to JavaComputeNode in our main flow. And, this time we built the bar file with only selecting the Java Project(which created a Jar in the bar file) and deployed it to the broker. But, these changes in the properties file is not taking into affect, is it because we need to deploy our main flow again to the broker??? Wouldn't it be sufficient to deploy only the Java Project and let the mainflow takes the new properties dynamically? |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Apr 21, 2010 10:33 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
JohnSmith wrote: |
I too have a question regarding JCN.
We are having a JCN in our main flow and it been deploed to Broker and working fine. Now, due to some logic change, we changed the propeties file present in our "Java Project" belonging to JavaComputeNode in our main flow. And, this time we built the bar file with only selecting the Java Project(which created a Jar in the bar file) and deployed it to the broker. But, these changes in the properties file is not taking into affect, is it because we need to deploy our main flow again to the broker??? Wouldn't it be sufficient to deploy only the Java Project and let the mainflow takes the new properties dynamically? |
AFAIK the properties you mention will only be accessed at eg/flow start time.
So you will need to either stop and start the flow, or reload the eg.
There is no deploy and magical dynamic access to the properties..., especially if all you deployed was the jar file. You would normally need to deploy the main flow...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
JohnSmith |
Posted: Thu Apr 22, 2010 4:23 pm Post subject: |
|
|
Voyager
Joined: 17 Mar 2010 Posts: 86
|
fjb_saper wrote:
Quote: |
AFAIK the properties you mention will only be accessed at eg/flow start time.
So you will need to either stop and start the flow, or reload the eg.
There is no deploy and magical dynamic access to the properties..., especially if all you deployed was the jar file. You would normally need to deploy the main flow... |
Yes, we had to deploy the main flow to resolve this problem, although stopping/starting the broker/EG is also a good option but as this environment was used by many people so we decided to go for the former approach.
Thanks for your help and reply.
Cheers!
Smith |
|
Back to top |
|
 |
goffinf |
Posted: Sun Apr 25, 2010 3:57 am Post subject: |
|
|
Chevalier
Joined: 05 Nov 2005 Posts: 401
|
vmurali_au wrote: |
What i want to know is, Is there a way to delete XML or MRM elements using XPATH? In ESQL code assigning NULL value to an element deletes it. So if i go for a Java Compute Node and manipulate elements using XPATH then is there an option/function provided to delete elements?
I dont want to use DOM like way of accessing elements like getFirstElement().getLastChild() etc and silimlar functions to access the elements and delete it. How can i do it using XPATH?
If i call the XPATH function "set-value(null)" on an XPATH element will it delete it? |
The XPath language is essentially for SELECTING nodes within the infoset only. As you mentioned yourself, to manipulate that tree you need to use one of the available APIs (DOM, SAX + variants) or use a transformation for example using XSLT.
Quote: |
XPATH function "set-value(null)" |
XPath function ??? are you sure ?
Fraser. |
|
Back to top |
|
 |
|