You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jg...@apache.org on 2012/05/13 16:53:43 UTC

svn commit: r1337902 - in /karaf/trunk/demos/deployer: ./ src/main/filtered-resources/resources/demos/deployer/bundle/ src/main/resources/resources/demos/deployer/bundle/ src/main/resources/resources/demos/deployer/bundle/src/ src/main/resources/resour...

Author: jgoodyear
Date: Sun May 13 14:53:42 2012
New Revision: 1337902

URL: http://svn.apache.org/viewvc?rev=1337902&view=rev
Log:
[KARAF-1442] Port deployer bundle demo to Karaf 3.0

Port the bundle demo from Karaf 2.2.x to Karaf 3.0.x.
Update README to use karaf 3 commands.


Added:
    karaf/trunk/demos/deployer/src/main/filtered-resources/resources/demos/deployer/bundle/
    karaf/trunk/demos/deployer/src/main/filtered-resources/resources/demos/deployer/bundle/README.TXT
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/NOTICE   (with props)
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/pom.xml
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/deployer/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/deployer/bundle/
    karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/deployer/bundle/Activator.java
Modified:
    karaf/trunk/demos/deployer/pom.xml

Modified: karaf/trunk/demos/deployer/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/deployer/pom.xml?rev=1337902&r1=1337901&r2=1337902&view=diff
==============================================================================
--- karaf/trunk/demos/deployer/pom.xml (original)
+++ karaf/trunk/demos/deployer/pom.xml Sun May 13 14:53:42 2012
@@ -36,7 +36,7 @@
 
     <modules>
         <module>src/main/resources/resources/demos/deployer/kar</module>
-        <!--<module>branding-package</module>-->
+        <module>src/main/resources/resources/demos/deployer/bundle</module>
     </modules>
     <build>
         <resources>

