You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@airavata.apache.org by Shameera Rathnayaka <sh...@gmail.com> on 2013/09/07 18:58:13 UTC

Store Graph data in JSON fromat.

Hi Devs,

Currently graph data (Content of .xwf file) is being stored in XML fromat.
In GSoC master project what we have is graph data in JSON format. Therefore
we need a way to store this JSON data on registry. First i thought to
convert the json data to xml in registry rest api and store it. But it
seems we can store this in JSON fromat too. To do that what i am going to
do is, add following methods to UserWorkflowRegistry interface and
implement those methods in implementation classes. It would be great to
know your ideas about this. Please suggest if there any other way to
handle this.

    public void addWorkflowInJSON(String workflowName, String
workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
RegistryException;
    public void updateWorkflowInJSON(String workflowName, String
workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
RegistryException;
    public String getWorkflowGraphJSON(String workflowName) throws
UserWorkflowDoesNotExistsException, RegistryException;

Thanks,
Shameera.


-- 
Best Regards,
Shameera Rathnayaka.

email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/

Re: Store Graph data in JSON fromat.

Posted by Saminda Wijeratne <sa...@gmail.com>.
On Sun, Sep 8, 2013 at 1:45 PM, Shameera Rathnayaka
<sh...@gmail.com>wrote:

> Hi Saminda et al.
>
> It seems my previous reply has mislead you guys, Let me explain the
> problem again, There is no issue with add and update workflow graph data as
> data type is not checked when it store to registry. Therefore registry may
> have workflow graph data in both JSON and XML formats. In Angular service
> we need all data in JSON format when we retrieve one or all workflows which
> are stored in registry. Therefore we need to do XML to JSON conversion for
> the graph data which are stored in XML format before sending it to Angular
> service.
>
> I had a call with Saminda to sort out this problem, the concern with my
> previous fix is, i have added two resources to do the conversion but this
> may lead to maintenance issue in long run. Conclusion is to only add that
> DefaultValue annotation to getWorkflow("WFName") and getWorkflows();
> resources and do the conversion by checking that parameter. To select
> correct media type we send accept type as "application/json".  I will
> update my patch according to this.
>
+1
As I understand this will not be any apparent change in the REST API for
current client implementations.


> Thanks,
> Shameera.
>
>
> On Sun, Sep 8, 2013 at 9:47 PM, Saminda Wijeratne <sa...@gmail.com>wrote:
>
>> Which function in the registry api were you using?
>>
>>
>> On Sun, Sep 8, 2013 at 2:03 AM, Shameera Rathnayaka <
>> shameerainfo@gmail.com> wrote:
>>
>>> Hi Saminda,
>>>
>>> I could able to store and get graph data in JSON format without doing
>>> any modification to the code, Now the issue is when i get the all workflows
>>> i will get the XML data too which stored in registry. Is this what you
>>> addressed in your previous reply? As we are using JS client to do the
>>> request i couldn't find a place where we hit Workflow models in that path.
>>> Could you please explain it little bit.
>>>
>>> we can implement another two resources for
>>> getWorkflowGraphJSON("workflowName") and getWorkflowsInJSON();  in
>>> UserWorkflowRegistryResource. WDYS?
>>>
>>> Thanks,
>>> Shameera.
>>>
>>>
>>> On Sun, Sep 8, 2013 at 11:03 AM, Shameera Rathnayaka <
>>> shameerainfo@gmail.com> wrote:
>>>
>>>> Hi Supun,
>>>>
>>>> Yes it is possible, That is what i planed to do in first place, then
>>>> turn back to @DefaultValue annotation.
>>>>
>>>>
>>>> Thanks,
>>>> Shameera.
>>>>
>>>>
>>>> On Sun, Sep 8, 2013 at 10:32 AM, Supun Kamburugamuva <supun06@gmail.com
>>>> > wrote:
>>>>
>>>>> Is it possible to use the HTTP Content Type to determine weather it is
>>>>> XML or JSON instead of using a HTTP parameter?
>>>>>
>>>>> Supun..
>>>>>
>>>>>
>>>>> On Sun, Sep 8, 2013 at 12:48 AM, Shameera Rathnayaka <
>>>>> shameerainfo@gmail.com> wrote:
>>>>>
>>>>>> Hi Saminda and Amila,
>>>>>>
>>>>>> Thanks for quick replies, @Saminda what you mean is extend Workflow
>>>>>> object by adding another parse(Json) method to parse the JSON data right?.
>>>>>> Yes that can be done, here we need to know that incoming string is in XML
>>>>>> format of JSON format before we call relevant parse(..) method. For that we
>>>>>> can add another boolean parameter (isJSON) to the resource method and set
>>>>>> default value as false to support backward compatibility.
>>>>>>
>>>>>> eg:      public Response addWorkflow(*@DefaultValue("false")
>>>>>> @FormParam("isJSON") boolean isJSON*,
>>>>>>
>>>>>> @FormParam("workflowName") String workflowName,
>>>>>>
>>>>>> @FormParam("workflowGraphXml") String workflowGraphXml) {
>>>>>>
>>>>>> Thanks,
>>>>>> Shameera.
>>>>>>
>>>>>>
>>>>>> On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <
>>>>>> samindaw@gmail.com> wrote:
>>>>>>
>>>>>>> Well as you said there is no restriction on the format of the
>>>>>>> workflow we save in the registry. The API does not enforce a format of the
>>>>>>> string also. Only the model "Workflow" is enforced when the string
>>>>>>> (xml/json) is parsed.
>>>>>>>
>>>>>>> How about you extend the Workflow model object to support graph data
>>>>>>> in JSON format when parsing?
>>>>>>>
>>>>>>>
>>>>>>> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <
>>>>>>> shameerainfo@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi Devs,
>>>>>>>>
>>>>>>>> Currently graph data (Content of .xwf file) is being stored in XML
>>>>>>>> fromat. In GSoC master project what we have is graph data in JSON format.
>>>>>>>> Therefore we need a way to store this JSON data on registry. First i
>>>>>>>> thought to convert the json data to xml in registry rest api and store it.
>>>>>>>> But it seems we can store this in JSON fromat too. To do that what i am
>>>>>>>> going to do is, add following methods to UserWorkflowRegistry interface and
>>>>>>>> implement those methods in implementation classes. It would be great to
>>>>>>>> know your ideas about this. Please suggest if there any other way to
>>>>>>>> handle this.
>>>>>>>>
>>>>>>>>     public void addWorkflowInJSON(String workflowName, String
>>>>>>>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
>>>>>>>> RegistryException;
>>>>>>>>     public void updateWorkflowInJSON(String workflowName, String
>>>>>>>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
>>>>>>>> RegistryException;
>>>>>>>>     public String getWorkflowGraphJSON(String workflowName) throws
>>>>>>>> UserWorkflowDoesNotExistsException, RegistryException;
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Shameera.
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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/
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Supun Kamburugamuva
>>>>> Member, Apache Software Foundation; http://www.apache.org
>>>>> E-mail: supun06@gmail.com;  Mobile: +1 812 369 6762
>>>>> Blog: http://supunk.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/
>>>
>>
>>
>
>
> --
> Best Regards,
> Shameera Rathnayaka.
>
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>

Re: Store Graph data in JSON fromat.

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Saminda et al.

It seems my previous reply has mislead you guys, Let me explain the problem
again, There is no issue with add and update workflow graph data as data
type is not checked when it store to registry. Therefore registry may have
workflow graph data in both JSON and XML formats. In Angular service we
need all data in JSON format when we retrieve one or all workflows which
are stored in registry. Therefore we need to do XML to JSON conversion for
the graph data which are stored in XML format before sending it to Angular
service.

I had a call with Saminda to sort out this problem, the concern with my
previous fix is, i have added two resources to do the conversion but this
may lead to maintenance issue in long run. Conclusion is to only add that
DefaultValue annotation to getWorkflow("WFName") and getWorkflows();
resources and do the conversion by checking that parameter. To select
correct media type we send accept type as "application/json".  I will
update my patch according to this.

Thanks,
Shameera.


On Sun, Sep 8, 2013 at 9:47 PM, Saminda Wijeratne <sa...@gmail.com>wrote:

> Which function in the registry api were you using?
>
>
> On Sun, Sep 8, 2013 at 2:03 AM, Shameera Rathnayaka <
> shameerainfo@gmail.com> wrote:
>
>> Hi Saminda,
>>
>> I could able to store and get graph data in JSON format without doing any
>> modification to the code, Now the issue is when i get the all workflows i
>> will get the XML data too which stored in registry. Is this what you
>> addressed in your previous reply? As we are using JS client to do the
>> request i couldn't find a place where we hit Workflow models in that path.
>> Could you please explain it little bit.
>>
>> we can implement another two resources for
>> getWorkflowGraphJSON("workflowName") and getWorkflowsInJSON();  in
>> UserWorkflowRegistryResource. WDYS?
>>
>> Thanks,
>> Shameera.
>>
>>
>> On Sun, Sep 8, 2013 at 11:03 AM, Shameera Rathnayaka <
>> shameerainfo@gmail.com> wrote:
>>
>>> Hi Supun,
>>>
>>> Yes it is possible, That is what i planed to do in first place, then
>>> turn back to @DefaultValue annotation.
>>>
>>>
>>> Thanks,
>>> Shameera.
>>>
>>>
>>> On Sun, Sep 8, 2013 at 10:32 AM, Supun Kamburugamuva <su...@gmail.com>wrote:
>>>
>>>> Is it possible to use the HTTP Content Type to determine weather it is
>>>> XML or JSON instead of using a HTTP parameter?
>>>>
>>>> Supun..
>>>>
>>>>
>>>> On Sun, Sep 8, 2013 at 12:48 AM, Shameera Rathnayaka <
>>>> shameerainfo@gmail.com> wrote:
>>>>
>>>>> Hi Saminda and Amila,
>>>>>
>>>>> Thanks for quick replies, @Saminda what you mean is extend Workflow
>>>>> object by adding another parse(Json) method to parse the JSON data right?.
>>>>> Yes that can be done, here we need to know that incoming string is in XML
>>>>> format of JSON format before we call relevant parse(..) method. For that we
>>>>> can add another boolean parameter (isJSON) to the resource method and set
>>>>> default value as false to support backward compatibility.
>>>>>
>>>>> eg:      public Response addWorkflow(*@DefaultValue("false")
>>>>> @FormParam("isJSON") boolean isJSON*,
>>>>>
>>>>> @FormParam("workflowName") String workflowName,
>>>>>
>>>>> @FormParam("workflowGraphXml") String workflowGraphXml) {
>>>>>
>>>>> Thanks,
>>>>> Shameera.
>>>>>
>>>>>
>>>>> On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <samindaw@gmail.com
>>>>> > wrote:
>>>>>
>>>>>> Well as you said there is no restriction on the format of the
>>>>>> workflow we save in the registry. The API does not enforce a format of the
>>>>>> string also. Only the model "Workflow" is enforced when the string
>>>>>> (xml/json) is parsed.
>>>>>>
>>>>>> How about you extend the Workflow model object to support graph data
>>>>>> in JSON format when parsing?
>>>>>>
>>>>>>
>>>>>> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <
>>>>>> shameerainfo@gmail.com> wrote:
>>>>>>
>>>>>>> Hi Devs,
>>>>>>>
>>>>>>> Currently graph data (Content of .xwf file) is being stored in XML
>>>>>>> fromat. In GSoC master project what we have is graph data in JSON format.
>>>>>>> Therefore we need a way to store this JSON data on registry. First i
>>>>>>> thought to convert the json data to xml in registry rest api and store it.
>>>>>>> But it seems we can store this in JSON fromat too. To do that what i am
>>>>>>> going to do is, add following methods to UserWorkflowRegistry interface and
>>>>>>> implement those methods in implementation classes. It would be great to
>>>>>>> know your ideas about this. Please suggest if there any other way to
>>>>>>> handle this.
>>>>>>>
>>>>>>>     public void addWorkflowInJSON(String workflowName, String
>>>>>>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
>>>>>>> RegistryException;
>>>>>>>     public void updateWorkflowInJSON(String workflowName, String
>>>>>>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
>>>>>>> RegistryException;
>>>>>>>     public String getWorkflowGraphJSON(String workflowName) throws
>>>>>>> UserWorkflowDoesNotExistsException, RegistryException;
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Shameera.
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> 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/
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Supun Kamburugamuva
>>>> Member, Apache Software Foundation; http://www.apache.org
>>>> E-mail: supun06@gmail.com;  Mobile: +1 812 369 6762
>>>> Blog: http://supunk.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/
>>
>
>


-- 
Best Regards,
Shameera Rathnayaka.

email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/

Re: Store Graph data in JSON fromat.

Posted by Saminda Wijeratne <sa...@gmail.com>.
Which function in the registry api were you using?


On Sun, Sep 8, 2013 at 2:03 AM, Shameera Rathnayaka
<sh...@gmail.com>wrote:

> Hi Saminda,
>
> I could able to store and get graph data in JSON format without doing any
> modification to the code, Now the issue is when i get the all workflows i
> will get the XML data too which stored in registry. Is this what you
> addressed in your previous reply? As we are using JS client to do the
> request i couldn't find a place where we hit Workflow models in that path.
> Could you please explain it little bit.
>
> we can implement another two resources for
> getWorkflowGraphJSON("workflowName") and getWorkflowsInJSON();  in
> UserWorkflowRegistryResource. WDYS?
>
> Thanks,
> Shameera.
>
>
> On Sun, Sep 8, 2013 at 11:03 AM, Shameera Rathnayaka <
> shameerainfo@gmail.com> wrote:
>
>> Hi Supun,
>>
>> Yes it is possible, That is what i planed to do in first place, then turn
>> back to @DefaultValue annotation.
>>
>>
>> Thanks,
>> Shameera.
>>
>>
>> On Sun, Sep 8, 2013 at 10:32 AM, Supun Kamburugamuva <su...@gmail.com>wrote:
>>
>>> Is it possible to use the HTTP Content Type to determine weather it is
>>> XML or JSON instead of using a HTTP parameter?
>>>
>>> Supun..
>>>
>>>
>>> On Sun, Sep 8, 2013 at 12:48 AM, Shameera Rathnayaka <
>>> shameerainfo@gmail.com> wrote:
>>>
>>>> Hi Saminda and Amila,
>>>>
>>>> Thanks for quick replies, @Saminda what you mean is extend Workflow
>>>> object by adding another parse(Json) method to parse the JSON data right?.
>>>> Yes that can be done, here we need to know that incoming string is in XML
>>>> format of JSON format before we call relevant parse(..) method. For that we
>>>> can add another boolean parameter (isJSON) to the resource method and set
>>>> default value as false to support backward compatibility.
>>>>
>>>> eg:      public Response addWorkflow(*@DefaultValue("false")
>>>> @FormParam("isJSON") boolean isJSON*,
>>>>
>>>> @FormParam("workflowName") String workflowName,
>>>>
>>>> @FormParam("workflowGraphXml") String workflowGraphXml) {
>>>>
>>>> Thanks,
>>>> Shameera.
>>>>
>>>>
>>>> On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <sa...@gmail.com>wrote:
>>>>
>>>>> Well as you said there is no restriction on the format of the workflow
>>>>> we save in the registry. The API does not enforce a format of the string
>>>>> also. Only the model "Workflow" is enforced when the string (xml/json) is
>>>>> parsed.
>>>>>
>>>>> How about you extend the Workflow model object to support graph data
>>>>> in JSON format when parsing?
>>>>>
>>>>>
>>>>> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <
>>>>> shameerainfo@gmail.com> wrote:
>>>>>
>>>>>> Hi Devs,
>>>>>>
>>>>>> Currently graph data (Content of .xwf file) is being stored in XML
>>>>>> fromat. In GSoC master project what we have is graph data in JSON format.
>>>>>> Therefore we need a way to store this JSON data on registry. First i
>>>>>> thought to convert the json data to xml in registry rest api and store it.
>>>>>> But it seems we can store this in JSON fromat too. To do that what i am
>>>>>> going to do is, add following methods to UserWorkflowRegistry interface and
>>>>>> implement those methods in implementation classes. It would be great to
>>>>>> know your ideas about this. Please suggest if there any other way to
>>>>>> handle this.
>>>>>>
>>>>>>     public void addWorkflowInJSON(String workflowName, String
>>>>>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
>>>>>> RegistryException;
>>>>>>     public void updateWorkflowInJSON(String workflowName, String
>>>>>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
>>>>>> RegistryException;
>>>>>>     public String getWorkflowGraphJSON(String workflowName) throws
>>>>>> UserWorkflowDoesNotExistsException, RegistryException;
>>>>>>
>>>>>> Thanks,
>>>>>> Shameera.
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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/
>>>>
>>>
>>>
>>>
>>> --
>>> Supun Kamburugamuva
>>> Member, Apache Software Foundation; http://www.apache.org
>>> E-mail: supun06@gmail.com;  Mobile: +1 812 369 6762
>>> Blog: http://supunk.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: Store Graph data in JSON fromat.

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Saminda,

I could able to store and get graph data in JSON format without doing any
modification to the code, Now the issue is when i get the all workflows i
will get the XML data too which stored in registry. Is this what you
addressed in your previous reply? As we are using JS client to do the
request i couldn't find a place where we hit Workflow models in that path.
Could you please explain it little bit.

we can implement another two resources for
getWorkflowGraphJSON("workflowName") and getWorkflowsInJSON();  in
UserWorkflowRegistryResource. WDYS?

Thanks,
Shameera.


On Sun, Sep 8, 2013 at 11:03 AM, Shameera Rathnayaka <shameerainfo@gmail.com
> wrote:

> Hi Supun,
>
> Yes it is possible, That is what i planed to do in first place, then turn
> back to @DefaultValue annotation.
>
>
> Thanks,
> Shameera.
>
>
> On Sun, Sep 8, 2013 at 10:32 AM, Supun Kamburugamuva <su...@gmail.com>wrote:
>
>> Is it possible to use the HTTP Content Type to determine weather it is
>> XML or JSON instead of using a HTTP parameter?
>>
>> Supun..
>>
>>
>> On Sun, Sep 8, 2013 at 12:48 AM, Shameera Rathnayaka <
>> shameerainfo@gmail.com> wrote:
>>
>>> Hi Saminda and Amila,
>>>
>>> Thanks for quick replies, @Saminda what you mean is extend Workflow
>>> object by adding another parse(Json) method to parse the JSON data right?.
>>> Yes that can be done, here we need to know that incoming string is in XML
>>> format of JSON format before we call relevant parse(..) method. For that we
>>> can add another boolean parameter (isJSON) to the resource method and set
>>> default value as false to support backward compatibility.
>>>
>>> eg:      public Response addWorkflow(*@DefaultValue("false")
>>> @FormParam("isJSON") boolean isJSON*,
>>>
>>> @FormParam("workflowName") String workflowName,
>>>
>>> @FormParam("workflowGraphXml") String workflowGraphXml) {
>>>
>>> Thanks,
>>> Shameera.
>>>
>>>
>>> On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <sa...@gmail.com>wrote:
>>>
>>>> Well as you said there is no restriction on the format of the workflow
>>>> we save in the registry. The API does not enforce a format of the string
>>>> also. Only the model "Workflow" is enforced when the string (xml/json) is
>>>> parsed.
>>>>
>>>> How about you extend the Workflow model object to support graph data in
>>>> JSON format when parsing?
>>>>
>>>>
>>>> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <
>>>> shameerainfo@gmail.com> wrote:
>>>>
>>>>> Hi Devs,
>>>>>
>>>>> Currently graph data (Content of .xwf file) is being stored in XML
>>>>> fromat. In GSoC master project what we have is graph data in JSON format.
>>>>> Therefore we need a way to store this JSON data on registry. First i
>>>>> thought to convert the json data to xml in registry rest api and store it.
>>>>> But it seems we can store this in JSON fromat too. To do that what i am
>>>>> going to do is, add following methods to UserWorkflowRegistry interface and
>>>>> implement those methods in implementation classes. It would be great to
>>>>> know your ideas about this. Please suggest if there any other way to
>>>>> handle this.
>>>>>
>>>>>     public void addWorkflowInJSON(String workflowName, String
>>>>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
>>>>> RegistryException;
>>>>>     public void updateWorkflowInJSON(String workflowName, String
>>>>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
>>>>> RegistryException;
>>>>>     public String getWorkflowGraphJSON(String workflowName) throws
>>>>> UserWorkflowDoesNotExistsException, RegistryException;
>>>>>
>>>>> Thanks,
>>>>> Shameera.
>>>>>
>>>>>
>>>>> --
>>>>> 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/
>>>
>>
>>
>>
>> --
>> Supun Kamburugamuva
>> Member, Apache Software Foundation; http://www.apache.org
>> E-mail: supun06@gmail.com;  Mobile: +1 812 369 6762
>> Blog: http://supunk.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: Store Graph data in JSON fromat.

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Supun,

Yes it is possible, That is what i planed to do in first place, then turn
back to @DefaultValue annotation.


Thanks,
Shameera.


On Sun, Sep 8, 2013 at 10:32 AM, Supun Kamburugamuva <su...@gmail.com>wrote:

> Is it possible to use the HTTP Content Type to determine weather it is XML
> or JSON instead of using a HTTP parameter?
>
> Supun..
>
>
> On Sun, Sep 8, 2013 at 12:48 AM, Shameera Rathnayaka <
> shameerainfo@gmail.com> wrote:
>
>> Hi Saminda and Amila,
>>
>> Thanks for quick replies, @Saminda what you mean is extend Workflow
>> object by adding another parse(Json) method to parse the JSON data right?.
>> Yes that can be done, here we need to know that incoming string is in XML
>> format of JSON format before we call relevant parse(..) method. For that we
>> can add another boolean parameter (isJSON) to the resource method and set
>> default value as false to support backward compatibility.
>>
>> eg:      public Response addWorkflow(*@DefaultValue("false")
>> @FormParam("isJSON") boolean isJSON*,
>>
>> @FormParam("workflowName") String workflowName,
>>
>> @FormParam("workflowGraphXml") String workflowGraphXml) {
>>
>> Thanks,
>> Shameera.
>>
>>
>> On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <sa...@gmail.com>wrote:
>>
>>> Well as you said there is no restriction on the format of the workflow
>>> we save in the registry. The API does not enforce a format of the string
>>> also. Only the model "Workflow" is enforced when the string (xml/json) is
>>> parsed.
>>>
>>> How about you extend the Workflow model object to support graph data in
>>> JSON format when parsing?
>>>
>>>
>>> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <
>>> shameerainfo@gmail.com> wrote:
>>>
>>>> Hi Devs,
>>>>
>>>> Currently graph data (Content of .xwf file) is being stored in XML
>>>> fromat. In GSoC master project what we have is graph data in JSON format.
>>>> Therefore we need a way to store this JSON data on registry. First i
>>>> thought to convert the json data to xml in registry rest api and store it.
>>>> But it seems we can store this in JSON fromat too. To do that what i am
>>>> going to do is, add following methods to UserWorkflowRegistry interface and
>>>> implement those methods in implementation classes. It would be great to
>>>> know your ideas about this. Please suggest if there any other way to
>>>> handle this.
>>>>
>>>>     public void addWorkflowInJSON(String workflowName, String
>>>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
>>>> RegistryException;
>>>>     public void updateWorkflowInJSON(String workflowName, String
>>>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
>>>> RegistryException;
>>>>     public String getWorkflowGraphJSON(String workflowName) throws
>>>> UserWorkflowDoesNotExistsException, RegistryException;
>>>>
>>>> Thanks,
>>>> Shameera.
>>>>
>>>>
>>>> --
>>>> 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/
>>
>
>
>
> --
> Supun Kamburugamuva
> Member, Apache Software Foundation; http://www.apache.org
> E-mail: supun06@gmail.com;  Mobile: +1 812 369 6762
> Blog: http://supunk.blogspot.com
>
>


-- 
Best Regards,
Shameera Rathnayaka.

email: shameera AT apache.org , shameerainfo AT gmail.com
Blog : http://shameerarathnayaka.blogspot.com/

Re: Store Graph data in JSON fromat.

Posted by Supun Kamburugamuva <su...@gmail.com>.
Is it possible to use the HTTP Content Type to determine weather it is XML
or JSON instead of using a HTTP parameter?

Supun..


On Sun, Sep 8, 2013 at 12:48 AM, Shameera Rathnayaka <shameerainfo@gmail.com
> wrote:

> Hi Saminda and Amila,
>
> Thanks for quick replies, @Saminda what you mean is extend Workflow object
> by adding another parse(Json) method to parse the JSON data right?. Yes
> that can be done, here we need to know that incoming string is in XML
> format of JSON format before we call relevant parse(..) method. For that we
> can add another boolean parameter (isJSON) to the resource method and set
> default value as false to support backward compatibility.
>
> eg:      public Response addWorkflow(*@DefaultValue("false")
> @FormParam("isJSON") boolean isJSON*,
>
> @FormParam("workflowName") String workflowName,
>
> @FormParam("workflowGraphXml") String workflowGraphXml) {
>
> Thanks,
> Shameera.
>
>
> On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <sa...@gmail.com>wrote:
>
>> Well as you said there is no restriction on the format of the workflow we
>> save in the registry. The API does not enforce a format of the string also.
>> Only the model "Workflow" is enforced when the string (xml/json) is parsed.
>>
>> How about you extend the Workflow model object to support graph data in
>> JSON format when parsing?
>>
>>
>> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <
>> shameerainfo@gmail.com> wrote:
>>
>>> Hi Devs,
>>>
>>> Currently graph data (Content of .xwf file) is being stored in XML
>>> fromat. In GSoC master project what we have is graph data in JSON format.
>>> Therefore we need a way to store this JSON data on registry. First i
>>> thought to convert the json data to xml in registry rest api and store it.
>>> But it seems we can store this in JSON fromat too. To do that what i am
>>> going to do is, add following methods to UserWorkflowRegistry interface and
>>> implement those methods in implementation classes. It would be great to
>>> know your ideas about this. Please suggest if there any other way to
>>> handle this.
>>>
>>>     public void addWorkflowInJSON(String workflowName, String
>>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
>>> RegistryException;
>>>     public void updateWorkflowInJSON(String workflowName, String
>>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
>>> RegistryException;
>>>     public String getWorkflowGraphJSON(String workflowName) throws
>>> UserWorkflowDoesNotExistsException, RegistryException;
>>>
>>> Thanks,
>>> Shameera.
>>>
>>>
>>> --
>>> 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/
>



-- 
Supun Kamburugamuva
Member, Apache Software Foundation; http://www.apache.org
E-mail: supun06@gmail.com;  Mobile: +1 812 369 6762
Blog: http://supunk.blogspot.com

Re: Store Graph data in JSON fromat.

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Hi Saminda and Amila,

Thanks for quick replies, @Saminda what you mean is extend Workflow object
by adding another parse(Json) method to parse the JSON data right?. Yes
that can be done, here we need to know that incoming string is in XML
format of JSON format before we call relevant parse(..) method. For that we
can add another boolean parameter (isJSON) to the resource method and set
default value as false to support backward compatibility.

eg:      public Response addWorkflow(*@DefaultValue("false")
@FormParam("isJSON") boolean isJSON*,

@FormParam("workflowName") String workflowName,

@FormParam("workflowGraphXml") String workflowGraphXml) {

Thanks,
Shameera.


On Sun, Sep 8, 2013 at 12:45 AM, Saminda Wijeratne <sa...@gmail.com>wrote:

> Well as you said there is no restriction on the format of the workflow we
> save in the registry. The API does not enforce a format of the string also.
> Only the model "Workflow" is enforced when the string (xml/json) is parsed.
>
> How about you extend the Workflow model object to support graph data in
> JSON format when parsing?
>
>
> On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <
> shameerainfo@gmail.com> wrote:
>
>> Hi Devs,
>>
>> Currently graph data (Content of .xwf file) is being stored in XML
>> fromat. In GSoC master project what we have is graph data in JSON format.
>> Therefore we need a way to store this JSON data on registry. First i
>> thought to convert the json data to xml in registry rest api and store it.
>> But it seems we can store this in JSON fromat too. To do that what i am
>> going to do is, add following methods to UserWorkflowRegistry interface and
>> implement those methods in implementation classes. It would be great to
>> know your ideas about this. Please suggest if there any other way to
>> handle this.
>>
>>     public void addWorkflowInJSON(String workflowName, String
>> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
>> RegistryException;
>>     public void updateWorkflowInJSON(String workflowName, String
>> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
>> RegistryException;
>>     public String getWorkflowGraphJSON(String workflowName) throws
>> UserWorkflowDoesNotExistsException, RegistryException;
>>
>> Thanks,
>> Shameera.
>>
>>
>> --
>> 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: Store Graph data in JSON fromat.

Posted by Saminda Wijeratne <sa...@gmail.com>.
Well as you said there is no restriction on the format of the workflow we
save in the registry. The API does not enforce a format of the string also.
Only the model "Workflow" is enforced when the string (xml/json) is parsed.

How about you extend the Workflow model object to support graph data in
JSON format when parsing?


On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <shameerainfo@gmail.com
> wrote:

> Hi Devs,
>
> Currently graph data (Content of .xwf file) is being stored in XML fromat.
> In GSoC master project what we have is graph data in JSON format. Therefore
> we need a way to store this JSON data on registry. First i thought to
> convert the json data to xml in registry rest api and store it. But it
> seems we can store this in JSON fromat too. To do that what i am going to
> do is, add following methods to UserWorkflowRegistry interface and
> implement those methods in implementation classes. It would be great to
> know your ideas about this. Please suggest if there any other way to
> handle this.
>
>     public void addWorkflowInJSON(String workflowName, String
> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
> RegistryException;
>     public void updateWorkflowInJSON(String workflowName, String
> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
> RegistryException;
>     public String getWorkflowGraphJSON(String workflowName) throws
> UserWorkflowDoesNotExistsException, RegistryException;
>
> Thanks,
> Shameera.
>
>
> --
> Best Regards,
> Shameera Rathnayaka.
>
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>

Re: Store Graph data in JSON fromat.

Posted by Amila Jayasekara <th...@gmail.com>.
I believe workflow interpreter is reading .xwf file to execute workflow. So
if we change format to JSON we need to change the way workflow interpreter
works also.

Guess Saminda will be able to give more feedback on this.

Thanks
Amila


On Sat, Sep 7, 2013 at 12:58 PM, Shameera Rathnayaka <shameerainfo@gmail.com
> wrote:

> Hi Devs,
>
> Currently graph data (Content of .xwf file) is being stored in XML fromat.
> In GSoC master project what we have is graph data in JSON format. Therefore
> we need a way to store this JSON data on registry. First i thought to
> convert the json data to xml in registry rest api and store it. But it
> seems we can store this in JSON fromat too. To do that what i am going to
> do is, add following methods to UserWorkflowRegistry interface and
> implement those methods in implementation classes. It would be great to
> know your ideas about this. Please suggest if there any other way to
> handle this.
>
>     public void addWorkflowInJSON(String workflowName, String
> workflowGraphJSON) throws UserWorkflowAlreadyExistsException,
> RegistryException;
>     public void updateWorkflowInJSON(String workflowName, String
> workflowGraphJSON) throws UserWorkflowDoesNotExistsException,
> RegistryException;
>     public String getWorkflowGraphJSON(String workflowName) throws
> UserWorkflowDoesNotExistsException, RegistryException;
>
> Thanks,
> Shameera.
>
>
> --
> Best Regards,
> Shameera Rathnayaka.
>
> email: shameera AT apache.org , shameerainfo AT gmail.com
> Blog : http://shameerarathnayaka.blogspot.com/
>