From f0d4471454cf9861aab26a15edec60525c4c59e2 Mon Sep 17 00:00:00 2001 From: Michal Rehak Date: Thu, 26 Sep 2013 17:10:17 +0200 Subject: [PATCH] add bundle support for library fixing slf4j dependency, property added Change-Id: I6f4366eb4933494cdb4e049810b782e2916418ab Signed-off-by: Michal Rehak --- openflow-protocol-api/pom.xml | 1 + openflow-protocol-impl/pom.xml | 28 +++++++++++-- .../protocol/impl/connection/Activator.java | 40 +++++++++++++++++++ openflow-protocol-spi/pom.xml | 6 ++- pom.xml | 17 +++++++- 5 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/Activator.java diff --git a/openflow-protocol-api/pom.xml b/openflow-protocol-api/pom.xml index 2b8a65c1..fa09ec52 100644 --- a/openflow-protocol-api/pom.xml +++ b/openflow-protocol-api/pom.xml @@ -7,6 +7,7 @@ 0.1-SNAPSHOT openflow-protocol-api + bundle Openflow Protocol Library - API diff --git a/openflow-protocol-impl/pom.xml b/openflow-protocol-impl/pom.xml index 34b57ad4..dd363201 100644 --- a/openflow-protocol-impl/pom.xml +++ b/openflow-protocol-impl/pom.xml @@ -7,7 +7,24 @@ 0.1-SNAPSHOT openflow-protocol-impl - jar + bundle + Openflow Protocol Library - IMPL + + + + + org.apache.felix + maven-bundle-plugin + + + + org.opendaylight.openflowjava.protocol.impl.connection.Activator + + + + + + @@ -27,13 +44,18 @@ io.netty - netty-all + netty-handler 4.0.8.Final + + org.osgi + org.osgi.core + 5.0.0 + org.slf4j slf4j-log4j12 - 1.7.5 + ${slf4j.version} com.google.guava diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/Activator.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/Activator.java new file mode 100644 index 00000000..14067353 --- /dev/null +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/connection/Activator.java @@ -0,0 +1,40 @@ +/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */ +package org.opendaylight.openflowjava.protocol.impl.connection; + +import java.util.Hashtable; + +import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * Activate library bundle, expose provided implementations: + *
    + *
  • {@link SwitchConnectionProviderImpl}
  • + *
+ * + * @author mirehak + */ +public class Activator implements BundleActivator { + + private static final Logger LOG = LoggerFactory.getLogger(Activator.class); + + @Override + public void start(BundleContext context) throws Exception { + LOG.debug("starting OF Library"); + Hashtable props = new Hashtable(); + props.put("type", "default"); + context.registerService( + SwitchConnectionProvider.class.getName(), + new SwitchConnectionProviderImpl(), props); + } + + @Override + public void stop(BundleContext context) throws Exception { + LOG.debug("stopping OF Library"); + //TODO:: add teardown activities (check, if servers are running, stop if necessary..) + } +} diff --git a/openflow-protocol-spi/pom.xml b/openflow-protocol-spi/pom.xml index 78996e7c..e6cf8e4e 100644 --- a/openflow-protocol-spi/pom.xml +++ b/openflow-protocol-spi/pom.xml @@ -7,8 +7,10 @@ 0.1-SNAPSHOT openflow-protocol-spi - Openflow Protocol Library SPI - + bundle + + Openflow Protocol Library - SPI + ${project.groupId} diff --git a/pom.xml b/pom.xml index ff99572b..eb5c77f5 100644 --- a/pom.xml +++ b/pom.xml @@ -28,8 +28,9 @@ ${user.name}-private-view org.openflow.openflowj,net.sf.jung2 1.0.9 - 1.7.2 + 1.7.5 1.0-SNAPSHOT + 2.4.0
@@ -144,7 +145,7 @@ org.slf4j slf4j-api - 1.7.2 + ${slf4j.version} @@ -208,6 +209,18 @@ + + org.apache.felix + maven-bundle-plugin + ${maven.bundle.version} + true + + + ${project.groupId}.${project.artifactId} + + ${project.build.directory}/META-INF + + -- 2.36.6