Splitted the OSGi bundle creation from the broker jar to let the broker be executable also outside of a container

This commit is contained in:
selva.andre
2014-02-08 17:59:36 +01:00
parent a1448597af
commit 95d276f7a0
6 changed files with 256 additions and 16 deletions
+16 -16
View File
@@ -11,7 +11,7 @@
</parent>
<artifactId>moquette-broker</artifactId>
<packaging>bundle</packaging>
<packaging>jar</packaging>
<!--<version>${moquette-version}</version>-->
<name>Moquette - broker</name>
@@ -43,14 +43,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
@@ -76,35 +76,35 @@
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.0.8.Final</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.0.8.Final</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.0.8.Final</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.0.8.Final</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.0.8.Final</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
@@ -118,7 +118,7 @@
<groupId>org.fusesource.hawtdb</groupId>
<artifactId>hawtdb</artifactId>
<version>1.6</version>
<scope>provided</scope>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
@@ -172,7 +172,7 @@
</configuration>
</plugin>
<plugin>
<!-- <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
@@ -196,21 +196,21 @@
</configuration>
</plugin>
<plugin>
<!-- Pax Runner Maven plugin -->
Pax Runner Maven plugin
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.4</version>
<configuration>
<!-- Pax Runner version -->
Pax Runner version
<runner>1.4.0</runner>
<!-- OSGi framework type (equinox, felix, knopflerfish) -->
OSGi framework type (equinox, felix, knopflerfish)
<framework>equinox</framework>
<provision>
<!-- <param> - -log=debug</param>
<param> - -workingDirectory=target/runner</param> -->
<param> - -log=debug</param>
<param> - -workingDirectory=target/runner</param>
</provision>
</configuration>
</plugin>
</plugin>-->
</plugins>
</build>
@@ -1,30 +0,0 @@
package org.dna.mqtt.moquette.bundle;
import org.dna.mqtt.moquette.server.Server;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Start and stop a configured version of the MQTT broker server.
*
* @author Didier Donsez
* @todo add config admin for port (in NettyAcceptor)
*/
public class Activator implements BundleActivator {
private static final Logger LOG = LoggerFactory.getLogger(Server.class);
private Server server = null;
public void start(BundleContext bundleContext) throws Exception {
server = new Server();
server.startServer();
LOG.info("Moquette MQTT broker started, version 0.5-SNAPSHOT");
}
public void stop(BundleContext bundleContext) throws Exception {
server.stopServer();
LOG.info("Moquette MQTT broker stopped, version 0.5-SNAPSHOT");
}
}