You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by Raido Kuli <ra...@gmail.com> on 2010/03/01 17:55:42 UTC

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Hi.

I've done some work on PHP framework. It's basically almost complete
replica of Java version, with few exceptions. You'll find
TestWookieService.php from the package, which is a small example.

At the moment framework is not able to add participants nor get users
for widget instances.

Add participant request returns "bad request 400" and get users "404
not found". If i remove parameters from querystring then
wookie/participants asks for authorization.


There's lot of error handling and some data handling still todo, but
the main part of framework works.

Give it a try.

--
Raido

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Ross Gardler <rg...@apache.org>.
On 01/03/2010 16:55, Raido Kuli wrote:
> Hi.
>
> I've done some work on PHP framework. It's basically almost complete
> replica of Java version, with few exceptions. You'll find
> TestWookieService.php from the package, which is a small example.

Wonderful!!!

Can I ask you to create an issue and attach your contribution to it. 
There is a checkbox when uploading the file that indicates you are 
contributing this for inclusion in the project. This is an important 
part of our due diligence process.

Note, by donating this you do not assign copyright to the ASF, you 
merely licence it to the foundation so that we can release it as open 
source. If you have any questions we'd be happy to discuss them.

Once it is in the issue tracker I'll find some time to examine it and 
put it into our SVN.

> At the moment framework is not able to add participants nor get users
> for widget instances.
>
> Add participant request returns "bad request 400" and get users "404
> not found". If i remove parameters from querystring then
> wookie/participants asks for authorization.

Yes, there are some strange behaviours in the REST API. Scott made some 
changes to my code that made it work. Since you have been copying my 
implementation the chances are you also copied my errors ;-)

Ross

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Raido Kuli <ra...@gmail.com>.
I'll keep by fingers busy then :)

--
Raido

