You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ak...@apache.org on 2006/08/19 19:48:30 UTC

svn commit: r432848 - in /incubator/felix/trunk/tools/maven2: felix-archetype/ felix-archetype/src/main/resources/META-INF/ felix-archetype/src/main/resources/archetype-resources/ felix-archetype/src/main/resources/archetype-resources/src/main/java/ os...

Author: akarasulu
Date: Sat Aug 19 10:48:29 2006
New Revision: 432848

URL: http://svn.apache.org/viewvc?rev=432848&view=rev
Log:
adding new felix archetype and making some touchups to osgi archetype

Added:
    incubator/felix/trunk/tools/maven2/felix-archetype/   (props changed)
      - copied from r432486, incubator/felix/trunk/tools/maven2/osgi-archetype/
Modified:
    incubator/felix/trunk/tools/maven2/felix-archetype/pom.xml
    incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/META-INF/archetype.xml
    incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/pom.xml
    incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java
    incubator/felix/trunk/tools/maven2/osgi-archetype/   (props changed)
    incubator/felix/trunk/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml

Propchange: incubator/felix/trunk/tools/maven2/felix-archetype/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug 19 10:48:29 2006
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+*.log

Modified: incubator/felix/trunk/tools/maven2/felix-archetype/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/felix-archetype/pom.xml?rev=432848&r1=432486&r2=432848&view=diff
==============================================================================
--- incubator/felix/trunk/tools/maven2/felix-archetype/pom.xml (original)
+++ incubator/felix/trunk/tools/maven2/felix-archetype/pom.xml Sat Aug 19 10:48:29 2006
@@ -2,7 +2,7 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.felix.archetypes</groupId>
-  <artifactId>osgi-archetype</artifactId>
+  <artifactId>felix-archetype</artifactId>
   <packaging>maven-plugin</packaging>
   <version>1.0</version>
 </project>

Modified: incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/META-INF/archetype.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/META-INF/archetype.xml?rev=432848&r1=432486&r2=432848&view=diff
==============================================================================
--- incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/META-INF/archetype.xml (original)
+++ incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/META-INF/archetype.xml Sat Aug 19 10:48:29 2006
@@ -1,5 +1,5 @@
 <archetype>
-  <id>osgi-archetype</id>
+  <id>felix-archetype</id>
   <sources>
     <source>src/main/java/Activator.java</source>
   </sources>

Modified: incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/pom.xml?rev=432848&r1=432486&r2=432848&view=diff
==============================================================================
--- incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/pom.xml (original)
+++ incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/pom.xml Sat Aug 19 10:48:29 2006
@@ -7,48 +7,65 @@
   <version>${version}</version>
   <name>Simple Bundle Project</name>
   <url>http://incubator.apache.org/felix</url>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>0.8.0-SNAPSHOT</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
   <build>
-    <!--
-    ***********************************************************
-    * Uncomment out to override default jar naming convention *
-    ***********************************************************
+    <!-- Uncomment to override default bundle jar naming convention
     <finalName>my-bundle</finalName>
     -->
+
     <plugins>
       <plugin>
         <groupId>org.apache.felix.plugins</groupId>
+        <artifactId>maven-felix-plugin</artifactId>
+        <executions>
+          <execution>
+             <id>run</id>
+             <configuration>
+               <felixCacheDir>${basedir}/target/.felix</felixCacheDir>
+               <exclusions>
+                 <exclusion>junit:junit</exclusion>
+               </exclusions>
+             </configuration>
+             <goals>
+               <goal>run</goal>
+             </goals>
+          </execution>
+        </executions>
+      </plugin>
+    
+      <plugin>
+        <groupId>org.apache.felix.plugins</groupId>
         <artifactId>maven-osgi-plugin</artifactId>
         <extensions>true</extensions>
-        <version>0.3.0</version>
         <configuration>
-          <!--
-          *************************************************
-          * Uncomment to specify a manifest file to merge *
-          *************************************************
+          <!-- Uncomment to specify a manifest file to merge
           <manifestFile>path/to/manifest.mf</manifestFile>
           -->
-
-          <!--
-          *******************************************************************
-          * See the following link for entry specification                  *
-          * http://docs.safehaus.org/display/OSGI/OSGi+Plugin+for+Maven+2.0 *
-          *******************************************************************
-          -->
           <osgiManifest>
             <bundleName>Simple Bundle</bundleName>
             <bundleActivator>${groupId}.Activator</bundleActivator>
             <bundleVendor>Apache Software Foundation</bundleVendor>
+            <importBundle>
+              ${groupId}
+            </importBundle>
           </osgiManifest>
         </configuration>
       </plugin>
     </plugins>
   </build>
-  <dependencies>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi</artifactId>
-      <version>3.0</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
 </project>

