Author |
Message
|
sajtron |
Posted: Tue May 31, 2011 7:32 am Post subject: User defined node cannot read UDP |
|
|
Novice
Joined: 31 May 2011 Posts: 24
|
Hi,
I have strange problem. There is a msgflow with defined UDP. The msgflow contains user defined node implemented in Java. When I want to get value of the UDP like this:
Code: |
getUserDefinedAttribute("CONST_TAS_CONFIG_FILE"); |
it just gives me null (the UDP is set to some non-null value). When I try to do it from JavaCompute node it works fine. InfoCenter only says that JavaCompute node can read UDP, but there is no explicit note that user defined nodes cannot.
Is it feature that user defined nodes are not allowed to read UDP?
If not, how to read it?
Thanks in advance. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Tue May 31, 2011 7:51 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
The Java getUserDefinedAttribute function works within the JCN. It will not work outside of a JCN. Thats why you get null. Find another way to pass-in runtime parameters. An example of another way is a Singleton which reads and stores a properties file. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
sajtron |
Posted: Tue May 31, 2011 10:10 am Post subject: |
|
|
Novice
Joined: 31 May 2011 Posts: 24
|
|
Back to top |
|
 |
mqjeff |
Posted: Tue May 31, 2011 10:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You should be able to access user defined properties from a user defined node.
You may need to do something other than use a user defined node to DEFINE a user defined property - for example a compute node.
But a JCN is just a subclass of the Java user defined node anyway - that is to say, it's a "general purpose" user defined node.
So there's no technical reason this method should be returning null if you run it in a JCN than in a java user defined node otherwise.
But there may be technical reasons why the user defined property hasn't been defined properly in a java user defined node. |
|
Back to top |
|
 |
sajtron |
Posted: Thu Jun 02, 2011 12:52 pm Post subject: |
|
|
Novice
Joined: 31 May 2011 Posts: 24
|
OK now I am a little bit confused
What kind of technical reasons do you mean? |
|
Back to top |
|
 |
jlaisbett |
Posted: Fri Jun 03, 2011 12:32 am Post subject: |
|
|
Apprentice
Joined: 27 Nov 2009 Posts: 39
|
There is a way to add support for user defined properties to a java user defined node, I have no idea if it's the only way but it does work (although it ain't the nicest approach in the world).
Open the .msgnode file in a text editor
Find the root tag of your node that will be like:
<eClassifiers xmi:type="eflow:FCMComposite" ...
and add the following attribute to it: udpSupport="true"
You can then use user defined properties the same way you would from a java compute node
I don't really know why the node editor doesn't have a tick box for that, although someone may know a better way to do it. |
|
Back to top |
|
 |
sajtron |
Posted: Sun Jun 05, 2011 4:35 am Post subject: |
|
|
Novice
Joined: 31 May 2011 Posts: 24
|
Thanks, and you were right it is not very nice. |
|
Back to top |
|
 |
|