On Tue, Mar 9, 2010 at 3:36 PM, Scott Wilson
<sc...@gmail.com> wrote:
> On 9 Mar 2010, at 13:29, Raido Kuli wrote:
>
>> Hi.
>>
>> Should there be Python version of framework too ? In any other
>> programming language (ruby or something) ?
>>
>
> I think the simple answer is, the more the merrier!
>
> Python definitely, Ruby yep... hmm Objective-C? C#?
>
>> I recently took up learning Python (for simple applications) and even
>> did some framework coding for Wookie, just to get a hang of Python.
>>
>> Current version can get list of available widgets and get/create
>> widget instances and return instance object.
>
>>
>> --
>> Raido
>>
>>
>>
>> On Sun, Mar 7, 2010 at 9:14 PM, Scott Wilson
>> <sc...@gmail.com> wrote:
>>>
>>> On 7 Mar 2010, at 18:58, Raido Kuli wrote:
>>>
>>>> Hi.
>>>>
>>>> I've got deleting participants/properties working. I had some errors
>>>> with my request.
>>>>
>>>> Now I am curious why does propeties request ->
>>>>
>>>> DELETE {wookie}/properties {params: instance_params, propertyname}
>>>>
>>>> <- create new property in database, if it doesn't exist.
>>>>
>>>> So -> i create request like (from the php framework i am working on):
>>>>
>>>> $request = '?api_key='.$this->getConnection()->getApiKey();
>>>> $request .=
>>>> '&shareddatakey='.$this->getConnection()->getSharedDataKey();
>>>> $request .= '&userid='.$this->getUser()->getLoginName();
>>>> $request .= '&widgetid='.$widgetInstance->getIdentifier();
>>>> $request .= '&propertyname='.$propertyInstance->getName();
>>>>
>>>> So if, in the first request propertyname doesn't exist, Wookie returns
>>>> '404 not found' BUT creates property, with value 'NULL'. On second
>>>> request the same property is correctly deleted.
>>>>
>>>> Obviously it should not do that, just return 404.
>>>
>>> It certainly shouldn't! Can you create an issue for this in the tracker?
>>>
>>>>
>>>> --
>>>> Raido
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, Mar 4, 2010 at 9:30 AM, Raido Kuli <ra...@gmail.com> wrote:
>>>>>
>>>>> Hi!
>>>>>
>>>>> I am trying to implement DELETE for participants and properties in PHP
>>>>> framework. But request returns 401 Unauthorized.
>>>>>
>>>>> DELETE {wookie}/properties {params: instance_params, propertyname}
>>>>>
>>>>> This time widgetid param is definetly http://somewidget.com/ or does
>>>>> this one need identifier hash from Widget instance ?
>>>>>
>>>>> How could i easly debug Wookie with eclipse or something. I'm not very
>>>>> familiar with Log4j.
>>>>>
>>>>> Add/modify participants/properties work nice :)
>>>>>
>>>>> --
>>>>> Raido
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Tue, Mar 2, 2010 at 7:30 PM, Scott Wilson
>>>>> <sc...@gmail.com> wrote:
>>>>>>
>>>>>> On 2 Mar 2010, at 16:33, Ross Gardler wrote:
>>>>>>
>>>>>> On 02/03/2010 13:40, Raido Kuli wrote:
>>>>>>
>>>>>> I got it going.My problem, was for both cases, wrong widgetid
>>>>>> parameter
>>>>>> value.
>>>>>>
>>>>>> I made that mistake a few times. I think they are confusingly named.
>>>>>> There
>>>>>> are a number of "id" parameters, the use of each is not very obvious
>>>>>> and
>>>>>> I
>>>>>> didn't find the javadocs to be a great deal of help.
>>>>>>
>>>>>> This is another area I think we can improve the code a fair bit. It
>>>>>> always
>>>>>> takes new eyes like ours to uncover these kinds of issues, those
>>>>>> working
>>>>>> with the code for any length of time will have the different IDs
>>>>>> etched
>>>>>> into
>>>>>> their minds.
>>>>>>
>>>>>> Yes, it makes sense inside Wookie, but how these are exposed in the
>>>>>> representations of Widget and WidgetInstance in XML doesn't really
>>>>>> help.
>>>>>> Here's a widget:
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <widgets>
>>>>>>     <widget id="3" identifier="http://www.getwookie.org/widgets/todo"
>>>>>> width="320" height="460" version="">
>>>>>>             <title short="">Ta-Da!</title>
>>>>>>             <description>A shared to-do list widget</description>
>>>>>>
>>>>>>
>>>>>>  <icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png</icon>
>>>>>>             <author>Apache Wookie (Incubating) Team</author>
>>>>>>     </widget>
>>>>>> </widgets>
>>>>>>
>>>>>> As you can see there is:
>>>>>> widget.id = the internal id used for the widget (i.e. its database
>>>>>> key)
>>>>>> widget.identifier = the external IRI used to globally identify the
>>>>>> widget.
>>>>>> (In the code this is sometimes called the widget guid. In W3C Widgets
>>>>>> this
>>>>>> is called the widget id attribute).
>>>>>> A request for information about the widget uses widget.id, e.g.
>>>>>> GET /wookie/widgets/3
>>>>>> A request for a new widget instance uses widget identifier, e.g.
>>>>>> POST /wookie/widgetinstances
>>>>>> api_key=TEST
>>>>>> userid=test
>>>>>> shareddatakey=test
>>>>>> widgetid=http://www.getwookie.org/widgets/todo
>>>>>> Here's a widget instance:
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>
>>>>>> <widgetdata>
>>>>>>
>>>>>>
>>>>>>
>>>>>> <url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D</url>
>>>>>>   <identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</identifier>
>>>>>>     <title>Ta-Da!</title>
>>>>>>     <height>460</height>
>>>>>>     <width>320</width>
>>>>>>     <maximize>false</maximize>
>>>>>> </widgetdata>
>>>>>>
>>>>>> widgetinstance.identifier = the hash of the widget instance composite
>>>>>> key
>>>>>> (same as idkey param in widgetinstance.url)
>>>>>> So not very consistent unfortunately.
>>>>>> The representations of all objects are created by classes in the
>>>>>> org.apache.wookie.helper package - you could also extend these, for
>>>>>> example,
>>>>>> to produce alternate representations using JSON as well as XML, and to
>>>>>> tweak
>>>>>> the output to be more consistent and obvious.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Ross
>>>>>>
>>>>>>
>>>>>
>>>
>>>
>
>

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Scott Wilson <sc...@gmail.com>.
On 9 Mar 2010, at 13:29, Raido Kuli wrote:

> Hi.
>
> Should there be Python version of framework too ? In any other
> programming language (ruby or something) ?
>

I think the simple answer is, the more the merrier!

Python definitely, Ruby yep... hmm Objective-C? C#?

> I recently took up learning Python (for simple applications) and even
> did some framework coding for Wookie, just to get a hang of Python.
>
> Current version can get list of available widgets and get/create
> widget instances and return instance object.

