# Developping Component Extension

**URL:** <https://techcommunity.softwareag.com/t/developping-component-extension/58576>\
**Category:** Forum\
**Tags:** Former-Crossvision-Products, Service-Orchestrator\
**Created:** [June 4, 2004, 9:16pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576 "2004-06-04T21:16:00Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nynyves](https://avatars.discourse-cdn.com/v4/letter/n/ce73a5/32.png) [@Nynyves](https://techcommunity.softwareag.com/u/Nynyves)\
**Post date:** [June 4, 2004, 9:16pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/1 "2004-06-04T21:16:00Z")

</div>

Hello everybody.  
  
With Mediator 7.2, in order to create my own component, I used a java class named message from the xbr.jar. In this class there is getProperties() function which retruns the Mediator Xbridge properties into a map.  
  
I want to do the same whith Mediator 7.3.1 but the new message class doesn’t include any getProperties() function.  
The new function have name like a(), b(), c(), and so on, and I don’t know which one matches with the old getProperties() function.  
  
Does anyone know which function I can use ?  
I have the same problem with the following functions:  
- getPayload()  
- setProperties()  
- setPayload()  
  
Thanks a lot for your help.

---

<div class="post-metadata">

**Author:** ![Andreas\_Goermer](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/andreas_goermer/32/94_2.png) [@Andreas\_Goermer](https://techcommunity.softwareag.com/u/Andreas_Goermer)\
**Post date:** [June 4, 2004, 9:45pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/2 "2004-06-04T21:45:59Z")

</div>

Hello Nynyves,  
To avoid a user needs to use internal system methods, which in fact is always dangerous in regard of possible differences between different product version, we provided in 7.3.1 two methods to create custom components. This are the Mediator Component Extensions and the Java Object Gateway. Please refere to the product documentation.  
I hope it helps.  
Regards  
Andreas

---

<div class="post-metadata">

**Author:** ![Jeff\_MAURY1](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jeff\_MAURY1](https://techcommunity.softwareag.com/u/Jeff_MAURY1)\
**Post date:** [June 16, 2004, 4:26pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/3 "2004-06-16T16:26:39Z")

</div>

I am developping a Java custom extension for Mediator 7.3.1.  
  
I am getting troubles when it comes to debugging. I tried to insert System.out.println statement but I cannot figure out where they are displayed (neither HostManager or JBoss consoles displayed them).  
  
I have another question:my extension expects the message payload as argument, how this can be achieved  
  
Thanks  
Jeff

---

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://techcommunity.softwareag.com/u/Matthew)\
**Post date:** [June 16, 2004, 6:14pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/4 "2004-06-16T18:14:11Z")

</div>

Hi Jeff,  
  
System.out.println is going to go into the great nothing and nowhere else. The ComponentFactory where your custom extension is running in a seperate JVM which does not output to a cmd window. You could stop the component factory and then start it with the StartFactory.bat file located in the directory “/Program Files/Software AG/EntireX XML Mediator/host/bin” if you are running on a windows platform. For Unix look to the directory $XBD\_HOST/bin.  
For the long term you may want to add some code to your custom component which writes your debugging information to the file system.  
  
Regards,  
  
- Matthew G.

---

<div class="post-metadata">

**Author:** ![Jeff\_MAURY1](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jeff\_MAURY1](https://techcommunity.softwareag.com/u/Jeff_MAURY1)\
**Post date:** [June 16, 2004, 6:33pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/5 "2004-06-16T18:33:16Z")

</div>

Thanks for the tip.  
I tried to log on a file but I wasn’t able to find the file on my disks. So I suspect my extension class is not loaded.  
Do you know how can I get loading information from Mediator. I changed the trace level to DEBUG but it says it calls my extensions.  
  
Thanks  
Jeff

---

<div class="post-metadata">

**Author:** ![Rolf\_Bahlke](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/rolf_bahlke/32/109_2.png) [@Rolf\_Bahlke](https://techcommunity.softwareag.com/u/Rolf_Bahlke)\
**Post date:** [June 16, 2004, 6:38pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/6 "2004-06-16T18:38:47Z")

</div>

> [@](#):
>
> For the long term you may want to add some code to your custom component which writes your debugging information to the file system.

This is actually rather simple because you can redirect System.out to a file: there is a method _java.lang.System.setOut_ which allows you to do that.  
  
Kind regards,  
Rolf

---

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://techcommunity.softwareag.com/u/Matthew)\
**Post date:** [June 16, 2004, 6:53pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/7 "2004-06-16T18:53:36Z")

</div>

Hi Jeff,  
  
If the component was not loaded then it will not show up in the SMH component list for that component factory or it will show up but will not be active (red instead of green light).  
  
If it isn’t showing up in SMH you probably have an error somewhere in the extension configuration file.  
  
- Matthew G.

---

<div class="post-metadata">

**Author:** ![Jeff\_MAURY1](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jeff\_MAURY1](https://techcommunity.softwareag.com/u/Jeff_MAURY1)\
**Post date:** [June 17, 2004, 3:42pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/8 "2004-06-17T15:42:00Z")

</div>

I am now able to call my component from a sequence. Now my component needs to get the message payload as an argument and returned a modified payload as a result.  
How can I pass the message payload as an argument to my component function ?  
  
Thanks  
Jeff

---

<div class="post-metadata">

**Author:** ![Jason](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@Jason](https://techcommunity.softwareag.com/u/Jason)\
**Post date:** [June 17, 2004, 5:07pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/9 "2004-06-17T17:07:21Z")

</div>

Jeff,  
  
You’ll use a Java Object Gateway step to make   
a copy of the message payload. The copy will  
be input to your component. The attached sequence might help.  
  
Regards,  
  
Jason  
[fopComp.xml](https://techcommunity.softwareag.com/uploads/short-url/scwjAKylzwjotCF379p0cBYDTgx.xml) (2.45 KB)

---

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://techcommunity.softwareag.com/u/Matthew)\
**Post date:** [June 17, 2004, 5:08pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/10 "2004-06-17T17:08:06Z")

</div>

Hi Jeff,  
  
Some bad news for you before you get too involved trying to get this running… There is a bug in the JOG Gateway which may prevent you from getting this up and running. A new patch should be released in July which corrects this problem.  
  
I will describe passing payloads to custom components for you in any case.  
  
To pass the payload to your component you first need to create an object. You do this by calling the JOG Gateway using the “message” function and choosing the “getContent” action.  
The actual step would look something like:  
  
  
  
The call to your component should then look like:  
  
\<step component=“MyComponent”  
my.prefix.function=“Call” my.prefix.input=“MyPayload” my.prefix.method=“run” my.prefix.result=“MyResult”  
my.prefix.do=“run(my.prefix.input)” /\>  
  
Follow this by a JOG Gateway call to return the result to the active payload…  
   
  
  
Sorry about the bad news regarding the bug, but the problem will be gone in short order.  
  
Regards,  
  
- Matthew G.

---

<div class="post-metadata">

**Author:** ![Jeff\_MAURY1](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jeff\_MAURY1](https://techcommunity.softwareag.com/u/Jeff_MAURY1)\
**Post date:** [June 21, 2004, 4:43pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/11 "2004-06-21T16:43:08Z")

</div>

I think I found the problem.  
When I tried the code sent by Jason, then I got an error saying that my component does not exists.  
Is this the bug you mentionned ?  
  
Is there a work around for this ?  
What’s about XPath expresssion ?  
I tried them but my component receive a String where I expect a DOM or like object (I used scort.mediator.inputObject={/}

---

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://techcommunity.softwareag.com/u/Matthew)\
**Post date:** [June 21, 2004, 5:22pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/12 "2004-06-21T17:22:33Z")

</div>

The problem you saw is a symptom of the bug I mentioned and there is no known workaround. As I mentioned, this is one of the major reasons we are planning on a patch in July.  
When you set properties to XPath expressions then the returned values are always string.  
The method for supplying your component with the payload is as I described it in the last message. The process I described creates a ByteArray which you can read into your class using the class java.io.ByteArrayInputStream. It is important that you return a ByteArray as well because this is the method the ComponentFactory uses to pass message objects between components.  
  
- Matthew G.

---

<div class="post-metadata">

**Author:** ![Jeff\_MAURY1](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jeff\_MAURY1](https://techcommunity.softwareag.com/u/Jeff_MAURY1)\
**Post date:** [June 22, 2004, 3:03pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/13 "2004-06-22T15:03:20Z")

</div>

I found a workaround for this problem !!!  
  
The workaround simply consist in using my own extension for Message getContent and addContent instead of using SAGJavaObjectGateway  
  
I think the limitation is that you can use a single Java extension in a sequence (or in the Factory)

---

<div class="post-metadata">

**Author:** ![Jeff\_MAURY1](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jeff\_MAURY1](https://techcommunity.softwareag.com/u/Jeff_MAURY1)\
**Post date:** [June 24, 2004, 11:24pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/14 "2004-06-24T23:24:00Z")

</div>

commons-logging questions:  
  
I have the following question: I want to add common-logging feature in my Java component extension. If I use the xbd category, this work fine and I am able to see my traces in factory.xbd.log.  
But if I want to use my own category, how do I specify the threshlod level for this category ?  
  
I found nothing in the general tab of my factory configuration

---

<div class="post-metadata">

**Author:** ![Matthew](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Matthew](https://techcommunity.softwareag.com/u/Matthew)\
**Post date:** [June 25, 2004, 1:24pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/15 "2004-06-25T13:24:45Z")

</div>

Where there is a will there is a way.   
Altering the logging configuration is not currently supported. There are of course ways to do this but you are then creating an installation where migration to future patch levels or versions would no longer be possible. Not without breaking your logging implementation anyway.  
Because of this I would not suggest it. You should instead concentrate on defining your own logging environment.  
Regards,  
  
- Matthew G.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:39pm UTC](https://techcommunity.softwareag.com/t/developping-component-extension/58576/16 "2021-04-02T14:39:20Z")

</div>


