Hi Udara, It works. I have added the relevant changes in CLI.
Thanks ! On Sat, Nov 8, 2014 at 12:00 PM, Manula Chathurika Thantriwatte < manu...@wso2.com> wrote: > Hi Udara, > > Thanks for the information. I'll try with this and update. > > Thanks ! > > On Sat, Nov 8, 2014 at 11:51 AM, Udara Liyanage <ud...@wso2.com> wrote: > >> Hi Manula, >> >> I was able to fix this without [] branckets. I added a wrapper class >> ServiceGroupPOJO as below >> >> >> 1. public class ServiceGroupPOJO >> 2. { >> 3. private ServiceGroupDefinition serviceGroupDefinition; >> 4. >> 5. public ServiceGroupDefinition getServiceGroupDefinition () >> 6. { >> 7. return serviceGroupDefinition; >> 8. } >> 9. >> 10. public void setServiceGroupDefinition (ServiceGroupDefinition >> serviceGroupDefinition) >> 11. { >> 12. this.serviceGroupDefinition = serviceGroupDefinition; >> 13. } >> 14. } >> >> >> Then response text can be converted to the wrapper class and you can get >> the object as below. >> >> >> 1. public class ConvertToBean { >> 2. public static void main(String[] args) { >> 3. >> 4. GsonBuilder gsonBuilder = new GsonBuilder(); >> 5. Gson gson = gsonBuilder.create(); >> 6. String json = "{\n" + >> 7. " \"serviceGroupDefinition\": {\n" + >> 8. " \"cartridges\": [\n" + >> 9. " \"mysql\"\n" + >> 10. " ],\n" + >> 11. " \"dependencies\": {\n" + >> 12. " \"startupOrders\": [\n" + >> 13. " \"group.group1,cartridge.mysql\" >> \n" + >> 14. " ]\n" + >> 15. " },\n" + >> 16. " \"name\": \"group2\",\n" + >> 17. " \"subGroups\": [\n" + >> 18. " \"group1\"\n" + >> 19. " ]\n" + >> 20. " }\n" + >> 21. "}"; >> 22. >> 23. ServiceGroupPOJO serviceGroupPOJO = gson.fromJson(json, >> ServiceGroupPOJO.class); >> 24. ServiceGroupDefinition serviceGroupDefinition = >> serviceGroupPOJO.getServiceGroupDefinition(); >> 25. >> 26. >> 27. } >> 28. } >> >> >> On Sat, Nov 8, 2014 at 8:15 AM, Manula Chathurika Thantriwatte < >> manu...@wso2.com> wrote: >> >>> Hi Nirmal, >>> >>> I have tried with the existing JSON format, but I'm unable to >>> deserialized it. Existing JSON format is follows. But in Partitions, >>> autoscaling policies, deployment policies we have JSON array format. >>> >>> { >>> "serviceGroup":{ >>> "cartridges":[ >>> "tomcat" >>> ], >>> "dependencies":{ >>> "startupOrders":[ >>> "group.group1,cartridge.tomcat" >>> ], >>> "terminationBehaviour":"terminate-dependents" >>> }, >>> "name":"group3", >>> "subGroups":[ >>> "group1" >>> ] >>> } >>> } >>> >>> Thanks ! >>> >>> >>> On Fri, Nov 7, 2014 at 10:19 PM, Nirmal Fernando <nirmal070...@gmail.com >>> > wrote: >>> >>>> Hi Manula, >>>> >>>> I am -0 to this change, since, having arrays make it difficult to >>>> process ! Can't we get it to work without arrays? >>>> >>>> On Fri, Nov 7, 2014 at 5:21 PM, Manula Chathurika Thantriwatte < >>>> manu...@wso2.com> wrote: >>>> >>>>> Hi All, >>>>> >>>>> I have done the sample test with the following code segment [1]. This >>>>> works successfully. I think we need to change the Service Definition bean >>>>> class and also we need to send service definition as JSON array. >>>>> >>>>> [1] >>>>> https://github.com/manulachathurika/TestRestEndpoint/blob/master/TestEndpoint/src/main/java/Main.java >>>>> >>>>> Thanks ! >>>>> >>>>> On Fri, Nov 7, 2014 at 8:50 PM, Manula Chathurika Thantriwatte < >>>>> manu...@wso2.com> wrote: >>>>> >>>>>> Hi Isuru, >>>>>> >>>>>> No, Still it didn't solve the issue. >>>>>> >>>>>> @Udara, Currently we get Partitions, Deployment Polices etc... as >>>>>> JSON array. I have done the test with Service Definition Group as JSON >>>>>> array and it works successful with the deserialization. IMHO is having >>>>>> JSON >>>>>> array for the Service Group Definition is good for consistency. But >>>>>> change >>>>>> this in the current movement might get some issues. WDYT ? >>>>>> >>>>>> Thanks ! >>>>>> >>>>>> >>>>>> On Fri, Nov 7, 2014 at 8:34 PM, Udara Liyanage <ud...@wso2.com> >>>>>> wrote: >>>>>> >>>>>>> Hi Manula, >>>>>>> >>>>>>> Why should we add [] brackets if there is only one ServiceGroup? >>>>>>> >>>>>>> On Fri, Nov 7, 2014 at 8:28 PM, Isuru Haththotuwa <isu...@apache.org >>>>>>> > wrote: >>>>>>> >>>>>>>> Hi Manula, >>>>>>>> >>>>>>>> Sorry if I'm missing something, but isn't this solved by the >>>>>>>> workaround Udara has mentioned in the mail thread [1] ? >>>>>>>> >>>>>>>> [1]. Json response shows arrays as string when there are single >>>>>>>> value >>>>>>>> >>>>>>>> On Fri, Nov 7, 2014 at 8:10 PM, Manula Chathurika Thantriwatte < >>>>>>>> manu...@wso2.com> wrote: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> Currently we get the service group definition using the GET curl >>>>>>>>> command as follows. >>>>>>>>> >>>>>>>>> { >>>>>>>>> "serviceGroup":{ >>>>>>>>> "cartridges":[ >>>>>>>>> "tomcat" >>>>>>>>> ], >>>>>>>>> "dependencies":{ >>>>>>>>> "startupOrders":[ >>>>>>>>> "group.group1,cartridge.tomcat" >>>>>>>>> ], >>>>>>>>> "terminationBehaviour":"terminate-dependents" >>>>>>>>> }, >>>>>>>>> "name":"group3", >>>>>>>>> "subGroups":[ >>>>>>>>> "group1" >>>>>>>>> ] >>>>>>>>> } >>>>>>>>> } >>>>>>>>> >>>>>>>>> But when we used describe partitions and describe deployment >>>>>>>>> policy commands in CLI we get the output as the JSON array. IMO is >>>>>>>>> above >>>>>>>>> service group definition should also be follow the same structure like >>>>>>>>> follows. >>>>>>>>> >>>>>>>>> { >>>>>>>>> "serviceGroup":[{ >>>>>>>>> "cartridges":[ >>>>>>>>> "tomcat" >>>>>>>>> ], >>>>>>>>> "dependencies":{ >>>>>>>>> "startupOrders":[ >>>>>>>>> "group.group1,cartridge.tomcat" >>>>>>>>> ], >>>>>>>>> "terminationBehaviour":"terminate-dependents" >>>>>>>>> }, >>>>>>>>> "name":"group3", >>>>>>>>> "subGroups":[ >>>>>>>>> "group1" >>>>>>>>> ] >>>>>>>>> } >>>>>>>>> ] >>>>>>>>> } >>>>>>>>> >>>>>>>>> Any thoughts of this ? Because according to the first JSON format >>>>>>>>> I'm unable to deserialized the JSON using the ServiceGroupDefinition >>>>>>>>> bean >>>>>>>>> class. >>>>>>>>> >>>>>>>>> Thanks ! >>>>>>>>> >>>>>>>>> -- >>>>>>>>> Regards, >>>>>>>>> Manula Chathurika Thantriwatte >>>>>>>>> Software Engineer >>>>>>>>> WSO2 Inc. : http://wso2.com >>>>>>>>> lean . enterprise . middleware >>>>>>>>> >>>>>>>>> email : manu...@wso2.com / man...@apache.org >>>>>>>>> phone : +94 772492511 >>>>>>>>> blog : http://manulachathurika.blogspot.com/ >>>>>>>>> >>>>>>>>> -- >>>>>>>>> <http://manulachathurika.blogspot.com/> >>>>>>>>> <http://manulachathurika.blogspot.com/> >>>>>>>>> Thanks and Regards, >>>>>>>>> >>>>>>>>> Isuru H. >>>>>>>>> <http://manulachathurika.blogspot.com/> >>>>>>>>> +94 716 358 048 <http://manulachathurika.blogspot.com/>* >>>>>>>>> <http://wso2.com/>* >>>>>>>>> >>>>>>>>> >>>>>>>>> * <http://wso2.com/>* >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> >>>>>>> Udara Liyanage >>>>>>> Software Engineer >>>>>>> WSO2, Inc.: http://wso2.com >>>>>>> lean. enterprise. middleware >>>>>>> >>>>>>> web: http://udaraliyanage.wordpress.com >>>>>>> phone: +94 71 443 6897 >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Regards, >>>>>> Manula Chathurika Thantriwatte >>>>>> Software Engineer >>>>>> WSO2 Inc. : http://wso2.com >>>>>> lean . enterprise . middleware >>>>>> >>>>>> email : manu...@wso2.com / man...@apache.org >>>>>> phone : +94 772492511 >>>>>> blog : http://manulachathurika.blogspot.com/ >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> -- >>>>> Regards, >>>>> Manula Chathurika Thantriwatte >>>>> Software Engineer >>>>> WSO2 Inc. : http://wso2.com >>>>> lean . enterprise . middleware >>>>> >>>>> email : manu...@wso2.com / man...@apache.org >>>>> phone : +94 772492511 >>>>> blog : http://manulachathurika.blogspot.com/ >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> -- >>>> Best Regards, >>>> Nirmal >>>> >>>> Nirmal Fernando. >>>> PPMC Member & Committer of Apache Stratos, >>>> Senior Software Engineer, WSO2 Inc. >>>> >>>> Blog: http://nirmalfdo.blogspot.com/ >>>> >>> >>> >>> >>> -- >>> Regards, >>> Manula Chathurika Thantriwatte >>> Software Engineer >>> WSO2 Inc. : http://wso2.com >>> lean . enterprise . middleware >>> >>> email : manu...@wso2.com / man...@apache.org >>> phone : +94 772492511 >>> blog : http://manulachathurika.blogspot.com/ >>> >>> >>> >>> >> >> >> -- >> >> Udara Liyanage >> Software Engineer >> WSO2, Inc.: http://wso2.com >> lean. enterprise. middleware >> >> web: http://udaraliyanage.wordpress.com >> phone: +94 71 443 6897 >> > > > > -- > Regards, > Manula Chathurika Thantriwatte > Software Engineer > WSO2 Inc. : http://wso2.com > lean . enterprise . middleware > > email : manu...@wso2.com / man...@apache.org > phone : +94 772492511 > blog : http://manulachathurika.blogspot.com/ > > > > -- Regards, Manula Chathurika Thantriwatte Software Engineer WSO2 Inc. : http://wso2.com lean . enterprise . middleware email : manu...@wso2.com / man...@apache.org phone : +94 772492511 blog : http://manulachathurika.blogspot.com/