>
> --
> Raido
>
>
>
> On Sun, Mar 7, 2010 at 9:14 PM, Scott Wilson
> <sc...@gmail.com> wrote:
>>
>> On 7 Mar 2010, at 18:58, Raido Kuli wrote:
>>
>>> Hi.
>>>
>>> I've got deleting participants/properties working. I had some errors
>>> with my request.
>>>
>>> Now I am curious why does propeties request ->
>>>
>>> DELETE {wookie}/properties {params: instance_params, propertyname}
>>>
>>> <- create new property in database, if it doesn't exist.
>>>
>>> So -> i create request like (from the php framework i am working  
>>> on):
>>>
>>> $request = '?api_key='.$this->getConnection()->getApiKey();
>>> $request .= '&shareddatakey='.$this->getConnection()- 
>>> >getSharedDataKey();
>>> $request .= '&userid='.$this->getUser()->getLoginName();
>>> $request .= '&widgetid='.$widgetInstance->getIdentifier();
>>> $request .= '&propertyname='.$propertyInstance->getName();
>>>
>>> So if, in the first request propertyname doesn't exist, Wookie  
>>> returns
>>> '404 not found' BUT creates property, with value 'NULL'. On second
>>> request the same property is correctly deleted.
>>>
>>> Obviously it should not do that, just return 404.
>>
>> It certainly shouldn't! Can you create an issue for this in the  
>> tracker?
>>
>>>
>>> --
>>> Raido
>>>
>>>
>>>
>>>
>>> On Thu, Mar 4, 2010 at 9:30 AM, Raido Kuli <ra...@gmail.com>  
>>> wrote:
>>>>
>>>> Hi!
>>>>
>>>> I am trying to implement DELETE for participants and properties  
>>>> in PHP
>>>> framework. But request returns 401 Unauthorized.
>>>>
>>>> DELETE {wookie}/properties {params: instance_params, propertyname}
>>>>
>>>> This time widgetid param is definetly http://somewidget.com/ or  
>>>> does
>>>> this one need identifier hash from Widget instance ?
>>>>
>>>> How could i easly debug Wookie with eclipse or something. I'm not  
>>>> very
>>>> familiar with Log4j.
>>>>
>>>> Add/modify participants/properties work nice :)
>>>>
>>>> --
>>>> Raido
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Mar 2, 2010 at 7:30 PM, Scott Wilson
>>>> <sc...@gmail.com> wrote:
>>>>>
>>>>> On 2 Mar 2010, at 16:33, Ross Gardler wrote:
>>>>>
>>>>> On 02/03/2010 13:40, Raido Kuli wrote:
>>>>>
>>>>> I got it going.My problem, was for both cases, wrong widgetid  
>>>>> parameter
>>>>> value.
>>>>>
>>>>> I made that mistake a few times. I think they are confusingly  
>>>>> named.
>>>>> There
>>>>> are a number of "id" parameters, the use of each is not very  
>>>>> obvious and
>>>>> I
>>>>> didn't find the javadocs to be a great deal of help.
>>>>>
>>>>> This is another area I think we can improve the code a fair bit.  
>>>>> It
>>>>> always
>>>>> takes new eyes like ours to uncover these kinds of issues, those  
>>>>> working
>>>>> with the code for any length of time will have the different IDs  
>>>>> etched
>>>>> into
>>>>> their minds.
>>>>>
>>>>> Yes, it makes sense inside Wookie, but how these are exposed in  
>>>>> the
>>>>> representations of Widget and WidgetInstance in XML doesn't  
>>>>> really help.
>>>>> Here's a widget:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <widgets>
>>>>>      <widget id="3" identifier="http://www.getwookie.org/widgets/todo 
>>>>> "
>>>>> width="320" height="460" version="">
>>>>>              <title short="">Ta-Da!</title>
>>>>>              <description>A shared to-do list widget</description>
>>>>>
>>>>>  <icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png 
>>>>> </icon>
>>>>>              <author>Apache Wookie (Incubating) Team</author>
>>>>>      </widget>
>>>>> </widgets>
>>>>>
>>>>> As you can see there is:
>>>>> widget.id = the internal id used for the widget (i.e. its  
>>>>> database key)
>>>>> widget.identifier = the external IRI used to globally identify the
>>>>> widget.
>>>>> (In the code this is sometimes called the widget guid. In W3C  
>>>>> Widgets
>>>>> this
>>>>> is called the widget id attribute).
>>>>> A request for information about the widget uses widget.id, e.g.
>>>>> GET /wookie/widgets/3
>>>>> A request for a new widget instance uses widget identifier, e.g.
>>>>> POST /wookie/widgetinstances
>>>>> api_key=TEST
>>>>> userid=test
>>>>> shareddatakey=test
>>>>> widgetid=http://www.getwookie.org/widgets/todo
>>>>> Here's a widget instance:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>
>>>>> <widgetdata>
>>>>>
>>>>>
>>>>> <url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D 
>>>>> </url>
>>>>>    <identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</identifier>
>>>>>      <title>Ta-Da!</title>
>>>>>      <height>460</height>
>>>>>      <width>320</width>
>>>>>      <maximize>false</maximize>
>>>>> </widgetdata>
>>>>>
>>>>> widgetinstance.identifier = the hash of the widget instance  
>>>>> composite
>>>>> key
>>>>> (same as idkey param in widgetinstance.url)
>>>>> So not very consistent unfortunately.
>>>>> The representations of all objects are created by classes in the
>>>>> org.apache.wookie.helper package - you could also extend these,  
>>>>> for
>>>>> example,
>>>>> to produce alternate representations using JSON as well as XML,  
>>>>> and to
>>>>> tweak
>>>>> the output to be more consistent and obvious.
>>>>>
>>>>>
>>>>>
>>>>> Ross
>>>>>
>>>>>
>>>>
>>
>>


Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Raido Kuli <ra...@gmail.com>.
Hi.

