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.                                           

Reply via email to