Return-Path: Delivered-To: apmail-incubator-abdera-dev-archive@locus.apache.org Received: (qmail 5401 invoked from network); 8 Jan 2008 22:04:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Jan 2008 22:04:34 -0000 Received: (qmail 68978 invoked by uid 500); 8 Jan 2008 22:04:23 -0000 Delivered-To: apmail-incubator-abdera-dev-archive@incubator.apache.org Received: (qmail 68958 invoked by uid 500); 8 Jan 2008 22:04:23 -0000 Mailing-List: contact abdera-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-dev@incubator.apache.org Delivered-To: mailing list abdera-dev@incubator.apache.org Received: (qmail 68949 invoked by uid 99); 8 Jan 2008 22:04:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jan 2008 14:04:23 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [63.246.7.16] (HELO mail.mulesource.com) (63.246.7.16) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jan 2008 22:04:09 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.mulesource.com (Postfix) with ESMTP id 61B3CA80002 for ; Tue, 8 Jan 2008 16:04:01 -0600 (CST) X-Virus-Scanned: amavisd-new at X-Spam-Score: -0.422 X-Spam-Level: Received: from mail.mulesource.com ([127.0.0.1]) by localhost (mail.mulesource.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 13TRIIa-DikZ for ; Tue, 8 Jan 2008 16:03:59 -0600 (CST) Received: from [192.168.1.105] (c-71-205-131-163.hsd1.mi.comcast.net [71.205.131.163]) by mail.mulesource.com (Postfix) with ESMTP id A5854A80001 for ; Tue, 8 Jan 2008 16:03:59 -0600 (CST) Message-ID: <4783F344.4040404@mulesource.com> Date: Tue, 08 Jan 2008 17:03:48 -0500 From: Dan Diephouse User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: abdera-dev@incubator.apache.org Subject: Re: More flexible servicesPath for ServiceProvider References: <47839BBB.4010806@anconafamily.com> In-Reply-To: <47839BBB.4010806@anconafamily.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-0.422 tagged_above=-10 required=6.6 tests=[AWL=0.131, BAYES_00=-2.599, RCVD_IN_SORBS_DUL=2.046] Jim Ancona wrote: > As I mentioned in the issue I just created > (https://issues.apache.org/jira/browse/ABDERA-85), I have a use case > where the base URI of my service is parameterized (e.g. > http://example.com/users/{userId}/service/). I want to use a > ServiceProvider at the user level, i.e. I would like the servicesPath > to match http://example.com/users/{userId}/. The current > implementation in AbstractServiceProvider uses a plain string match, > so there's no way to parameterize it. > > I have created a class extending AbstractServiceProvider which matches > using a regex. It also stores the match value(s) as request > parameter(s), making them easily accessible to my CollectionProvider. > While my class meets my needs, I think the use case is common enough > that you might want to incorporate something similar into Abdera. I > had to override AbstractServiceProvider.resolve() in my class, which > lead to quite a bit of duplicated code. It might be better to: > > 1. Refactor AbstractServiceProvider to abstract the string matching > into separate methods, so that classes that want to use a different > matching method can easily do so. > > 2. Make the default implementation use a regex rather than a simple > string match. > > You could do either of those, or both (or neither :-)). I'm willing to > provide a patch for whichever option(s) are preferred. > > Thanks for considering this. > Great idea. I too have had to extend ServiceProvider this week and found it highly annoying. But I haven't had a chance to look at how to improve it. #2 sounds interesting as it would not require any code. A patch would be most welcome. I suppose it could even be combined with #1 while we're at it in case people want to override the regex. Other than that - is the service provider code working for you OK? Did it make sense pretty easily? - Dan -- Dan Diephouse MuleSource http://mulesource.com | http://netzooid.com/blog