Should there be Python version of framework too ? In any other
programming language (ruby or something) ?

I recently took up learning Python (for simple applications) and even
did some framework coding for Wookie, just to get a hang of Python.

Current version can get list of available widgets and get/create
widget instances and return instance object.

--
Raido



On Sun, Mar 7, 2010 at 9:14 PM, Scott Wilson
<sc...@gmail.com> wrote:
>
> On 7 Mar 2010, at 18:58, Raido Kuli wrote:
>
>> Hi.
>>
>> I've got deleting participants/properties working. I had some errors
>> with my request.
>>
>> Now I am curious why does propeties request ->
>>
>> DELETE {wookie}/properties {params: instance_params, propertyname}
>>
>> <- create new property in database, if it doesn't exist.
>>
>> So -> i create request like (from the php framework i am working on):
>>
>> $request = '?api_key='.$this->getConnection()->getApiKey();
>> $request .= '&shareddatakey='.$this->getConnection()->getSharedDataKey();
>> $request .= '&userid='.$this->getUser()->getLoginName();
>> $request .= '&widgetid='.$widgetInstance->getIdentifier();
>> $request .= '&propertyname='.$propertyInstance->getName();
>>
>> So if, in the first request propertyname doesn't exist, Wookie returns
>> '404 not found' BUT creates property, with value 'NULL'. On second
>> request the same property is correctly deleted.
>>
>> Obviously it should not do that, just return 404.
>
> It certainly shouldn't! Can you create an issue for this in the tracker?
>
>>
>> --
>> Raido
>>
>>
>>
>>
>> On Thu, Mar 4, 2010 at 9:30 AM, Raido Kuli <ra...@gmail.com> wrote:
>>>
>>> Hi!
>>>
>>> I am trying to implement DELETE for participants and properties in PHP
>>> framework. But request returns 401 Unauthorized.
>>>
>>> DELETE {wookie}/properties {params: instance_params, propertyname}
>>>
>>> This time widgetid param is definetly http://somewidget.com/ or does
>>> this one need identifier hash from Widget instance ?
>>>
>>> How could i easly debug Wookie with eclipse or something. I'm not very
>>> familiar with Log4j.
>>>
>>> Add/modify participants/properties work nice :)
>>>
>>> --
>>> Raido
>>>
>>>
>>>
>>>
>>> On Tue, Mar 2, 2010 at 7:30 PM, Scott Wilson
>>> <sc...@gmail.com> wrote:
>>>>
>>>> On 2 Mar 2010, at 16:33, Ross Gardler wrote:
>>>>
>>>> On 02/03/2010 13:40, Raido Kuli wrote:
>>>>
>>>> I got it going.My problem, was for both cases, wrong widgetid parameter
>>>> value.
>>>>
>>>> I made that mistake a few times. I think they are confusingly named.
>>>> There
>>>> are a number of "id" parameters, the use of each is not very obvious and
>>>> I
>>>> didn't find the javadocs to be a great deal of help.
>>>>
>>>> This is another area I think we can improve the code a fair bit. It
>>>> always
>>>> takes new eyes like ours to uncover these kinds of issues, those working
>>>> with the code for any length of time will have the different IDs etched
>>>> into
>>>> their minds.
>>>>
>>>> Yes, it makes sense inside Wookie, but how these are exposed in the
>>>> representations of Widget and WidgetInstance in XML doesn't really help.
>>>> Here's a widget:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>> <widgets>
>>>>      <widget id="3" identifier="http://www.getwookie.org/widgets/todo"
>>>> width="320" height="460" version="">
>>>>              <title short="">Ta-Da!</title>
>>>>              <description>A shared to-do list widget</description>
>>>>
>>>>  <icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png</icon>
>>>>              <author>Apache Wookie (Incubating) Team</author>
>>>>      </widget>
>>>> </widgets>
>>>>
>>>> As you can see there is:
>>>> widget.id = the internal id used for the widget (i.e. its database key)
>>>> widget.identifier = the external IRI used to globally identify the
>>>> widget.
>>>> (In the code this is sometimes called the widget guid. In W3C Widgets
>>>> this
>>>> is called the widget id attribute).
>>>> A request for information about the widget uses widget.id, e.g.
>>>> GET /wookie/widgets/3
>>>> A request for a new widget instance uses widget identifier, e.g.
>>>> POST /wookie/widgetinstances
>>>> api_key=TEST
>>>> userid=test
>>>> shareddatakey=test
>>>> widgetid=http://www.getwookie.org/widgets/todo
>>>> Here's a widget instance:
>>>>
>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>
>>>> <widgetdata>
>>>>
>>>>
>>>> <url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D</url>
>>>>    <identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</identifier>
>>>>      <title>Ta-Da!</title>
>>>>      <height>460</height>
>>>>      <width>320</width>
>>>>      <maximize>false</maximize>
>>>> </widgetdata>
>>>>
>>>> widgetinstance.identifier = the hash of the widget instance composite
>>>> key
>>>> (same as idkey param in widgetinstance.url)
>>>> So not very consistent unfortunately.
>>>> The representations of all objects are created by classes in the
>>>> org.apache.wookie.helper package - you could also extend these, for
>>>> example,
>>>> to produce alternate representations using JSON as well as XML, and to
>>>> tweak
>>>> the output to be more consistent and obvious.
>>>>
>>>>
>>>>
>>>> Ross
>>>>
>>>>
>>>
>
>

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Scott Wilson <sc...@gmail.com>.
On 7 Mar 2010, at 18:58, Raido Kuli wrote:

