Re: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared with service redeployment

Jayanga Dissanayake <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <CAL1_ndzGhzTMLJLc+nPDF1f=PTfVvuehZWrxRpvY0_NT8WMS7A@mail.gmail.com>
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 <[email protected]> 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: [email protected]
> To: [email protected]
>
>
> 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.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.