I think at least one example of POJO Mediator is required to explain what is
does to people.
It appears now that Example 380 is the completely wrong way to use Class
Mediator. 
This should be fixed and made into a POJO example. 

Can someone provide a good example of using a class mediator ?

The BASIC Authentication mediator that has been discussed previously in this
forum ,is a class Mediator 
and is a bad solution, as from this discussion it won't work when used
across multiple messages 
with different usernames and passwords.

That shoud be re-investigated. I believe it was submitted as a JIRA ????





Charith Wickramarachchi wrote:
> 
> Hi Kimhorn,
> 
> what i mean by " set earlier or (set from the out side )" is not setting
> the
> properties out side the class mediator
> 
> "<property name="reqUsername" value="username"/>
>    <property name="reqPassword" value="pasword"/>
>    <class name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator">
>    </class>
> "
> This is not i meant and of course is wont work. What i mean is if you
> could
> set the properties using a outside way (ex using the the incomming
> messagecontext)
> then you do not need to set them as properties in the class mediator in
> configuration.
> 
> In Ruwans reply what he ment by Static is not java static variable but it
> is
> static in a multiple message point of view.
> 
> thank you,
> Charith
> 
> 
> 
> 
> On Mon, Mar 9, 2009 at 8:51 AM, Ruwan Linton <[email protected]>
> wrote:
> 
>> Class mediator properties are static and doesn't depend on the current
>> message, you can only set static values to the class mediator and the
>> configuration for even that should be as follows;
>>
>>  <class name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator">
>>     <property name="reqUsername" value="username"/>
>>    <property name="reqPassword" value="pasword"/>
>>  </class>
>>
>> What suites your requirement is the pojoCommand mediator... please have a
>> look at it.
>>
>> Thanks,
>> Ruwan
>>
>>
>> On Mon, Mar 9, 2009 at 8:41 AM, kimhorn <[email protected]> wrote:
>>
>> >
>> >
>> > This does not appear to be the case.
>> >
>> > This fails, values are not set:
>> >
>> >    <property name="reqUsername" value="username"/>
>> >    <property name="reqPassword" value="pasword"/>
>> >     <class name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator">
>> >    </class>
>> >
>> >
>> >
>> >
>> > Charith Wickramarachchi wrote:
>> > >
>> > > Hi Kimhorn,
>> > >
>> > > AFAIK the class mediator use setter injection to set the properties
>> in
>> > the
>> > > class.
>> > >
>> > > this implies your class must have a setter for every property that
>> you
>> > are
>> > > going to populate from out side.
>> > >
>> > > ex property int abc---> setter : setAbc(int  abc)
>> > >
>> > > In your case if the properties reqUsername and reqPassword have been
>> set
>> > > earlier or (set from the out side )you can ommit them in the
>> confguration
>> > >
>> > > ex:
>> > >  <class name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator">
>> > >    </class>
>> > > this will work fine if your properties are set from outside;
>> > >
>> > > thank you,
>> > >
>> > > Charith
>> > >
>> > >
>> > >
>> > >
>> > > On Mon, Mar 9, 2009 at 8:08 AM, kimhorn <[email protected]>
>> wrote:
>> > >
>> > >>
>> > >> I have a problem calling a Java class when the property values are
>> set
>> > >> elsewhere
>> > >> in script. For example Username and Password are set earlier. How do
>> I
>> > >> pass
>> > >> them to my class, without specifying then as a Value ?
>> > >>
>> > >> Obviously this works:
>> > >>
>> > >>    <class
>> name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator">
>> > >>         <property name="reqUsername" value="cremedikhorn"/>
>> > >>         <property name="reqPassword" value="password0"/>
>> > >>    </class>
>> > >>
>> > >> What do I do if reqUsername and reqUsername have been set earlier ?
>> > >>
>> > >>    <class
>> name="net.icsglobal.thelma.synapse.CreateBasicAuthMediator">
>> > >>         <property name="reqUsername" />
>> > >>         <property name="reqPassword" />
>> > >>    </class>
>> > >>
>> > >> Doesn't work ?
>> > >>
>> > >> I would like these to be set by java code.
>> > >> Setting these values, in text, each time is not secure.
>> > >>
>> > >>
>> > >>
>> > >>
>> > >>
>> > >>
>> > >>
>> > >>
>> > >> --
>> > >> View this message in context:
>> > >>
>> >
>> http://www.nabble.com/Java-Class-Properties-Setting-tp22406236p22406236.html
>> > >> Sent from the Synapse - User mailing list archive at Nabble.com.
>> > >>
>> > >>
>> > >
>> > >
>> > > --
>> > > Charith Dhanushka Wickramarachchi
>> > > http://charithwiki.blogspot.com/
>> > >
>> > >
>> >
>> > --
>> > View this message in context:
>> >
>> http://www.nabble.com/Java-Class-Properties-Setting-tp22406236p22406491.html
>> > Sent from the Synapse - User mailing list archive at Nabble.com.
>> >
>> >
>>
>>
>> --
>> Ruwan Linton
>> http://wso2.org - "Oxygenating the Web Services Platform"
>> http://ruwansblog.blogspot.com/
>>
> 
> 
> 
> -- 
> Charith Dhanushka Wickramarachchi
> http://charithwiki.blogspot.com/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Java-Class-Properties-Setting-tp22406236p22406857.html
Sent from the Synapse - User mailing list archive at Nabble.com.

Reply via email to