> Hi.
>
> I've got deleting participants/properties working. I had some errors
> with my request.
>
> Now I am curious why does propeties request ->
>
> DELETE {wookie}/properties {params: instance_params, propertyname}
>
> <- create new property in database, if it doesn't exist.
>
> So -> i create request like (from the php framework i am working on):
>
> $request = '?api_key='.$this->getConnection()->getApiKey();
> $request .= '&shareddatakey='.$this->getConnection()- 
> >getSharedDataKey();
> $request .= '&userid='.$this->getUser()->getLoginName();
> $request .= '&widgetid='.$widgetInstance->getIdentifier();
> $request .= '&propertyname='.$propertyInstance->getName();
>
> So if, in the first request propertyname doesn't exist, Wookie returns
> '404 not found' BUT creates property, with value 'NULL'. On second
> request the same property is correctly deleted.
>
> Obviously it should not do that, just return 404.

It certainly shouldn't! Can you create an issue for this in the tracker?

>
> --
> Raido
>
>
>
>
> On Thu, Mar 4, 2010 at 9:30 AM, Raido Kuli <ra...@gmail.com> wrote:
>> Hi!
>>
>> I am trying to implement DELETE for participants and properties in  
>> PHP
>> framework. But request returns 401 Unauthorized.
>>
>> DELETE {wookie}/properties {params: instance_params, propertyname}
>>
>> This time widgetid param is definetly http://somewidget.com/ or does
>> this one need identifier hash from Widget instance ?
>>
>> How could i easly debug Wookie with eclipse or something. I'm not  
>> very
>> familiar with Log4j.
>>
>> Add/modify participants/properties work nice :)
>>
>> --
>> Raido
>>
>>
>>
>>
>> On Tue, Mar 2, 2010 at 7:30 PM, Scott Wilson
>> <sc...@gmail.com> wrote:
>>> On 2 Mar 2010, at 16:33, Ross Gardler wrote:
>>>
>>> On 02/03/2010 13:40, Raido Kuli wrote:
>>>
>>> I got it going.My problem, was for both cases, wrong widgetid  
>>> parameter
>>> value.
>>>
>>> I made that mistake a few times. I think they are confusingly  
>>> named. There
>>> are a number of "id" parameters, the use of each is not very  
>>> obvious and I
>>> didn't find the javadocs to be a great deal of help.
>>>
>>> This is another area I think we can improve the code a fair bit.  
>>> It always
>>> takes new eyes like ours to uncover these kinds of issues, those  
>>> working
>>> with the code for any length of time will have the different IDs  
>>> etched into
>>> their minds.
>>>
>>> Yes, it makes sense inside Wookie, but how these are exposed in the
>>> representations of Widget and WidgetInstance in XML doesn't really  
>>> help.
>>> Here's a widget:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <widgets>
>>>       <widget id="3" identifier="http://www.getwookie.org/widgets/todo 
>>> "
>>> width="320" height="460" version="">
>>>               <title short="">Ta-Da!</title>
>>>               <description>A shared to-do list widget</description>
>>>               <icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png 
>>> </icon>
>>>               <author>Apache Wookie (Incubating) Team</author>
>>>       </widget>
>>> </widgets>
>>>
>>> As you can see there is:
>>> widget.id = the internal id used for the widget (i.e. its database  
>>> key)
>>> widget.identifier = the external IRI used to globally identify the  
>>> widget.
>>> (In the code this is sometimes called the widget guid. In W3C  
>>> Widgets this
>>> is called the widget id attribute).
>>> A request for information about the widget uses widget.id, e.g.
>>> GET /wookie/widgets/3
>>> A request for a new widget instance uses widget identifier, e.g.
>>> POST /wookie/widgetinstances
>>> api_key=TEST
>>> userid=test
>>> shareddatakey=test
>>> widgetid=http://www.getwookie.org/widgets/todo
>>> Here's a widget instance:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>>
>>> <widgetdata>
>>>
>>> <url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D 
>>> </url>    <identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</ 
>>> identifier>
>>>       <title>Ta-Da!</title>
>>>       <height>460</height>
>>>       <width>320</width>
>>>       <maximize>false</maximize>
>>> </widgetdata>
>>>
>>> widgetinstance.identifier = the hash of the widget instance  
>>> composite key
>>> (same as idkey param in widgetinstance.url)
>>> So not very consistent unfortunately.
>>> The representations of all objects are created by classes in the
>>> org.apache.wookie.helper package - you could also extend these,  
>>> for example,
>>> to produce alternate representations using JSON as well as XML,  
>>> and to tweak
>>> the output to be more consistent and obvious.
>>>
>>>
>>>
>>> Ross
>>>
>>>
>>


Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Raido Kuli <ra...@gmail.com>.
Hi.

