diff --git a/helloworld-osgi-example/README.md b/helloworld-osgi-example/README.md new file mode 100644 index 0000000..aac1de1 --- /dev/null +++ b/helloworld-osgi-example/README.md @@ -0,0 +1,13 @@ +# helloworld-osgi-example + +``` +mvn install +``` + +![](src/main/resources/osgi-helloworld.jpg) + +# 参考文章 + +[http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html](http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html) + +[https://docs.jboss.org/author/display/AS7/The+helloworld-osgi+example+in+depth](https://docs.jboss.org/author/display/AS7/The+helloworld-osgi+example+in+depth) \ No newline at end of file diff --git a/helloworld-osgi-example/pom.xml b/helloworld-osgi-example/pom.xml new file mode 100644 index 0000000..bbf279d --- /dev/null +++ b/helloworld-osgi-example/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + + net.aimeizi + maven-framework-project + 1.0.0 + + + helloworld-osgi-example + bundle + + + UTF-8 + + + + + org.osgi + org.osgi.core + 4.2.0 + provided + + + + + + + + org.apache.felix + maven-bundle-plugin + 2.5.0 + true + + + + + ${project.artifactId} + + + net.aimeizi.osgi.helloworld.example.Activator + + + * + + + + + + net.aimeizi.osgi.helloworld.example + + + + + + + org.jboss.as.plugins + jboss-as-maven-plugin + 7.5.Final + + ${project.build.finalName}.jar + + + + + + \ No newline at end of file diff --git a/helloworld-osgi-example/src/main/java/net/aimeizi/osgi/helloworld/example/Activator.java b/helloworld-osgi-example/src/main/java/net/aimeizi/osgi/helloworld/example/Activator.java new file mode 100644 index 0000000..91c7b78 --- /dev/null +++ b/helloworld-osgi-example/src/main/java/net/aimeizi/osgi/helloworld/example/Activator.java @@ -0,0 +1,18 @@ +package net.aimeizi.osgi.helloworld.example; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +public class Activator implements BundleActivator{ + + @Override + public void start(BundleContext context) throws Exception { + System.out.println("Hello OSGI!"); + } + + @Override + public void stop(BundleContext context) throws Exception { + System.out.println("Bye OSGI!"); + } + +} diff --git a/helloworld-osgi-example/src/main/resources/osgi-helloworld.jpg b/helloworld-osgi-example/src/main/resources/osgi-helloworld.jpg new file mode 100644 index 0000000..5850ecb Binary files /dev/null and b/helloworld-osgi-example/src/main/resources/osgi-helloworld.jpg differ