Return-Path: Delivered-To: apmail-felix-users-archive@minotaur.apache.org Received: (qmail 63853 invoked from network); 7 Apr 2010 09:34:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Apr 2010 09:34:15 -0000 Received: (qmail 14295 invoked by uid 500); 7 Apr 2010 09:34:15 -0000 Delivered-To: apmail-felix-users-archive@felix.apache.org Received: (qmail 14159 invoked by uid 500); 7 Apr 2010 09:34:13 -0000 Mailing-List: contact users-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@felix.apache.org Delivered-To: mailing list users@felix.apache.org Received: (qmail 14150 invoked by uid 99); 7 Apr 2010 09:34:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Apr 2010 09:34:12 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nicolas.delsaux@gmail.com designates 72.14.220.158 as permitted sender) Received: from [72.14.220.158] (HELO fg-out-1718.google.com) (72.14.220.158) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Apr 2010 09:34:07 +0000 Received: by fg-out-1718.google.com with SMTP id d23so318425fga.10 for ; Wed, 07 Apr 2010 02:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:received:message-id :subject:from:to:content-type; bh=9RohMC9HfaeQUg70r+qDBlV00iEqZnKtnZxpwY/Bicw=; b=UX/qpgyc9u1QwK5vCwsHEXSBTHS4PJIgvlaet96jWZ1v0cfYfNfIFzeIAMXr86BWrB oBJaxR3HGZdfQiCdqmr+7XeEM2nn/6UtpKzhd9fTfuMrDvGuu3MPaKRg5EVj481kV7Y7 qhxghd5+78dHjspT3dIVPvTFs2JhZVDOtAQEI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Wiwko+BY5Mi6qxlGuJdZdnFg3JgQz4ZPxTqRs7C++ASCOD5JXIAZXdsaxuQ6TKYbHS g0t/irRVoUpC+tTiXHpMuxL7t0xc8bL13daROV6Pvk+Jc5kosk4mOV8dSSQK8MEOz3np Bb3v/eRFzQXmM4iXP6Mh8GSfm7ZFBHL2vEC2Q= MIME-Version: 1.0 Received: by 10.103.238.17 with HTTP; Wed, 7 Apr 2010 02:33:44 -0700 (PDT) Date: Wed, 7 Apr 2010 12:33:44 +0300 Received: by 10.102.174.3 with SMTP id w3mr4625632mue.48.1270632824160; Wed, 07 Apr 2010 02:33:44 -0700 (PDT) Message-ID: Subject: iPOJO annotations with a maven project From: Nicolas Delsaux To: users@felix.apache.org Content-Type: text/plain; charset=ISO-8859-1 Hi all, after having run along the classical Felix tutorials (creating bundles through maven), i was quite interested by the promises of OSGi, but a little worried by the way dependencies were resolved. Fortunatly, my eye felt on iPOJO. I can say I was quite pleased by the promise of IoC between plugins (what seems to offer iPOJO) especially using annotations, which may be a fad, but are to my mind very useful. Before all, I must confess I'm a converted maven user, which may alter some of my points of view. So, I've tried to do the maven tutorial (http://felix.apache.org/site/ipojo-hello-word-maven-based-tutorial.html) using a well-known maven way : a superpom containing my poms basic definitions and one module for each feature : a hello-service module, and a hello-client one. Before all, I have to say I used this architecture for classical Felix tutorials, and it perfectly worked. So, my modules pom were quite light, and so were my classes. In these classes, I defined the HelloService interface, a HelloImpl provider (with @Component and @Provides) annotation, and a HelloClient using @Requires annotation, as well as @Validates one to start the hello world code. Having done so, it seemed to me I didn't had to create a metada.xml file, since all informations were in these annotations. Was I theorically right ? Well, in the facts, i was wrong since : - my jars METADATA.INF don't contain any of the data defined by both parent and module maven-bundle-plugin configuration - the maven log don't reveal any maven-bundle-plugin execution (which may be the reason for the lack of METADATA.INF) ... well, this one was found and resolved : my modules didn't packaged themselves as "bundle" ... stupid of me ! - once the above is corrected, my METADA.INF were created, my bundles had their correct names set in felix, but the @Validate method of my client was never called. FTR, here is my full hello client : @Component(name="Da Hello Klient") public class HelloClient { private static final Logger logger = Logger.getLogger(HelloClient.class .getName()); @Requires private HelloService service; private String user = System.getProperty("user.name"); @Validate public void hello() { logger.info(service.sayHello(user)); } @Invalidate public void goodbye() { logger.info(service.sayGoodbye(user)); } } And the associated METADATA.INF Manifest-Version: 1.0 Export-Package: com.mycompany.hello.api Built-By: ndx Tool: Bnd-0.0.238 Bundle-Name: com.mycompany.hello Created-By: Apache Maven Bundle Plugin Bundle-Vendor: Perigee Build-Jdk: 1.6.0_16 Bundle-Version: 0.0.1.SNAPSHOT Bnd-LastModified: 1270632257171 Bundle-ManifestVersion: 2 Bundle-Description: Dis bonjour au monde ! Import-Package: com.mycompany.hello.api Bundle-SymbolicName: com.mycompany.hello-service Bundle-DocURL: http://www.mycompany.fr So, here are my questions : - Do I absolutely need a metada.xml file ? - Is the validate method really called once all dependencies have been resolved and my iPOJO can be started ? Thanks -- Nicolas Delsaux --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@felix.apache.org For additional commands, e-mail: users-help@felix.apache.org