I've got deleting participants/properties working. I had some errors
with my request.

Now I am curious why does propeties request ->

DELETE {wookie}/properties {params: instance_params, propertyname}

<- create new property in database, if it doesn't exist.

So -> i create request like (from the php framework i am working on):

$request = '?api_key='.$this->getConnection()->getApiKey();
$request .= '&shareddatakey='.$this->getConnection()->getSharedDataKey();
$request .= '&userid='.$this->getUser()->getLoginName();
$request .= '&widgetid='.$widgetInstance->getIdentifier();
$request .= '&propertyname='.$propertyInstance->getName();

So if, in the first request propertyname doesn't exist, Wookie returns
'404 not found' BUT creates property, with value 'NULL'. On second
request the same property is correctly deleted.

Obviously it should not do that, just return 404.

--
Raido




On Thu, Mar 4, 2010 at 9:30 AM, Raido Kuli <ra...@gmail.com> wrote:
> Hi!
>
> I am trying to implement DELETE for participants and properties in PHP
> framework. But request returns 401 Unauthorized.
>
> DELETE {wookie}/properties {params: instance_params, propertyname}
>
> This time widgetid param is definetly http://somewidget.com/ or does
> this one need identifier hash from Widget instance ?
>
> How could i easly debug Wookie with eclipse or something. I'm not very
> familiar with Log4j.
>
> Add/modify participants/properties work nice :)
>
> --
> Raido
>
>
>
>
> On Tue, Mar 2, 2010 at 7:30 PM, Scott Wilson
> <sc...@gmail.com> wrote:
>> On 2 Mar 2010, at 16:33, Ross Gardler wrote:
>>
>> On 02/03/2010 13:40, Raido Kuli wrote:
>>
>> I got it going.My problem, was for both cases, wrong widgetid parameter
>> value.
>>
>> I made that mistake a few times. I think they are confusingly named. There
>> are a number of "id" parameters, the use of each is not very obvious and I
>> didn't find the javadocs to be a great deal of help.
>>
>> This is another area I think we can improve the code a fair bit. It always
>> takes new eyes like ours to uncover these kinds of issues, those working
>> with the code for any length of time will have the different IDs etched into
>> their minds.
>>
>> Yes, it makes sense inside Wookie, but how these are exposed in the
>> representations of Widget and WidgetInstance in XML doesn't really help.
>> Here's a widget:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <widgets>
>>       <widget id="3" identifier="http://www.getwookie.org/widgets/todo"
>> width="320" height="460" version="">
>>               <title short="">Ta-Da!</title>
>>               <description>A shared to-do list widget</description>
>>               <icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png</icon>
>>               <author>Apache Wookie (Incubating) Team</author>
>>       </widget>
>> </widgets>
>>
>> As you can see there is:
>> widget.id = the internal id used for the widget (i.e. its database key)
>> widget.identifier = the external IRI used to globally identify the widget.
>> (In the code this is sometimes called the widget guid. In W3C Widgets this
>> is called the widget id attribute).
>> A request for information about the widget uses widget.id, e.g.
>> GET /wookie/widgets/3
>> A request for a new widget instance uses widget identifier, e.g.
>> POST /wookie/widgetinstances
>> api_key=TEST
>> userid=test
>> shareddatakey=test
>> widgetid=http://www.getwookie.org/widgets/todo
>> Here's a widget instance:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <widgetdata>
>>
>> <url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D</url>    <identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</identifier>
>>       <title>Ta-Da!</title>
>>       <height>460</height>
>>       <width>320</width>
>>       <maximize>false</maximize>
>> </widgetdata>
>>
>> widgetinstance.identifier = the hash of the widget instance composite key
>> (same as idkey param in widgetinstance.url)
>> So not very consistent unfortunately.
>> The representations of all objects are created by classes in the
>> org.apache.wookie.helper package - you could also extend these, for example,
>> to produce alternate representations using JSON as well as XML, and to tweak
>> the output to be more consistent and obvious.
>>
>>
>>
>> Ross
>>
>>
>

