Sorry, here after will concentrate more on log messages. -Ratha. On 12 October 2010 20:01, Afkham Azeez <[email protected]> wrote:
> Ratha, > Please use the proper key. BAM-236 not BAM 236. Only if the correct key is > used JIRA will be able to link the change set with the issue. > > Azeez > > > > On Tue, Oct 12, 2010 at 11:46 AM, <[email protected]> wrote: > >> Author: rathav >> Date: Mon Oct 11 23:16:46 2010 >> New Revision: 75459 >> URL: http://wso2.org/svn/browse/wso2?view=rev&revision=75459 >> >> Log: >> fix BAM 236 >> >> Added: >> >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/XPathStore.java >> Modified: >> >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/modules/XPathLookupHandler.java >> >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/resources/META-INF/module.xml >> >> Added: >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/XPathStore.java >> URL: >> http://wso2.org/svn/browse/wso2/trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/XPathStore.java?pathrev=75459 >> >> ============================================================================== >> --- (empty file) >> +++ >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/XPathStore.java >> Mon Oct 11 23:16:46 2010 >> @@ -0,0 +1,25 @@ >> +package org.wso2.carbon.bam.data.publisher.activity.mediation; >> + >> +import java.util.HashMap; >> +import java.util.Map; >> + >> +/** >> + * Store XPath values >> + * >> + */ >> +public class XPathStore { >> + >> + public static Map<String, Map<Integer, String>> xpMap = new >> HashMap<String, Map<Integer, String>>(); >> + >> + public static void storeXPath(String messageId, Map<Integer, String> >> map) { >> + xpMap.put(messageId, map); >> + } >> + >> + public static Map<Integer, String> getXPath(String messageId) { >> + return xpMap.get(messageId); >> + } >> + >> + public static void removeXPath(int key) { >> + xpMap.remove(key); >> + } >> +} >> >> Modified: >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/modules/XPathLookupHandler.java >> URL: >> http://wso2.org/svn/browse/wso2/trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/modules/XPathLookupHandler.java?rev=75459&r1=75458&r2=75459&view=diff >> >> ============================================================================== >> --- >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/modules/XPathLookupHandler.java >> (original) >> +++ >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/java/org/wso2/carbon/bam/data/publisher/activity/mediation/modules/XPathLookupHandler.java >> Mon Oct 11 23:16:46 2010 >> @@ -17,6 +17,7 @@ >> >> import java.io.ByteArrayInputStream; >> import java.util.Calendar; >> +import java.util.HashMap; >> import java.util.List; >> import java.util.Map; >> >> @@ -45,6 +46,7 @@ >> import >> org.wso2.carbon.bam.data.publisher.activity.mediation.config.EventingConfigData; >> import >> org.wso2.carbon.bam.data.publisher.activity.mediation.events.ActivityEvent; >> import >> org.wso2.carbon.bam.data.publisher.activity.mediation.events.ActivityThresholdEvent; >> +import org.wso2.carbon.bam.data.publisher.activity.mediation.XPathStore; >> import org.wso2.carbon.utils.multitenancy.CarbonContextHolder; >> import org.wso2.event.EventBrokerService; >> import org.wso2.event.exceptions.EventException; >> @@ -55,13 +57,15 @@ >> public class XPathLookupHandler extends AbstractHandler { >> >> private static Log log = LogFactory.getLog(XPathLookupHandler.class); >> - >> + private static Map<Integer, String> xpathValues = new >> HashMap<Integer, String>(); >> public InvocationResponse invoke(MessageContext messageContext) throws >> AxisFault { >> Map<String, String> activity; >> + Map<Integer, String> xpathDet; >> String activityID = ""; >> String messageDirection = ""; >> String xmlStream = >> messageContext.getEnvelope().getBody().toString(); >> List listOfNodes = null; >> + String messageDetail = ""; >> // xmlStream = >> // "<Persons><Person><Name>Dihini >> Himahansi</Name><Sex>Female</Sex><Address><City>Rajagiriya</City><District>Colombo</District><Country>Sri >> Lanka</Country></Address></Person><Person><Name>Thushari >> Damayanthi</Name><Sex>Female</Sex><Address><City>Ambalangoda</City><District>Galle</District><Country>Sri >> Lanka</Country></Address></Person></Persons>"; >> // String xpathExp = "/Persons/Person"; >> @@ -102,23 +106,33 @@ >> StAXBuilder builder = new >> StAXOMBuilder(byteArrayInputStream); >> OMElement root = >> builder.getDocumentElement(); >> AXIOMXPath xpath = new >> AXIOMXPath(xpathExp); >> - >> listOfNodes = xpath.selectNodes(root); >> if (listOfNodes != null && >> listOfNodes.size() > 0) { >> - for (int i = 0; i < >> listOfNodes.size(); i++) { >> - OMElement omElement = (OMElement) >> listOfNodes.get(i); >> - String xpathValue = >> omElement.toString(); >> - >> - AxisConfiguration axisConfig = >> messageContext.getConfigurationContext() >> - .getAxisConfiguration(); >> - >> - OMElement statMessage = >> PublisherUtils >> - >> .getMessageLookupEventPayload(messageContext, axisConfig, messageContext >> - >> .getAxisService().getName(), messageContext.getAxisOperation() >> - >> .getName().getLocalPart(), activityID, messageID, xpathExp, xpathValue, >> - >> messageDirection, BAMCalendar >> - >> .getInstance(Calendar.getInstance()) >> - >> .getBAMTimestamp()); >> + for (int i = 0; i < >> listOfNodes.size(); i++) { >> + OMElement omElement = >> (OMElement) listOfNodes.get(i); >> + String xpathValue = >> omElement.toString(); >> + storeXPath(i + 1, >> xpathValue); >> + } >> + storeXPathDetail(messageID, >> xpathValues); >> + } >> + if (XPathStore.getXPath(messageID) != >> null) { >> + xpathDet = >> XPathStore.getXPath(messageID); >> + String retrivedData = null; >> + for (int i = 0; i < >> xpathDet.size(); i++) { >> + retrivedData = xpathDet.get(i >> + 1); >> + } >> + messageDetail = messageDetail + >> retrivedData; >> + } >> + AxisConfiguration axisConfig = >> messageContext.getConfigurationContext() >> + .getAxisConfiguration(); >> + >> + OMElement statMessage = >> PublisherUtils >> + >> .getMessageLookupEventPayload(messageContext, axisConfig, messageContext >> + .getAxisService().getName(), >> messageContext.getAxisOperation().getName() >> + .getLocalPart(), activityID, >> messageID, xpathExp, messageDetail, >> + >> messageDirection, BAMCalendar >> + >> .getInstance(Calendar.getInstance()) >> + >> .getBAMTimestamp()); >> >> if (statMessage != null) { >> MessageContext eventMsgCtx = >> new MessageContext(); >> @@ -141,9 +155,7 @@ >> log.error("ActivityHandler >> - Unable to publish event", e); >> } >> } >> - } >> - } >> - } >> + } >> } >> } catch (JaxenException e) { >> log.error("Error in creating XPath" + e); >> @@ -158,4 +170,11 @@ >> } >> return InvocationResponse.CONTINUE; >> } >> + private synchronized void storeXPath(int key, String value) { >> + xpathValues.put(key, value); >> + } >> + >> + private synchronized void storeXPathDetail(String messageID, >> Map<Integer, String> map) { >> + XPathStore.storeXPath(messageID, map); >> + } >> } >> >> Modified: >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/resources/META-INF/module.xml >> URL: >> http://wso2.org/svn/browse/wso2/trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/resources/META-INF/module.xml?rev=75459&r1=75458&r2=75459&view=diff >> >> ============================================================================== >> --- >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/resources/META-INF/module.xml >> (original) >> +++ >> trunk/carbon/components/bam-data-publishers/org.wso2.carbon.bam.data.publisher.activity.mediation/src/main/resources/META-INF/module.xml >> Mon Oct 11 23:16:46 2010 >> @@ -12,11 +12,11 @@ >> <OutFlow> >> <handler name="ActivityOutHandler" >> >> >> class="org.wso2.carbon.bam.data.publisher.activity.mediation.modules.ActivityOutHandler"> >> - <order phaseFirst="true" phase="OpPhase" /> >> + <order phase="OpPhase" phaseLast="true" /> >> </handler> >> <handler name="XPathLookupHandler" >> >> >> class="org.wso2.carbon.bam.data.publisher.activity.mediation.modules.XPathLookupHandler"> >> - <order phase="OpPhase" phaseLast="true" /> >> + <order phaseFirst="true" phase="OpPhase" /> >> </handler> >> </OutFlow> >> <parameter name="adminModule" locked="true">true</parameter> >> >> _______________________________________________ >> Carbon-commits mailing list >> [email protected] >> https://wso2.org/cgi-bin/mailman/listinfo/carbon-commits >> > > > > -- > *Afkham Azeez* > Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com, > * > * > *Member; Apache Software Foundation; > **http://www.apache.org/*<http://www.apache.org/> > * > email: **[email protected]* <[email protected]>* cell: +94 77 3320919 > blog: **http://blog.afkham.org* <http://blog.afkham.org>* > twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> > * > linked-in: **http://lk.linkedin.com/in/afkhamazeez* > * > * > *Lean . Enterprise . Middleware* > >
_______________________________________________ Carbon-dev mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
