You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ace.apache.org by Elmar Zeeb <el...@pipesbox.de> on 2013/08/06 13:19:46 UTC
Client REST API
Hi to all,
i'm looking into apache ace to check if i can use it as backend for a
web based market to install software extensions on an osgi based
application. In this use case i can't use the vaadin based ui but
started to implement a java based client for the client REST API.
I'm aware of the amdatu ace client, but i wanted to implement a client
on my own to understand the api and apache ace. Currently i'm able to
create, modify and delete different client resources (artifact, feature,
distribution and target) but have problems with associations. I have
looked at the client rest api docu on ace.apache.org and at
https://issues.apache.org/jira/browse/ACE-151 to get a better
understanding of associations filters and queries.
I don't understand how to set the leftEndpoint and rightEndpoint
attributes of associations. As written on the web site these attributes
are LDAP filters. Does this mean that i have to parse the LDAP filter on
the client side to check which resources are associated? Is there a way
to let ace do the filtering and return resource ids? I'm aware of the
ace/clients/tmp/9876/artifact2feature?left=&right=query. Is there
something like
ace/clients/tmp/9876/artifact2feature/12345/leftResourceIdsto query all
left resource ids of an association?
The vaadin UI uses attribute based LDAP filters to create associations.
I would like to have static associations based on resource ids - so i
use LDAP filters like "(id=[resource id])" to specify endpoints. The
vaadin ui can't display these associations. ACE-151 mentions that there
are no checks for LDAP filters so the filter may not work.
So my question is how to specify association endpoints and how to query
resource ids of associates resources with the client REST API?
Regards,
Elmar
Re: Client REST API
Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Wilfried,
On Aug 6, 2013, at 17:58 , Sibla Wilfried <Wi...@bosch-si.com> wrote:
> I also started as propose by you.
>
> But unfortunately I started with a copy of the Worspace class because I cannot use the authentication against the OSGi UserAdmin.
> But currently I'm not very happy with this solution.
>
> What do you think about having the Workspace independent from the any UserAdmin users and only using the session ID?
So you're basically saying you don't want any authentication?
The workspace itself does not use UserAdmin. If you look at the RESTClientServlet, it has a "createWorkspace" method that has a plug-able authentication mechanism that you can use if you don't want to rely on the default mechanism. I suggest you plug-in your own mechanism there that returns an implementation of User you made yourself.
> In my case it could be a solution to extend the Workspace and overriding the login method (using a single technical user within).
I think what I suggest above is a bit cleaner than extending the Workspace.
> I think I could provide my slightly changed Wokspace implementation as a proposal.
> I also added some gogo commands to it (like you did in June). But still missing some commands for evaluating and manipulating the StatefulTarget :-)
Did you look at some of the work that Bram did recently (on top of the initial set of commands I came up with)? That already has some commands (implemented in the Workspace) for StatefulTargets.
Greetings, Marcel
AW: Client REST API
Posted by Sibla Wilfried <Wi...@bosch-si.com>.
Hi Marcel, Hi Elmar
I also started as propose by you.
But unfortunately I started with a copy of the Worspace class because I cannot use the authentication against the OSGi UserAdmin.
But currently I'm not very happy with this solution.
What do you think about having the Workspace independent from the any UserAdmin users and only using the session ID?
In my case it could be a solution to extend the Workspace and overriding the login method (using a single technical user within).
I think I could provide my slightly changed Wokspace implementation as a proposal.
I also added some gogo commands to it (like you did in June). But still missing some commands for evaluating and manipulating the StatefulTarget :-)
Thx & Greetings
Wilfried
-----Ursprüngliche Nachricht-----
Von: Marcel Offermans [mailto:marcel.offermans@luminis.nl]
Gesendet: Dienstag, 6. August 2013 14:37
An: users@ace.apache.org
Betreff: Re: Client REST API
Hello Elmar,
On Aug 6, 2013, at 13:19 , Elmar Zeeb <el...@pipesbox.de> wrote:
> i'm looking into apache ace to check if i can use it as backend for a web based market to install software extensions on an osgi based application. In this use case i can't use the vaadin based ui but started to implement a java based client for the client REST API.
Underneath the Vaadin, REST and (very recently) GoGo client API's lies the same Java Client API. In other words, that's a good place to start with your own client. In this case, the "Workspace" class that is an abstraction on top of that (part of the REST client) can be used to start.
> I'm aware of the amdatu ace client, but i wanted to implement a client on my own to understand the api and apache ace. Currently i'm able to create, modify and delete different client resources (artifact, feature, distribution and target) but have problems with associations. I have looked at the client rest api docu on ace.apache.org and at https://issues.apache.org/jira/browse/ACE-151 to get a better understanding of associations filters and queries.
Ok.
> I don't understand how to set the leftEndpoint and rightEndpoint attributes of associations. As written on the web site these attributes are LDAP filters. Does this mean that i have to parse the LDAP filter on the client side to check which resources are associated?
Yes, they are LDAP filters.
No you don't need to parse them yourself, that is something the associations will do for you. Just provide the filter condition and it will be evaluated against objects on the left or right hand side of the association.
> Is there a way to let ace do the filtering and return resource ids? I'm aware of the ace/clients/tmp/9876/artifact2feature?left=&right=query. Is there something like ace/clients/tmp/9876/artifact2feature/12345/leftResourceIdsto query all left resource ids of an association?
If you create an association, you can set the left and right hand filters yourself.
> The vaadin UI uses attribute based LDAP filters to create associations. I would like to have static associations based on resource ids - so i use LDAP filters like "(id=[resource id])" to specify endpoints.
Take a look at the Workspace.cas() method (a generic way to create an association) where you can do something like:
ws.cas("distribution2target", "(name=foo)", "(id=bar)");
Optional arguments to specify the cardinality can be used to force ACE to use a 1:1 (or 1:N, N:1 or N:N) cardinality.
> The vaadin ui can't display these associations.
Actually, if you click on some object, it will always highlight everything that is associated, even if you do it via these programmatically created associations.
> ACE-151 mentions that there are no checks for LDAP filters so the filter may not work.
>
> So my question is how to specify association endpoints and how to query resource ids of associates resources with the client REST API?
My advice is to use the Java API. If you have an Assocation object, you can simply ask it to getLeft() or getRight() and you will get a list of all associated objects on either side.
Greetings, Marcel
Re: Client REST API
Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Elmar,
On Aug 7, 2013, at 12:50 , Elmar Zeeb <el...@pipesbox.de> wrote:
> thank you for your fast response! Reading your response i realized that i forgot some points in my last mail.
>
> Am 06.08.2013 14:37, schrieb Marcel Offermans:
>> Hello Elmar,
>>
>> On Aug 6, 2013, at 13:19 , Elmar Zeeb<el...@pipesbox.de> wrote:
>>
>>> i'm looking into apache ace to check if i can use it as backend for a web based market to install software extensions on an osgi based application. In this use case i can't use the vaadin based ui but started to implement a java based client for the client REST API.
>> Underneath the Vaadin, REST and (very recently) GoGo client API's lies the same Java Client API. In other words, that's a good place to start with your own client. In this case, the "Workspace" class that is an abstraction on top of that (part of the REST client) can be used to start.
> I didn't mention that my client can't run inside apache ace, but should use a remote api.
The client.jar is something that can be run completely separate (and remote) from the server. We actually run it on our build agent.
> The next point is, that i can't use osgi to run the client.
The client does use OSGi. I'm sure you can always embed OSGi inside a normal application.
> From my explorations the java client api can run remotely but depends on osgi. That's why i looked at the REST API first.
Correct.
>>> I'm aware of the amdatu ace client, but i wanted to implement a client on my own to understand the api and apache ace. Currently i'm able to create, modify and delete different client resources (artifact, feature, distribution and target) but have problems with associations. I have looked at the client rest api docu on ace.apache.org and athttps://issues.apache.org/jira/browse/ACE-151 to get a better understanding of associations filters and queries.
>> Ok.
>>
>>> I don't understand how to set the leftEndpoint and rightEndpoint attributes of associations. As written on the web site these attributes are LDAP filters. Does this mean that i have to parse the LDAP filter on the client side to check which resources are associated?
>> Yes, they are LDAP filters.
>> No you don't need to parse them yourself, that is something the associations will do for you. Just provide the filter condition and it will be evaluated against objects on the left or right hand side of the association.
>>
>>> Is there a way to let ace do the filtering and return resource ids? I'm aware of the ace/clients/tmp/9876/artifact2feature?left=&right=query. Is there something like ace/clients/tmp/9876/artifact2feature/12345/leftResourceIdsto query all left resource ids of an association?
>> If you create an association, you can set the left and right hand filters yourself.
>>
>>> The vaadin UI uses attribute based LDAP filters to create associations. I would like to have static associations based on resource ids - so i use LDAP filters like "(id=[resource id])" to specify endpoints.
>> Take a look at the Workspace.cas() method (a generic way to create an association) where you can do something like:
>>
>> ws.cas("distribution2target", "(name=foo)", "(id=bar)");
> I setup the ace rest client to run in a debugger and found out, that setting "leftEndpoint" and "rightEndpoint" attributes during association creation does not work. The associations are created successfully but the ldap filters are not used to associate resources. That may be the cause why the vaadin ui doesn't show this associations.
I'd have to look into that, because that might be a bug.
> Now I set "left" and "right" attributes. If I use ressource ids for left and right ace automatically fills in corresponding ldap filters for leftEndpoint and rightEndpoint. So setting leftEndpoint and rightEndpoint attributes directly doesn't seem to work.
Ok.
>> Optional arguments to specify the cardinality can be used to force ACE to use a 1:1 (or 1:N, N:1 or N:N) cardinality.
>>
>>> The vaadin ui can't display these associations.
>> Actually, if you click on some object, it will always highlight everything that is associated, even if you do it via these programmatically created associations.
> My programmatically created associations with leftEndpoint and rightEndpoint attributes don't show up in the vaadin ui, but associations with left and right attributes show up in the vaadin ui - problem solved.
Ok.
>>> ACE-151 mentions that there are no checks for LDAP filters so the filter may not work.
>>>
>>> So my question is how to specify association endpoints and how to query resource ids of associates resources with the client REST API?
>> My advice is to use the Java API. If you have an Assocation object, you can simply ask it to getLeft() or getRight() and you will get a list of all associated objects on either side.
> So now I have a working client for 1:1 associations as I can read the left and right attribute of associations. But when I use 1:n associations i can't easily get the list of related objects - besides using the java api. I'm looking for query similar to getLeft() and getRight() in the REST API. Is there something similar? Or does the left and right attribute contain a list of resource ids in this case ?
From memory I don't think we created REST calls to retrieve such lists yet. It would be a valid enhancement request though.
> When i was debugging the rest api i also saw that the target resource as special operations: register and approve.
> I can imagine what these operations do, but how do i call them ?
From the code, by doing a POST on:
workspaceID/entityType/entityID/action
> At the moment i register a target by recreating a target resource and unregister the a target by deleting a target resource. But i have no way to approve changes without setting the auto approve attribute.
That's what the approve operation above was for. If you have more things you'd like to do, but can't (figure out) please do keep asking and suggesting features.
Greetings, Marcel
Re: Client REST API
Posted by Elmar Zeeb <el...@pipesbox.de>.
Hi Marcel,
thank you for your fast response! Reading your response i realized that
i forgot some points in my last mail.
Am 06.08.2013 14:37, schrieb Marcel Offermans:
> Hello Elmar,
>
> On Aug 6, 2013, at 13:19 , Elmar Zeeb<el...@pipesbox.de> wrote:
>
>> i'm looking into apache ace to check if i can use it as backend for a web based market to install software extensions on an osgi based application. In this use case i can't use the vaadin based ui but started to implement a java based client for the client REST API.
> Underneath the Vaadin, REST and (very recently) GoGo client API's lies the same Java Client API. In other words, that's a good place to start with your own client. In this case, the "Workspace" class that is an abstraction on top of that (part of the REST client) can be used to start.
I didn't mention that my client can't run inside apache ace, but should
use a remote api.
The next point is, that i can't use osgi to run the client.
From my explorations the java client api can run remotely but depends
on osgi. That's why i looked at the REST API first.
>> I'm aware of the amdatu ace client, but i wanted to implement a client on my own to understand the api and apache ace. Currently i'm able to create, modify and delete different client resources (artifact, feature, distribution and target) but have problems with associations. I have looked at the client rest api docu on ace.apache.org and athttps://issues.apache.org/jira/browse/ACE-151 to get a better understanding of associations filters and queries.
> Ok.
>
>> I don't understand how to set the leftEndpoint and rightEndpoint attributes of associations. As written on the web site these attributes are LDAP filters. Does this mean that i have to parse the LDAP filter on the client side to check which resources are associated?
> Yes, they are LDAP filters.
> No you don't need to parse them yourself, that is something the associations will do for you. Just provide the filter condition and it will be evaluated against objects on the left or right hand side of the association.
>
>> Is there a way to let ace do the filtering and return resource ids? I'm aware of the ace/clients/tmp/9876/artifact2feature?left=&right=query. Is there something like ace/clients/tmp/9876/artifact2feature/12345/leftResourceIdsto query all left resource ids of an association?
> If you create an association, you can set the left and right hand filters yourself.
>
>> The vaadin UI uses attribute based LDAP filters to create associations. I would like to have static associations based on resource ids - so i use LDAP filters like "(id=[resource id])" to specify endpoints.
> Take a look at the Workspace.cas() method (a generic way to create an association) where you can do something like:
>
> ws.cas("distribution2target", "(name=foo)", "(id=bar)");
I setup the ace rest client to run in a debugger and found out, that
setting "leftEndpoint" and "rightEndpoint" attributes during association
creation does not work. The associations are created successfully but
the ldap filters are not used to associate resources. That may be the
cause why the vaadin ui doesn't show this associations.
Now I set "left" and "right" attributes. If I use ressource ids for left
and right ace automatically fills in corresponding ldap filters for
leftEndpoint and rightEndpoint. So setting leftEndpoint and
rightEndpoint attributes directly doesn't seem to work.
> Optional arguments to specify the cardinality can be used to force ACE to use a 1:1 (or 1:N, N:1 or N:N) cardinality.
>
>> The vaadin ui can't display these associations.
> Actually, if you click on some object, it will always highlight everything that is associated, even if you do it via these programmatically created associations.
My programmatically created associations with leftEndpoint and
rightEndpoint attributes don't show up in the vaadin ui, but
associations with left and right attributes show up in the vaadin ui -
problem solved.
>> ACE-151 mentions that there are no checks for LDAP filters so the filter may not work.
>>
>> So my question is how to specify association endpoints and how to query resource ids of associates resources with the client REST API?
> My advice is to use the Java API. If you have an Assocation object, you can simply ask it to getLeft() or getRight() and you will get a list of all associated objects on either side.
So now I have a working client for 1:1 associations as I can read the
left and right attribute of associations. But when I use 1:n
associations i can't easily get the list of related objects - besides
using the java api. I'm looking for query similar to getLeft() and
getRight() in the REST API. Is there something similar? Or does the left
and right attribute contain a list of resource ids in this case ?
When i was debugging the rest api i also saw that the target resource as
special operations: register and approve.
I can imagine what these operations do, but how do i call them ?
At the moment i register a target by recreating a target resource and
unregister the a target by deleting a target resource. But i have no way
to approve changes without setting the auto approve attribute.
Regards,
Elmar
Re: Client REST API
Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Elmar,
On Aug 6, 2013, at 13:19 , Elmar Zeeb <el...@pipesbox.de> wrote:
> i'm looking into apache ace to check if i can use it as backend for a web based market to install software extensions on an osgi based application. In this use case i can't use the vaadin based ui but started to implement a java based client for the client REST API.
Underneath the Vaadin, REST and (very recently) GoGo client API's lies the same Java Client API. In other words, that's a good place to start with your own client. In this case, the "Workspace" class that is an abstraction on top of that (part of the REST client) can be used to start.
> I'm aware of the amdatu ace client, but i wanted to implement a client on my own to understand the api and apache ace. Currently i'm able to create, modify and delete different client resources (artifact, feature, distribution and target) but have problems with associations. I have looked at the client rest api docu on ace.apache.org and at https://issues.apache.org/jira/browse/ACE-151 to get a better understanding of associations filters and queries.
Ok.
> I don't understand how to set the leftEndpoint and rightEndpoint attributes of associations. As written on the web site these attributes are LDAP filters. Does this mean that i have to parse the LDAP filter on the client side to check which resources are associated?
Yes, they are LDAP filters.
No you don't need to parse them yourself, that is something the associations will do for you. Just provide the filter condition and it will be evaluated against objects on the left or right hand side of the association.
> Is there a way to let ace do the filtering and return resource ids? I'm aware of the ace/clients/tmp/9876/artifact2feature?left=&right=query. Is there something like ace/clients/tmp/9876/artifact2feature/12345/leftResourceIdsto query all left resource ids of an association?
If you create an association, you can set the left and right hand filters yourself.
> The vaadin UI uses attribute based LDAP filters to create associations. I would like to have static associations based on resource ids - so i use LDAP filters like "(id=[resource id])" to specify endpoints.
Take a look at the Workspace.cas() method (a generic way to create an association) where you can do something like:
ws.cas("distribution2target", "(name=foo)", "(id=bar)");
Optional arguments to specify the cardinality can be used to force ACE to use a 1:1 (or 1:N, N:1 or N:N) cardinality.
> The vaadin ui can't display these associations.
Actually, if you click on some object, it will always highlight everything that is associated, even if you do it via these programmatically created associations.
> ACE-151 mentions that there are no checks for LDAP filters so the filter may not work.
>
> So my question is how to specify association endpoints and how to query resource ids of associates resources with the client REST API?
My advice is to use the Java API. If you have an Assocation object, you can simply ask it to getLeft() or getRight() and you will get a list of all associated objects on either side.
Greetings, Marcel