Added: karaf/trunk/demos/deployer/src/main/filtered-resources/resources/demos/deployer/bundle/README.TXT
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/deployer/src/main/filtered-resources/resources/demos/deployer/bundle/README.TXT?rev=1337902&view=auto
==============================================================================
--- karaf/trunk/demos/deployer/src/main/filtered-resources/resources/demos/deployer/bundle/README.TXT (added)
+++ karaf/trunk/demos/deployer/src/main/filtered-resources/resources/demos/deployer/bundle/README.TXT Sun May 13 14:53:42 2012
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+Karaf Bundle EXAMPLE
+====================
+
+Purpose
+-------
+Demonstrate how to build an OSGi Bundle.
+
+
+Prerequisites for Running this Example
+--------------------------------------
+You must have the following installed on your machine:
+
+   - JDK 1.6 or higher.
+
+   - Apache Maven 3.0.3 or higher.
+
+
+Building and Deploying
+----------------------
+This example will produce an OSGi bundle (a special type
+of Java Archive (jar).
+
+To build the demo bundle invoke the following command:
+
+  mvn install
+
+To deploy the newly created bundle you may either directly
+copy the generated my-bundle-1.0.0-SNAPSHOT.jar to the deploy
+directory, or issue the following command on the Karaf
+console:
+
+  karaf@root> bundle:install -s mvn:org.apache.karaf.demos.deployer.bundle/my-bundle/1.0.0-SNAPSHOT
+  Starting the Apache Karaf demo bundle
+  Bundle ID: 73 
+
+Upon installation the bundle was immediately started, printing
+the message in its activator's start method. To further verify
+its successful deployment invoke the following:
+
+  karaf@root> list
+  START LEVEL 100 , List Threshold: 50
+   ID   State         Level  Name
+  [  73] [    Active] [   80] Apache Karaf :: Demos :: Deployer :: Bundle (1.0.0.SNAPSHOT)
+
+The bundle may be started or stopped via the start and stop
+commands. A message will be printed to the console each time
+this occurs. 
+
+Note: Using Karaf archetype to generate a bundle project:
+---------------------------------------------------------
+
+The karaf-bundle-archetype creates a Maven skeleton project
+to build an OSGi bundle with Activator (a special callback
+class for bundle start/stop).
+
+On the command line issue the following command to create
+a bundle project:
+
+  mvn archetype:generate \
+      -DarchetypeGroupId=org.apache.karaf.archetypes \ 
+      -DarchetypeArtifactId=karaf-bundle-archetype \ 
+      -DarchetypeVersion=${version} \ 
+      -DgroupId=org.myorg \
+      -DartifactId=my-bundle \ 
+      -Dversion=1.0-SNAPSHOT \ 
+      -Dpackage=org.myorg.package
+
+For more information on using the karaf-bundle-archetype
+please visit: http://karaf.apache.org/manual/latest-3.0.x/developers-guide/archetypes.html

Added: karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/NOTICE
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/NOTICE?rev=1337902&view=auto
==============================================================================
--- karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/NOTICE (added)
+++ karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/NOTICE Sun May 13 14:53:42 2012
@@ -0,0 +1,48 @@
+Apache Karaf
+Copyright 2010-2012 The Apache Software Foundation
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+This product includes software written by
+Antony Lesuisse.
+Licensed under Public Domain.
+
+
+II. Used Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright (c) OSGi Alliance (2000, 2010).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+OPS4J (http://www.ops4j.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+FUSE Source (http://www.fusesource.org/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+Tanuki Software (http://www.tanukisoftware.com/).
+Licensed under the Apache License 2.0.
+
+This product uses software developed at
+JLine (http://jline.sourceforge.net).
+Licensed under the BSD License.
+
+This product uses software developed at
+SLF4J (http://www.slf4j.org/).
+Licensed under the MIT License.
+
+This product includes software from http://www.json.org.
+Copyright (c) 2002 JSON.org
+
+
+III. License Summary
+- Apache License 2.0

Propchange: karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/NOTICE
------------------------------------------------------------------------------
    svn:executable = *

Added: karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/pom.xml
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/pom.xml?rev=1337902&view=auto
==============================================================================
--- karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/pom.xml (added)
+++ karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/pom.xml Sun May 13 14:53:42 2012
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one or more
+        contributor license agreements.  See the NOTICE file distributed with
+        this work for additional information regarding copyright ownership.
+        The ASF licenses this file to You 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.
+    -->
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.karaf.demos</groupId>
+        <artifactId>demos</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+        <relativePath>../../../../../../../../pom.xml</relativePath>
+    </parent>
+
+    <groupId>org.apache.karaf.demos.deployer.bundle</groupId>
+    <artifactId>my-bundle</artifactId>
+    <version>3.0.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Apache Karaf :: Demos :: Deployer :: Bundle</name>
+    <description>Apache Karaf bundle demo.</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.2.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>2.3.7</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Version>${project.version}</Bundle-Version>
+                        <Bundle-Activator>org.apache.karaf.demos.deployer.bundle.Activator</Bundle-Activator>
+                        <Export-Package>
+                            org.apache.karaf.demos.deployer.bundle*;version=${project.version}
+                        </Export-Package>
+                        <Import-Package>
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Added: karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/deployer/bundle/Activator.java
URL: http://svn.apache.org/viewvc/karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/deployer/bundle/Activator.java?rev=1337902&view=auto
==============================================================================
--- karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/deployer/bundle/Activator.java (added)
+++ karaf/trunk/demos/deployer/src/main/resources/resources/demos/deployer/bundle/src/main/java/org/apache/karaf/demos/deployer/bundle/Activator.java Sun May 13 14:53:42 2012
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 org.apache.karaf.demos.deployer.bundle;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+    public void start(BundleContext context) {
+        System.out.println("Starting the Apache Karaf demo bundle");
+    }
+
+    public void stop(BundleContext context) {
+        System.out.println("Stopping the Apache Karaf demo bundle");
+    }
+
+}