if xmlnode is already in the DOM sent to the client then all he needs to do is grab the root node then walk down to the xmlnode to reference the node he needs
Martin Gainty From: shameerai...@gmail.com Date: Sat, 22 Nov 2014 02:19:03 +0530 Subject: Re: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared with service redeployment To: java-user@axis.apache.org Hi Jayanga, Create a JIRA for the above issue and you are more than welcome to provide a fix for it. IMO ServiceContext would be a good place to store nodeList. ThanksShameera. On Sat, Nov 22, 2014 at 2:11 AM, Shameera Rathnayaka <shameerai...@gmail.com> wrote: Hi Jayanga, For the sake of performance, only generated node list for a service is the very first time it gets a request. Then we save this nodelist against it service QName. So you can safely move this nodelist to serviceConfiguration level then the issue you mention will vanish. Or you can introduce a way to update nodeMap by checking last update time of the service. Thanks,Shameera. On Fri, Nov 21, 2014 at 12:56 AM, Jayanga Dissanayake <jsdjaya...@gmail.com> wrote: Hi, Yes. This is exactly my observation. Thanks for elaborating the above implementation. Here the 'nodeMap' is stored in the ConfigurationContext. Why it is stored in ConfigurationContext instead of ServiceContext. I think, if we need to update the 'nodeMap' when the services are redeployed, it should be stored in ServiceContext. Thanks,Jayanga. On Thu, Nov 20, 2014 at 9:34 PM, Martin Gainty <mgai...@hotmail.com> wrote: xmlnodes is *assumed* to be in your base configuration for nodeMap to be created properly IF xmlnodes is nowhere to be found a NEW nodeMap IS created via Map<QName, XmlNode> newNodeMap = new HashMap<QName, XmlNode>(); //assumptions xmlSchemaList is a set properly by constructor //elementQName is set properly by constructor xmlNodeGenerator = new XmlNodeGenerator(xmlSchemaList, elementQname); mainXmlNode = xmlNodeGenerator.getMainXmlNode(); //get the Queue from mainXmlNode queue = xmlNodeGenerator.getQueue(mainXmlNode); //put new mainxmlNode into newNodeMap and associate to elementQName newNodeMap.put(elementQname, mainXmlNode); //re-insert the new Map into configContext under 'xmlnodes' configContext.setProperty(JsonConstant.XMLNODES, newNodeMap); ELSE elementQname (passed in from XMLStreamReader) is searched within the xmlnodes IF elementQName is found in xmlnodes //a queue is acquired from existing nodeMap created from xmlnodes referenced by elementQName xmlNodeGenerator = new XmlNodeGenerator().getQueue(nodeMap.get(elementQname)) //if xmlnodes nodeMap exists but has NO elementQName entry then mainXmlNode will be used: //assumptions xmlSchemaList is a set properly by constructor //elementQName is set properly by constructor xmlNodeGenerator = new XmlNodeGenerator(xmlSchemaList, elementQname); mainXmlNode = xmlNodeGenerator.getMainXmlNode(); //get Queue from mainXMLNode queue = xmlNodeGenerator.getQueue(mainXmlNode); //put new mainXmlNode into existing nodeMap and associate with 'elementQName' nodeMap.put(elementQname, mainXmlNode); //re-insert the new Map into configContext under 'xmlnodes' configContext.setProperty(JsonConstant.XMLNODES, nodeMap); reference the 4.2.0 branch of WS02 codebase: https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.2.0/dependencies/axis2/1.6.1-wso2v10/modules/json/src/org/apache/axis2/json/gson/GsonXMLStreamReader.java does this conform to your observations? Martin Date: Thu, 20 Nov 2014 18:07:08 +0530 Subject: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared with service redeployment From: jsdjaya...@gmail.com To: java-user@axis.apache.org Hi All, I am trying out some samples with axis2 json.gson [1] implementation. In my sample I have an Axis2 service which accept and sends json contents. According to the json.gson implementation, it creates the 'NodeMap' in the first invocation and sets it in the ConfigurationContext. I made some changes to the json mappings in my service and simply redeploy the service without restarting the server. While doing this I found out that org.apache.axis2.json.gson.GsonXMLStreamReader failed to read the request. While debugging the code found out that, this is happened by the un-updated 'NodeMap' in the ConfigurationContext. Though my service get redeployed, the 'NodeMap' doesn't get updated. Once I try to access the service it tries to parse the request with old 'NodeMap' and fails. ConfigurationContext doesn't get updated/invalidated with service redeployment. So, shouldn't the 'NodeMap' be stored in a context like ServiceContext, which get refreshed with service redeployment. Can someone please help me to understand and solve the above issue. [1] http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/gson/ Thanks,Jayanga. -- Best Regards,Shameera Rathnayaka. email: shameera AT apache.org , shameerainfo AT gmail.comBlog : http://shameerarathnayaka.blogspot.com/ -- Best Regards,Shameera Rathnayaka. email: shameera AT apache.org , shameerainfo AT gmail.comBlog : http://shameerarathnayaka.blogspot.com/