Debugging Wookie(was Re: Framework code for plugins)

Posted by Ross Gardler <rg...@apache.org>.
On 04/03/2010 07:30, Raido Kuli wrote:
> How could i easly debug Wookie with eclipse or something. I'm not very
> familiar with Log4j.

The incantation to run Wookie in debug mode is on 
http://cwiki.apache.org/confluence/display/WOOKIE/Downloading+and+Installing+Wookie

I've added the following notes to that section (may not have updated on 
the public site by the time you read this).

Once Wookie is running in debug mode you need to connect to it using 
your debugger. For example, in  Eclipse you would:

Run -> Debug Configurations...

Select "Remote Java Application"

Click "New Launch Configuration"

Set as follows:

Name: Wookie Debug (Localhost)
Project: Click "Browse" and select your Wookie project
PORT: 8001

Now click "Debug.." (note you *must be running Wookie first).

You can now set breakpoints etc. as if you were running from within Eclipse.

For more on remote debugging with Eclipse see 
http://www.eclipsezone.com/eclipse/forums/t53459.html

Note, you can set up a run configuration to be able to run Wookie from 
the UI of Eclipse, but I'll leave that for you to work out as I use the 
command line.

Ross

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Raido Kuli <ra...@gmail.com>.
Hi!

I am trying to implement DELETE for participants and properties in PHP
framework. But request returns 401 Unauthorized.

DELETE {wookie}/properties {params: instance_params, propertyname}

This time widgetid param is definetly http://somewidget.com/ or does
this one need identifier hash from Widget instance ?

How could i easly debug Wookie with eclipse or something. I'm not very
familiar with Log4j.

Add/modify participants/properties work nice :)

--
Raido




On Tue, Mar 2, 2010 at 7:30 PM, Scott Wilson
<sc...@gmail.com> wrote:
> On 2 Mar 2010, at 16:33, Ross Gardler wrote:
>
> On 02/03/2010 13:40, Raido Kuli wrote:
>
> I got it going.My problem, was for both cases, wrong widgetid parameter
> value.
>
> I made that mistake a few times. I think they are confusingly named. There
> are a number of "id" parameters, the use of each is not very obvious and I
> didn't find the javadocs to be a great deal of help.
>
> This is another area I think we can improve the code a fair bit. It always
> takes new eyes like ours to uncover these kinds of issues, those working
> with the code for any length of time will have the different IDs etched into
> their minds.
>
> Yes, it makes sense inside Wookie, but how these are exposed in the
> representations of Widget and WidgetInstance in XML doesn't really help.
> Here's a widget:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <widgets>
> 	<widget id="3" identifier="http://www.getwookie.org/widgets/todo"
> width="320" height="460" version="">
> 		<title short="">Ta-Da!</title>
> 		<description>A shared to-do list widget</description>
> 		<icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png</icon>
> 		<author>Apache Wookie (Incubating) Team</author>
> 	</widget>
> </widgets>
>
> As you can see there is:
> widget.id = the internal id used for the widget (i.e. its database key)
> widget.identifier = the external IRI used to globally identify the widget.
> (In the code this is sometimes called the widget guid. In W3C Widgets this
> is called the widget id attribute).
> A request for information about the widget uses widget.id, e.g.
> GET /wookie/widgets/3
> A request for a new widget instance uses widget identifier, e.g.
> POST /wookie/widgetinstances
> api_key=TEST
> userid=test
> shareddatakey=test
> widgetid=http://www.getwookie.org/widgets/todo
> Here's a widget instance:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <widgetdata>	
>
> <url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D</url>	<identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</identifier>
> 	<title>Ta-Da!</title>
> 	<height>460</height>
> 	<width>320</width>
> 	<maximize>false</maximize>
> </widgetdata>
>
> widgetinstance.identifier = the hash of the widget instance composite key
> (same as idkey param in widgetinstance.url)
> So not very consistent unfortunately.
> The representations of all objects are created by classes in the
> org.apache.wookie.helper package - you could also extend these, for example,
> to produce alternate representations using JSON as well as XML, and to tweak
> the output to be more consistent and obvious.
>
>
>
> Ross
>
>

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Scott Wilson <sc...@gmail.com>.
On 2 Mar 2010, at 16:33, Ross Gardler wrote:

