Enterprise Integration Zone is brought to you in partnership with:

Ouertani Slim was born in Tunisia in 1981. Now he is a software engineer since 2004 and he is Java 6 and Spring certified with 100% and 94% respectively. He is very interested in Java technology, Scala and open source projects. He believes that programming is one of the hardest jobs and most beautiful in the world. Slim has posted 32 posts at DZone. You can read more from them at their website. View Full User Profile

SCA, Newton and Spring DM

02.04.2009
| 22214 views |
  • submit to reddit

Pom Files

  • Change the three projects to bundle packaging : adding <packaging>bundle</packaging> to pom headers.
  • Api will export com.jtunisie.osgi.sca package

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>com.jtunisie.osgi.sca</Export-Package>
<Bundle-SymbolicName>${pom.name}-${pom.version}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
  • impl will also export com.jtunisie.osgi.sca package and make implementation private

<build>
<plugins>
<plugin>
<groupid>org.apache.felix</groupid>
<artifactid>maven-bundle-plugin</artifactid>
<extensions>true</extensions>
<configuration>
<instructions>
<export-package>com.jtunisie.osgi.sca</export-package>
<private-package>com.jtunisie.osgi.sca.impl</private-package>
<bundle-symbolicname>${pom.name}-${pom.version}</bundle-symbolicname>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
Note : The impl bundle contains api interface so don't deploy the api bundle. Yes, we don't need to include api inside the impl bundle. Just import the com.jtunisie.osgi.sca package and deploy the two bundles.
  • The client bundle doesn't export any package :

  <build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Private-Package>com.jtunisie.osgi.sca.client</Private-Package>
<Bundle-SymbolicName>${pom.name}-${pom.version}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
  • Add Newton headers : Installable-Component-Templates is the name of the composite file under resources|-- META-INF|-- newton directory.
    • Impl pom :

        <build>
    <plugins>
    <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
    <instructions>
    <Export-Package>com.jtunisie.osgi.sca</Export-Package>
    <Private-Package>com.jtunisie.osgi.sca.impl</Private-Package>
    <Bundle-SymbolicName>${pom.name}-${pom.version}</Bundle-SymbolicName>
    <Installable-Component>true</Installable-Component>
    <Installable-Component-Templates>META-INF/newton/service.composite</Installable-Component-Templates>
    </instructions>
    </configuration>
    </plugin>
    </plugins>
    </build>
    • client pom :
      <build>
      <plugins>
      <plugin>
      <groupId>org.apache.felix</groupId>
      <artifactId>maven-bundle-plugin</artifactId>
      <extensions>true</extensions>
      <configuration>
      <instructions>
      <Private-Package>com.jtunisie.osgi.sca.client</Private-Package>
      <Bundle-SymbolicName>${pom.name}-${pom.version}</Bundle-SymbolicName>
      <Installable-Component>true</Installable-Component>
      <Installable-Component-Templates>META-INF/newton/client.composite</Installable-Component-Templates>
      </instructions>
      </configuration>
      </plugin>
      </plugins>
      </build>

 

Published at DZone with permission of its author, Slim Ouertani.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Wassim ABID replied on Wed, 2009/02/04 - 11:48am

Good work :-)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.