Modified: incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java?rev=432848&r1=432486&r2=432848&view=diff
==============================================================================
--- incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java (original)
+++ incubator/felix/trunk/tools/maven2/felix-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java Sat Aug 19 10:48:29 2006
@@ -1,5 +1,5 @@
 /*
- *   Copyright 2005 The Apache Software Foundation
+ *   Copyright 2006 The Apache Software Foundation
  *
  *   Licensed under the Apache License, Version 2.0 (the "License");
  *   you may not use this file except in compliance with the License.
@@ -16,19 +16,21 @@
  */
 package ${groupId};
 
+
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceEvent;
 import org.osgi.framework.ServiceListener;
 
+
 /**
  * This class implements a simple bundle that utilizes the OSGi
  * framework's event mechanism to listen for service events.
  *
  * Upon receiving a service event, it prints out the event's details.
-**/
-public class Activator implements BundleActivator, ServiceListener {
-
+ */
+public class Activator implements BundleActivator, ServiceListener 
+{
     /**
      * Put your bundle initialization code here...
      *
@@ -38,11 +40,13 @@
      * @param bundleContext the framework context for the bundle
      * @throws Exception
      */
-    public void start(BundleContext bundleContext) throws Exception {
-        System.out.println("Starting to listen for service events.");
-        bundleContext.addServiceListener(this);
+    public void start( BundleContext bundleContext ) throws Exception 
+    {
+        System.out.println( "Starting to listen for service events." );
+        bundleContext.addServiceListener( this );
     }
 
+    
     /**
      * Put your bundle finalization code here...
      *
@@ -52,28 +56,39 @@
      * @param bundleContext the framework context for the bundle
      * @throws Exception
      */
-    public void stop(BundleContext bundleContext) throws Exception {
-        bundleContext.removeServiceListener(this);
-        System.out.println("Stopped listening for service events.");
+    public void stop( BundleContext bundleContext ) throws Exception 
+    {
+        bundleContext.removeServiceListener( this );
+        System.out.println( "Stopped listening for service events." );
 
         // Note: It is not required that we remove the listener here, since
         // the framework will do it automatically anyway.
     }
 
+    
     /**
      * Implements <code>ServiceListener.serviceChanges()</code>. Prints the
      * details of any service event from the framework.
      *
      * @param event the fired service event
      */
-    public void serviceChanged(ServiceEvent event) {
-        String[] objectClass = (String[]) event.getServiceReference().getProperty("objectClass");
-        if (event.getType() == ServiceEvent.REGISTERED) {
-            System.out.println("SimpleBundle: Service of type " + objectClass[0] + " registered.");
-        } else if (event.getType() == ServiceEvent.UNREGISTERING) {
-            System.out.println("SimpleBundle: Service of type " + objectClass[0] + " unregistered.");
-        } else if (event.getType() == ServiceEvent.MODIFIED) {
-            System.out.println("SimpleBundle: Service of type " + objectClass[0] + " modified.");
+    public void serviceChanged( ServiceEvent event ) 
+    {
+        String[] objectClass = ( String[] ) event.getServiceReference().getProperty( "objectClass" );
+        
+        switch( event.getType() )
+        {
+            case( ServiceEvent.REGISTERED ):
+                System.out.println( "SimpleBundle: Service of type " + objectClass[0] + " registered." );
+                break;
+            case( ServiceEvent.UNREGISTERED ):
+                System.out.println( "SimpleBundle: Service of type " + objectClass[0] + " unregistered." );
+                break;
+            case( ServiceEvent.MODIFIED ):
+                System.out.println( "SimpleBundle: Service of type " + objectClass[0] + " modified." );
+                break;
+            default:
+                break;
         }
     }
 }

Propchange: incubator/felix/trunk/tools/maven2/osgi-archetype/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug 19 10:48:29 2006
@@ -0,0 +1,3 @@
+.classpath
+.project
+target

Modified: incubator/felix/trunk/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml?rev=432848&r1=432847&r2=432848&view=diff
==============================================================================
--- incubator/felix/trunk/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml (original)
+++ incubator/felix/trunk/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml Sat Aug 19 10:48:29 2006
@@ -7,6 +7,16 @@
   <version>${version}</version>
   <name>Simple Bundle Project</name>
   <url>http://incubator.apache.org/felix</url>
+  
+  <dependencies>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi</artifactId>
+      <version>3.0</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
   <build>
     <!--
     ***********************************************************
@@ -19,7 +29,7 @@
         <groupId>org.apache.felix.plugins</groupId>
         <artifactId>maven-osgi-plugin</artifactId>
         <extensions>true</extensions>
-        <version>0.3.0</version>
+        <version>0.8.0-SNAPSHOT</version>
         <configuration>
           <!--
           *************************************************
@@ -38,17 +48,12 @@
             <bundleName>Simple Bundle</bundleName>
             <bundleActivator>${groupId}.Activator</bundleActivator>
             <bundleVendor>Apache Software Foundation</bundleVendor>
+            <importPackage>
+              ${groupId}
+            </importPackage>
           </osgiManifest>
         </configuration>
       </plugin>
     </plugins>
   </build>
-  <dependencies>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi</artifactId>
-      <version>3.0</version>
-      <scope>provided</scope>
-    </dependency>
-  </dependencies>
 </project>