Hi Jerome,
The blinksale API [1] is a nice choice. RoR fans will like it :-)
Jerome Louvel wrote:
> Marc,
>
> I understand your concerns.
>
> (i) For the performance, I'm sure there would be ways to optimize the
> introspection if necessary to not have to do it for each call for example.
>
It can. Although to get really good performance requires some rather
sophisticated stuff with byte code generation, like what JAXB 2.x RI
does, and it is not easy. The Java type system is there for a reason :-)
> (ii) At first is does seem scaring but once we have a clear mind about the
> API, I hope that every piece will fall in nicely. The issue with starting
> with an extensive API like your prototype, is that it forces us to embrace
> the full complexity in one shot instead of progressively add complexity.
>
> (iii) In most cases, those HTTP metadata may not even be needed. I'm not
> sure that ROME/Atom is the best sample use case as it seems to me to be a
> rather advanced use case already. Probably we should start with a simpler
> case (but realistic one) and worry about Atom a bit later.
The style used by BlinkSale is very similar to APP (namely CRUD of
collections/items) and infact the Atom format is an option at least for
getting Invoices. So in this case i would say it is likely that
ROME/Atom would be used.
> ---
>
> It seems to me that we went quite far in the design alternatives
> discussions. As Stefan pointed out, we should focus on illustrating those
> alternatives with concrete examples. I've started working on illustrating my
> view using the Blinksale API as suggested by Dhanji. It won't run, but just
> articulate the pieces together (annotations, POJOs, etc.).
>
Great!
Once you have done invoice and invoices the pattern sort of repeats for
deliveries/delivery and payments/payment. Below [2] is a really rough,
back of the envelope sketch for Invoices and Invoice resources.
Paul.
[1]
http://www.blinksale.com/api
[2]
Assumes the JAXB beans Invoices and Invoice have been created.
@UriTemplate("/Invoices")
@SubResources({InvoiceResource.class})
class InvoicesResource {
Date start, end;
String status, tags;
public InvoicesResource(
@QueryParam("start") Date start,
@QueryParam("end") Date end,
@QueryParam("status") String status,
@QueryParam("tags") String tags)
...
}
@ProduceMime("application/vnd.blinksale+xml")
@HttpMethod
Invoices getInvoices() {
...
}
@ProduceMime("application/atom+xml")
@HttpMethod
Feed getInvoicesAsFeed() {
...
}
@ProduceMime("text/calendar")
@HttpMethod
Calendar getInvoicesAsCalendar() {
...
}
@ConsumeMime("application/vnd.blinksale+xml'")
@HttpMethod
Created postInvoice(Invoice i) {
...
}
}
@UriTemplate("{Invoice_Id}")
class InvoiceResource {
int id;
public InvoiceResource(
@UriParam("Invoice_Id}" int id) {
if (id not recognized)
throw NotFoundException(...);
this.id = id;
}
@ProduceMime("application/vnd.blinksale+xml'")
@HttpMethod
Invoice getInvoice() {
...
}
@ProduceMime("application/atom+xml")
@HttpMethod
Entry getInvoicesAsEntry() {
...
}
@ConsumeMime("application/vnd.blinksale+xml'")
@HttpMethod
void putInvoice(Invoice i) {
...
}
@HttpMethod
void deleteInvoice() {
...
}
@UriTemplate("deliveries")
DeliveriesResource getDeliveriesResource () {
return new DeliveriesResource(i);
}
@UriTemplate("payments")
PaymentsResource getPaymentsResource () {
return new PaymentsResource(i);
}
}
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109