You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jayanga Dissanayake <js...@gmail.com> on 2014/11/20 13:37:08 UTC
json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared
with service redeployment
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.
Re: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared
with service redeployment
Posted by Jayanga Dissanayake <js...@gmail.com>.
Hi Shameera,
Thanks for the comment.
I tried to store the nodeList in ServiceContext, it seems there is a small
issue in it.
GsonXMLStreamWriter works fine with this implementation,
but GsonXMLStreamReader is not.
org.apache.axis2.json.gson.JSONXMLStreamAPITest#xmlStreamAPITest() failed.
In the above test, it creates a SimpleHTTPServer with the axis2
configuration context.
When debugged the code, I found that ServiceContext is null, by the
time GsonXMLStreamReader
is created.
Could you please assist me on this.
Thanks,
Jayanga.
On Sat, Nov 22, 2014 at 3:26 AM, Shameera Rathnayaka <shameerainfo@gmail.com
> wrote:
> Nope, xmlNode won't sent back to the client. This is intermediate
> representation of xml schema. This is introduced mainly because parse the
> xml schema for a each request will decrease the overall performance.
>
> Thanks,
> Shameera.
>
> On Sat, Nov 22, 2014 at 3:09 AM, Martin Gainty <mg...@hotmail.com>
> wrote:
>
>> 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: shameerainfo@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.
>>
>> Thanks
>> Shameera.
>>
>> On Sat, Nov 22, 2014 at 2:11 AM, Shameera Rathnayaka <
>> shameerainfo@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 <
>> jsdjayanga@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 <mg...@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: jsdjayanga@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.com
>> Blog : http://shameerarathnayaka.blogspot.com/
>>
>>
>>
>>
>> --
>> Best Regards,
>> Shameera Rathnayaka.
>>
>> email: shameera AT apache.org , shameerainfo AT gmail.com
>> Blog : http://shameerarathnayaka.blogspot.com/
>>
>
>
>
> --
> Best Regards,
> Shameera Rathnayaka.
>
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>
Re: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared
with service redeployment
Posted by Shameera Rathnayaka <sh...@gmail.com>.
Nope, xmlNode won't sent back to the client. This is intermediate
representation of xml schema. This is introduced mainly because parse the
xml schema for a each request will decrease the overall performance.
Thanks,
Shameera.
On Sat, Nov 22, 2014 at 3:09 AM, Martin Gainty <mg...@hotmail.com> wrote:
> 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: shameerainfo@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.
>
> Thanks
> Shameera.
>
> On Sat, Nov 22, 2014 at 2:11 AM, Shameera Rathnayaka <
> shameerainfo@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 <
> jsdjayanga@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 <mg...@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: jsdjayanga@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.com
> Blog : http://shameerarathnayaka.blogspot.com/
>
>
>
>
> --
> Best Regards,
> Shameera Rathnayaka.
>
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>
--
Best Regards,
Shameera Rathnayaka.
email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/
RE: json.gson : 'NodeMap' in ConfigurationContext doesn't get
cleared with service redeployment
Posted by Martin Gainty <mg...@hotmail.com>.
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: shameerainfo@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 <sh...@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 <js...@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 <mg...@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: jsdjayanga@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/
Re: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared
with service redeployment
Posted by Shameera Rathnayaka <sh...@gmail.com>.
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.
Thanks
Shameera.
On Sat, Nov 22, 2014 at 2:11 AM, Shameera Rathnayaka <shameerainfo@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 <
> jsdjayanga@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 <mg...@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: jsdjayanga@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.com
> Blog : http://shameerarathnayaka.blogspot.com/
>
--
Best Regards,
Shameera Rathnayaka.
email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/
Re: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared
with service redeployment
Posted by Shameera Rathnayaka <sh...@gmail.com>.
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 <js...@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 <mg...@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: jsdjayanga@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.com
Blog : http://shameerarathnayaka.blogspot.com/
Re: json.gson : 'NodeMap' in ConfigurationContext doesn't get cleared
with service redeployment
Posted by Jayanga Dissanayake <js...@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 <mg...@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: jsdjayanga@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.
>
RE: json.gson : 'NodeMap' in ConfigurationContext doesn't get
cleared with service redeployment
Posted by Martin Gainty <mg...@hotmail.com>.
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: jsdjayanga@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.