Return-Path: X-Original-To: apmail-aries-dev-archive@www.apache.org Delivered-To: apmail-aries-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9FE191046C for ; Fri, 20 Sep 2013 11:40:23 +0000 (UTC) Received: (qmail 43530 invoked by uid 500); 20 Sep 2013 11:35:09 -0000 Delivered-To: apmail-aries-dev-archive@aries.apache.org Received: (qmail 43192 invoked by uid 500); 20 Sep 2013 11:34:53 -0000 Mailing-List: contact dev-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list dev@aries.apache.org Received: (qmail 43026 invoked by uid 99); 20 Sep 2013 11:34:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Sep 2013 11:34:04 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of david.bosschaert@gmail.com designates 74.125.82.47 as permitted sender) Received: from [74.125.82.47] (HELO mail-wg0-f47.google.com) (74.125.82.47) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 20 Sep 2013 11:33:58 +0000 Received: by mail-wg0-f47.google.com with SMTP id f12so348751wgh.2 for ; Fri, 20 Sep 2013 04:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=LtM4sFq/MgcMu/lPQAgcjwQ5EqIrJQphgX7EsN/UPYo=; b=vGwwRJX8Ae02lrt7ygPdmlMc0QNr8CAArfzKcDYzKIZImPga8czDOMUoKGNdRktEie TLtwBBkf5qAvi4ROncy3iVADzwr0GBo3lIFA6J2cu1dUWt85w3W6yvI4gHkzJTDBt2Qk tLYiyLRgIQ983TeUmefW+MvMFMtcuelXJzmEPuQ5sInYJGRHkdB5QNpOUJFmZwDWQn1I GT9g+1nfZy5QSNO5N/mGKJln8PfctNJTftu8TeyEEJlhnDafNCgoq4X7tqhlvZjXd7Hz TA0wQT2PpVjTup1Sj8swboe75cVxNLMD8T2Hr3J9PbXmOx7iSaaKAmUyubkO3PI435BA b6Sw== X-Received: by 10.180.221.38 with SMTP id qb6mr2419651wic.8.1379676817802; Fri, 20 Sep 2013 04:33:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.28.73 with HTTP; Fri, 20 Sep 2013 04:33:17 -0700 (PDT) From: David Bosschaert Date: Fri, 20 Sep 2013 12:33:17 +0100 Message-ID: Subject: A utility to help working with OSGi Service Registry Hooks To: "dev@aries.apache.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi all, The OSGi service registry hooks provide a powerful way to influence how clients view the OSGi service registry. To give a few examples that you can do with the hooks: * Hide certain services from certain clients * Extend or otherwise alter the service registration properties the client sees * Proxy/intercept service invocations * You can also use the hooks to find out what services clients are looking for After having used them a few times I found that, while not very hard, it's not trivial to implement these hooks. Typically you need to implement 2 or 3 hooks (FindHook, EventListenerHook, ListenerHook) which need to work together to provide a consistent view to the service consumers. So I started creating a utility class that makes working with the service registry hooks for some of the above use cases a little simpler and I was thinking that it might make sense to contribute this utility to Aries. My implementation, which focuses on the top 3 uses cases above is currently simply called ServiceProxyUtil (anyone a better name?) and although it's not very large I find that it makes life a little easier to work with the service hooks. I think a good place for it would be in the Aries Util bundle. In some cases it may make sense to use it together with Aries Proxy, but this is certainly not always necessary. Thoughts anyone? If people like the idea I can explain a little more in detail what it does... Cheers, David