git-svn-id: https://svn.apache.org/repos/asf/incubator/felix/trunk@360549 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tools/maven2/osgi-archetype/src/main/resources/META-INF/archetype.xml b/tools/maven2/osgi-archetype/src/main/resources/META-INF/archetype.xml
index d4170a9..fe5c518 100644
--- a/tools/maven2/osgi-archetype/src/main/resources/META-INF/archetype.xml
+++ b/tools/maven2/osgi-archetype/src/main/resources/META-INF/archetype.xml
@@ -1,6 +1,6 @@
 <archetype>
   <id>osgi-archetype</id>
   <sources>
-    <source>src/main/java/MyBundleActivator.java</source>
+    <source>src/main/java/Activator.java</source>
   </sources>
 </archetype>
\ No newline at end of file
diff --git a/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml b/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml
index 51b8b6a..e9f3898 100644
--- a/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml
+++ b/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/pom.xml
@@ -5,8 +5,8 @@
   <artifactId>${artifactId}</artifactId>
   <packaging>osgi-bundle</packaging>
   <version>${version}</version>
-  <name>My Bundle Project Name Here</name>
-  <url>My Organization URL Here</url>
+  <name>Simple Bundle Project</name>
+  <url>http://incubator.apache.org/felix</url>
   <build>
     <!--
     ***********************************************************
@@ -35,9 +35,9 @@
           *******************************************************************
           -->
           <osgiManifest>
-            <bundleName>My Bundle Name</bundleName>
-            <bundleActivator>${groupId}.MyBundleActivator</bundleActivator>
-            <bundleVendor>My Organization Name</bundleVendor>
+            <bundleName>Simple Bundle</bundleName>
+            <bundleActivator>${groupId}.Activator</bundleActivator>
+            <bundleVendor>Apache Software Foundation</bundleVendor>
           </osgiManifest>
         </configuration>
       </plugin>
diff --git a/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java b/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java
new file mode 100644
index 0000000..0589778
--- /dev/null
+++ b/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/src/main/java/Activator.java
@@ -0,0 +1,79 @@
+/*
+ *   Copyright 2004 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.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+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 {
+
+    /**
+     * Put your bundle initialization code here...
+     *
+	 * Implements <code>BundleActivator.start()</code>. Prints a message
+     * and adds itself to the bundle context as a service listener.
+     *
+     * @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);
+    }
+
+    /**
+     * Put your bundle finalization code here...
+     *
+     * Implements <code>BundleActivator.stop()</code>. Prints a message
+     * and removes itself from the bundle context as a service listener.
+     *
+     * @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.");
+
+        // 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.");
+        }
+    }
+}
diff --git a/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/src/main/java/MyBundleActivator.java b/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/src/main/java/MyBundleActivator.java
deleted file mode 100644
index 74e5182..0000000
--- a/tools/maven2/osgi-archetype/src/main/resources/archetype-resources/src/main/java/MyBundleActivator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *   Copyright 2004 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.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package ${groupId};
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class MyBundleActivator implements BundleActivator {
-
-    public void start(BundleContext bundleContext) throws Exception {
-        // Put code here to initialize your bundle...
-        System.out.println("Bundle started.");
-    }
-
-    public void stop(BundleContext bundleContext) throws Exception {
-        // Put code here to finalize your bundle...
-        System.out.println("Bundle stopped.");
-    }
-}