On Thu, Aug 1, 2013 at 12:09 PM, Sanjiva Weerawarana <[email protected]>wrote:
> Kasun please don't do org.apace.* for WSO2 written connectors! > > Yeah, sure. > > On Wed, Jul 31, 2013 at 2:20 PM, Kasun Indrasiri <[email protected]> wrote: > >> We are in the process of implementing several components which involves >> java sdks (twitter), although the class mediator approach works fine, it >> seems to introduce some usability issues. >> >> - Basically, a given class mediator simply get all the required >> properties from the message context where property names are hard coded in >> both template and class mediator. [1] >> >> - One possible approach that we can use is to use POJO mediator, so that >> we can dynamically resolve the incoming parameters and we could have >> minimal java code when implementing our connector. >> - We can even get more flexibility with spring mediator as well[2]. >> - However, class mediator approach is better when it comes to performance >> (since we use reflection in other two approaches). >> >> - We will do a PoC on these approaches and see how it goes. >> >> This is a sample config with POJO Mediator >> eg: >> >> package org.apache.twitter; >> >> import org.apache.synapse.Command; >> >> public class TwitterInvokeMediator implements Command { >> >> private String twitterSecrect; >> >> private String twitterId; >> >> private String message; >> >> public void execute() { >> >> System.out.println("TwitterID :" + twitterId); >> >> twitterId = "CDE"; >> >> } >> >> >> public String getTwitterSecrect() { >> >> return twitterSecrect; >> >> } >> >> public void setTwitterSecrect(String twitterSecrect) { >> >> this.twitterSecrect = twitterSecrect; >> >> } >> >> public String getTwitterId() { >> >> return twitterId; >> >> } >> >> public void setTwitterId(String twitterId) { >> >> this.twitterId = twitterId; >> >> } >> >> public String getMessage() { >> >> return message; >> >> } >> >> public void setMessage(String message) { >> >> this.message = message; >> >> } >> >> } >> >> >> Invocation : >> >> >> <pojoCommand name="org.apache.twitter.TwitterInvokeMediator"> >> >> <axis2ns1:property xmlns:axis2ns1=" >> http://ws.apache.org/ns/synapse" >> >> name="twitterId" >> >> expression="$ctx:TWID" >> >> action="ReadMessage"/> >> >> <axis2ns1:property xmlns:axis2ns1=" >> http://ws.apache.org/ns/synapse" >> >> name="twitterId" >> >> context-name="updatedID" >> >> >> action="UpdateContext"/> >> >> </pojoCommand> >> >> >> >> [1] >> https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/components/mediation/mediation-library/connectors/org.wso2.carbon.mediation.library.connectors.twitter/4.1.0/src/main/java/org/wso2/carbon/mediation/library/connectors/twitter/TwitterUpdateStatusMediator.java >> >> [2] >> https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/dependencies/synapse/2.1.1-wso2v3/modules/samples/src/main/java/samples/mediators/extensions/SpringCustomLogger.java >> -- >> Kasun Indrasiri >> Software Architect >> WSO2, Inc.; http://wso2.com >> lean.enterprise.middleware >> >> cell: +94 71 536 4128 >> Blog : http://kasunpanorama.blogspot.com/ >> > > > > -- > Sanjiva Weerawarana, Ph.D. > Founder, Chairman & CEO; WSO2, Inc.; http://wso2.com/ > email: [email protected]; phone: +94 11 763 9614; cell: +94 77 787 6880 | +1 > 650 265 8311 > blog: http://sanjiva.weerawarana.org/ > > Lean . Enterprise . Middleware > -- Kasun Indrasiri Software Architect WSO2, Inc.; http://wso2.com lean.enterprise.middleware cell: +94 71 536 4128 Blog : http://kasunpanorama.blogspot.com/
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