> On 02/03/2010 13:40, Raido Kuli wrote:
>> I got it going.My problem, was for both cases, wrong widgetid  
>> parameter value.
>
> I made that mistake a few times. I think they are confusingly named.  
> There are a number of "id" parameters, the use of each is not very  
> obvious and I didn't find the javadocs to be a great deal of help.
>
> This is another area I think we can improve the code a fair bit. It  
> always takes new eyes like ours to uncover these kinds of issues,  
> those working with the code for any length of time will have the  
> different IDs etched into their minds.

Yes, it makes sense inside Wookie, but how these are exposed in the  
representations of Widget and WidgetInstance in XML doesn't really help.

Here's a widget:

<?xml version="1.0" encoding="UTF-8"?>
<widgets>
	<widget id="3" identifier="http://www.getwookie.org/widgets/todo"  
width="320" height="460" version="">
		<title short="">Ta-Da!</title>
		<description>A shared to-do list widget</description>
		<icon>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/icon.png 
</icon>
		<author>Apache Wookie (Incubating) Team</author>
	</widget>
</widgets>

As you can see there is:

widget.id = the internal id used for the widget (i.e. its database key)
widget.identifier = the external IRI used to globally identify the  
widget. (In the code this is sometimes called the widget guid. In W3C  
Widgets this is called the widget id attribute).

A request for information about the widget uses widget.id, e.g.

GET /wookie/widgets/3

A request for a new widget instance uses widget identifier, e.g.

POST /wookie/widgetinstances
	api_key=TEST
	userid=test
	shareddatakey=test
	widgetid=http://www.getwookie.org/widgets/todo

Here's a widget instance:
<?xml version="1.0" encoding="UTF-8"?>
<widgetdata>	
<url>http://localhost:8080/wookie/wservices/www.getwookie.org/widgets/todo/index.html?idkey=ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.&amp;proxy=http://localhost:8080/wookie/proxy&amp;st=wookie%3A89wrKZFnvFSyAOQbsc%2B7JSYgexSEgUxKBGCajZffBt1zGQchTpFpoyLga7wcN6agQzTXiz8JoE4RDciuBPFyG2%2FPXjk%2BC7Xdgeps2btrVPpZ4%2FvrGLuYdhQ1GXsQ7680QaKE6WNXs2eMYaRfm7PZVZxU9otmA%2BR%2BE1Y5BpnF3Pg0N6fB1PUmIfVPO4281uE23r8kgw%3D%3D 
</url>	<identifier>ELrI91u2Oi.sl.A1Yt9NqOBDkbfoB4.eq.</identifier>
	<title>Ta-Da!</title>
	<height>460</height>
	<width>320</width>
	<maximize>false</maximize>
</widgetdata>

widgetinstance.identifier = the hash of the widget instance composite  
key (same as idkey param in widgetinstance.url)

So not very consistent unfortunately.

The representations of all objects are created by classes in the  
org.apache.wookie.helper package - you could also extend these, for  
example, to produce alternate representations using JSON as well as  
XML, and to tweak the output to be more consistent and obvious.



>
> Ross


Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Ross Gardler <rg...@apache.org>.
On 02/03/2010 13:40, Raido Kuli wrote:
> I got it going.My problem, was for both cases, wrong widgetid parameter value.

I made that mistake a few times. I think they are confusingly named. 
There are a number of "id" parameters, the use of each is not very 
obvious and I didn't find the javadocs to be a great deal of help.

This is another area I think we can improve the code a fair bit. It 
always takes new eyes like ours to uncover these kinds of issues, those 
working with the code for any length of time will have the different IDs 
etched into their minds.

Ross

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Raido Kuli <ra...@gmail.com>.
I got it going.My problem, was for both cases, wrong widgetid parameter value.

Re: Framework code for plugins (was Re: Wookie Wordpress plugin fails)

Posted by Scott Wilson <sc...@gmail.com>.
On 1 Mar 2010, at 16:55, Raido Kuli wrote:

> Hi.
>
> I've done some work on PHP framework. It's basically almost complete
> replica of Java version, with few exceptions. You'll find
> TestWookieService.php from the package, which is a small example.

Cool!

> At the moment framework is not able to add participants nor get users
> for widget instances.
>
> Add participant request returns "bad request 400"

I think for this one the parameters are being added to the request URL  
(but missing the "?") whereas in the Java version they are encoded  
into a data: object and written to the POST request body. I suggest  
either adding the "?" or creating a post data builder. (Or take a look  
at the latest update of the Java code - I fixed some problems last  
night)

> and get users "404
> not found". If i remove parameters from querystring then
> wookie/participants asks for authorization.
>
> There's lot of error handling and some data handling still todo, but
> the main part of framework works.
>
> Give it a try.
>
> --
> Raido
> <php_framework20100301.zip>