From 4e5f900eed31c3de0a9c599a206b6b3909697cc7 Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Tue, 22 Jan 2019 10:46:56 -0500 Subject: [PATCH] Move BP xml files to standard OSGI-INF/blueprint We originally used org/opendaylight/blueprint in case we needed to customize how BP bundles are processed but this wasn't needed. So let's move to the standard BP dir. We'll keep the BlueprintBundleTracker as is for backwards compatibility - the only change was to modify it to look in both dirs for BP xml files when restarting the container for a bundle. Change-Id: I777e831ef4d8293b49d7aa6c8cdecec96b97937f Signed-off-by: Tom Pantelis --- .../blueprint/dsbenchmark.xml | 0 .../blueprint/ntfbenchmark.xml | 0 .../blueprint/rpcbenchmark.xml | 0 .../config-netty/odl-config-netty/pom.xml | 5 +++ features/mdsal/odl-mdsal-broker-local/pom.xml | 6 --- .../blueprint/BlueprintBundleTracker.java | 14 +++++-- .../AutoCloseableEventExecutor.java | 39 +++++++------------ .../blueprint/netty-event-executor.xml | 4 +- .../config/netty-threadgroup-config/pom.xml | 15 ------- .../blueprint/netty-threadgroup.xml | 0 .../blueprint/netty-timer.xml | 0 .../blueprint/impl-blueprint.xml | 0 .../blueprint/impl-blueprint.xml | 0 .../blueprint/messagebus.xml | 0 .../blueprint/binding-broker.xml | 0 .../blueprint/cluster-admin.xml | 0 .../md-sal/sal-distributed-datastore/pom.xml | 4 -- .../blueprint/clustered-datastore.xml | 0 .../blueprint/dom-broker.xml | 0 .../blueprint/remote-rpc.xml | 0 .../blueprint/cluster-test-app.xml | 0 .../blueprint/toaster-consumer.xml | 0 .../blueprint/toaster-provider.xml | 0 23 files changed, 31 insertions(+), 56 deletions(-) rename benchmark/dsbenchmark/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/dsbenchmark.xml (100%) rename benchmark/ntfbenchmark/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/ntfbenchmark.xml (100%) rename benchmark/rpcbenchmark/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/rpcbenchmark.xml (100%) rename opendaylight/config/netty-event-executor-config/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/netty-event-executor.xml (77%) rename opendaylight/config/netty-threadgroup-config/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/netty-threadgroup.xml (100%) rename opendaylight/config/netty-timer-config/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/netty-timer.xml (100%) rename opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/impl-blueprint.xml (100%) rename opendaylight/md-sal/mdsal-trace/dom-impl/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/impl-blueprint.xml (100%) rename opendaylight/md-sal/messagebus-impl/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/messagebus.xml (100%) rename opendaylight/md-sal/sal-binding-broker/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/binding-broker.xml (100%) rename opendaylight/md-sal/sal-cluster-admin-impl/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/cluster-admin.xml (100%) rename opendaylight/md-sal/sal-distributed-datastore/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/clustered-datastore.xml (100%) rename opendaylight/md-sal/sal-dom-broker/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/dom-broker.xml (100%) rename opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/remote-rpc.xml (100%) rename opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/cluster-test-app.xml (100%) rename opendaylight/md-sal/samples/toaster-consumer/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/toaster-consumer.xml (100%) rename opendaylight/md-sal/samples/toaster-provider/src/main/resources/{org/opendaylight => OSGI-INF}/blueprint/toaster-provider.xml (100%) diff --git a/benchmark/dsbenchmark/src/main/resources/org/opendaylight/blueprint/dsbenchmark.xml b/benchmark/dsbenchmark/src/main/resources/OSGI-INF/blueprint/dsbenchmark.xml similarity index 100% rename from benchmark/dsbenchmark/src/main/resources/org/opendaylight/blueprint/dsbenchmark.xml rename to benchmark/dsbenchmark/src/main/resources/OSGI-INF/blueprint/dsbenchmark.xml diff --git a/benchmark/ntfbenchmark/src/main/resources/org/opendaylight/blueprint/ntfbenchmark.xml b/benchmark/ntfbenchmark/src/main/resources/OSGI-INF/blueprint/ntfbenchmark.xml similarity index 100% rename from benchmark/ntfbenchmark/src/main/resources/org/opendaylight/blueprint/ntfbenchmark.xml rename to benchmark/ntfbenchmark/src/main/resources/OSGI-INF/blueprint/ntfbenchmark.xml diff --git a/benchmark/rpcbenchmark/src/main/resources/org/opendaylight/blueprint/rpcbenchmark.xml b/benchmark/rpcbenchmark/src/main/resources/OSGI-INF/blueprint/rpcbenchmark.xml similarity index 100% rename from benchmark/rpcbenchmark/src/main/resources/org/opendaylight/blueprint/rpcbenchmark.xml rename to benchmark/rpcbenchmark/src/main/resources/OSGI-INF/blueprint/rpcbenchmark.xml diff --git a/features/config-netty/odl-config-netty/pom.xml b/features/config-netty/odl-config-netty/pom.xml index 6fca0dd432..98f5a7b1e8 100644 --- a/features/config-netty/odl-config-netty/pom.xml +++ b/features/config-netty/odl-config-netty/pom.xml @@ -68,6 +68,11 @@ ${project.groupId} threadpool-config-impl + + ${project.groupId} + blueprint + 0.10.0-SNAPSHOT + diff --git a/features/mdsal/odl-mdsal-broker-local/pom.xml b/features/mdsal/odl-mdsal-broker-local/pom.xml index 436764a3b7..afd5ca42a7 100644 --- a/features/mdsal/odl-mdsal-broker-local/pom.xml +++ b/features/mdsal/odl-mdsal-broker-local/pom.xml @@ -143,12 +143,6 @@ ${project.groupId} sal-inmemory-datastore - - - ${project.groupId} - blueprint - 0.10.0-SNAPSHOT - diff --git a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java index 3f821ba731..b79d3662f9 100644 --- a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java +++ b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java @@ -51,7 +51,8 @@ import org.slf4j.LoggerFactory; public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCustomizer, BlueprintListener, SynchronousBundleListener { private static final Logger LOG = LoggerFactory.getLogger(BlueprintBundleTracker.class); - private static final String BLUEPRINT_FILE_PATH = "org/opendaylight/blueprint/"; + private static final String ODL_CUSTOM_BLUEPRINT_FILE_PATH = "org/opendaylight/blueprint/"; + private static final String STANDARD_BLUEPRINT_FILE_PATH = "OSGI-INF/blueprint/"; private static final String BLUEPRINT_FLE_PATTERN = "*.xml"; private static final long SYSTEM_BUNDLE_ID = 0; @@ -211,7 +212,7 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus } if (bundle.getState() == Bundle.ACTIVE) { - List paths = findBlueprintPaths(bundle); + List paths = findBlueprintPaths(bundle, ODL_CUSTOM_BLUEPRINT_FILE_PATH); if (!paths.isEmpty()) { LOG.info("Creating blueprint container for bundle {} with paths {}", bundle, paths); @@ -258,9 +259,14 @@ public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCus } } - @SuppressWarnings({ "rawtypes", "unchecked" }) static List findBlueprintPaths(final Bundle bundle) { - Enumeration rntries = bundle.findEntries(BLUEPRINT_FILE_PATH, BLUEPRINT_FLE_PATTERN, false); + List paths = findBlueprintPaths(bundle, STANDARD_BLUEPRINT_FILE_PATH); + return !paths.isEmpty() ? paths : findBlueprintPaths(bundle, ODL_CUSTOM_BLUEPRINT_FILE_PATH); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private static List findBlueprintPaths(final Bundle bundle, final String path) { + Enumeration rntries = bundle.findEntries(path, BLUEPRINT_FLE_PATTERN, false); if (rntries == null) { return Collections.emptyList(); } else { diff --git a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java b/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java index d4e58db36a..7162eb6c25 100644 --- a/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java +++ b/opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java @@ -17,6 +17,13 @@ import java.util.concurrent.TimeUnit; public interface AutoCloseableEventExecutor extends EventExecutor, AutoCloseable { + static AutoCloseableEventExecutor globalEventExecutor() { + return CloseableEventExecutorMixin.createCloseableProxy(GlobalEventExecutor.INSTANCE); + } + + static AutoCloseableEventExecutor immediateEventExecutor() { + return CloseableEventExecutorMixin.createCloseableProxy(ImmediateEventExecutor.INSTANCE); + } class CloseableEventExecutorMixin implements AutoCloseable { public static final int DEFAULT_SHUTDOWN_SECONDS = 1; @@ -32,38 +39,20 @@ public interface AutoCloseableEventExecutor extends EventExecutor, AutoCloseable } - private static AutoCloseableEventExecutor createCloseableProxy( - final CloseableEventExecutorMixin closeableEventExecutorMixin) { + private static AutoCloseableEventExecutor createCloseableProxy(final EventExecutor eventExecutor) { + final CloseableEventExecutorMixin closeableEventExecutor = new CloseableEventExecutorMixin(eventExecutor); return Reflection.newProxy(AutoCloseableEventExecutor.class, new AbstractInvocationHandler() { @Override - protected Object handleInvocation(final Object proxy, final Method method, final Object[] args) throws Throwable { + protected Object handleInvocation(final Object proxy, final Method method, final Object[] args) + throws Throwable { if (method.getName().equals("close")) { - closeableEventExecutorMixin.close(); + closeableEventExecutor.close(); return null; } else { - return method.invoke(closeableEventExecutorMixin.eventExecutor, args); + return method.invoke(closeableEventExecutor.eventExecutor, args); } } }); } - - public static AutoCloseableEventExecutor globalEventExecutor() { - return createCloseableProxy(new CloseableEventExecutorMixin(GlobalEventExecutor.INSTANCE)); - } - - public static AutoCloseableEventExecutor immediateEventExecutor() { - return createCloseableProxy(new CloseableEventExecutorMixin(ImmediateEventExecutor.INSTANCE)); - } - - public static AutoCloseableEventExecutor forwardingEventExecutor(final EventExecutor eventExecutor, - final AutoCloseable closeable) { - return createCloseableProxy(new CloseableEventExecutorMixin(eventExecutor) { - @Override - public void close() throws Exception { - // Intentional no-op. - closeable.close(); - } - }); - } } -} \ No newline at end of file +} diff --git a/opendaylight/config/netty-event-executor-config/src/main/resources/org/opendaylight/blueprint/netty-event-executor.xml b/opendaylight/config/netty-event-executor-config/src/main/resources/OSGI-INF/blueprint/netty-event-executor.xml similarity index 77% rename from opendaylight/config/netty-event-executor-config/src/main/resources/org/opendaylight/blueprint/netty-event-executor.xml rename to opendaylight/config/netty-event-executor-config/src/main/resources/OSGI-INF/blueprint/netty-event-executor.xml index 66b22b52f8..0e845dfd8f 100644 --- a/opendaylight/config/netty-event-executor-config/src/main/resources/org/opendaylight/blueprint/netty-event-executor.xml +++ b/opendaylight/config/netty-event-executor-config/src/main/resources/OSGI-INF/blueprint/netty-event-executor.xml @@ -3,8 +3,8 @@ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"> - + diff --git a/opendaylight/config/netty-threadgroup-config/pom.xml b/opendaylight/config/netty-threadgroup-config/pom.xml index fd1f5167b6..c16dfd11cb 100644 --- a/opendaylight/config/netty-threadgroup-config/pom.xml +++ b/opendaylight/config/netty-threadgroup-config/pom.xml @@ -21,19 +21,4 @@ netty-config-api - - - - - org.apache.felix - maven-bundle-plugin - true - - - *,io.netty.channel - - - - - diff --git a/opendaylight/config/netty-threadgroup-config/src/main/resources/org/opendaylight/blueprint/netty-threadgroup.xml b/opendaylight/config/netty-threadgroup-config/src/main/resources/OSGI-INF/blueprint/netty-threadgroup.xml similarity index 100% rename from opendaylight/config/netty-threadgroup-config/src/main/resources/org/opendaylight/blueprint/netty-threadgroup.xml rename to opendaylight/config/netty-threadgroup-config/src/main/resources/OSGI-INF/blueprint/netty-threadgroup.xml diff --git a/opendaylight/config/netty-timer-config/src/main/resources/org/opendaylight/blueprint/netty-timer.xml b/opendaylight/config/netty-timer-config/src/main/resources/OSGI-INF/blueprint/netty-timer.xml similarity index 100% rename from opendaylight/config/netty-timer-config/src/main/resources/org/opendaylight/blueprint/netty-timer.xml rename to opendaylight/config/netty-timer-config/src/main/resources/OSGI-INF/blueprint/netty-timer.xml diff --git a/opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml similarity index 100% rename from opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml rename to opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml diff --git a/opendaylight/md-sal/mdsal-trace/dom-impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/opendaylight/md-sal/mdsal-trace/dom-impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml similarity index 100% rename from opendaylight/md-sal/mdsal-trace/dom-impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml rename to opendaylight/md-sal/mdsal-trace/dom-impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml diff --git a/opendaylight/md-sal/messagebus-impl/src/main/resources/org/opendaylight/blueprint/messagebus.xml b/opendaylight/md-sal/messagebus-impl/src/main/resources/OSGI-INF/blueprint/messagebus.xml similarity index 100% rename from opendaylight/md-sal/messagebus-impl/src/main/resources/org/opendaylight/blueprint/messagebus.xml rename to opendaylight/md-sal/messagebus-impl/src/main/resources/OSGI-INF/blueprint/messagebus.xml diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/resources/org/opendaylight/blueprint/binding-broker.xml b/opendaylight/md-sal/sal-binding-broker/src/main/resources/OSGI-INF/blueprint/binding-broker.xml similarity index 100% rename from opendaylight/md-sal/sal-binding-broker/src/main/resources/org/opendaylight/blueprint/binding-broker.xml rename to opendaylight/md-sal/sal-binding-broker/src/main/resources/OSGI-INF/blueprint/binding-broker.xml diff --git a/opendaylight/md-sal/sal-cluster-admin-impl/src/main/resources/org/opendaylight/blueprint/cluster-admin.xml b/opendaylight/md-sal/sal-cluster-admin-impl/src/main/resources/OSGI-INF/blueprint/cluster-admin.xml similarity index 100% rename from opendaylight/md-sal/sal-cluster-admin-impl/src/main/resources/org/opendaylight/blueprint/cluster-admin.xml rename to opendaylight/md-sal/sal-cluster-admin-impl/src/main/resources/OSGI-INF/blueprint/cluster-admin.xml diff --git a/opendaylight/md-sal/sal-distributed-datastore/pom.xml b/opendaylight/md-sal/sal-distributed-datastore/pom.xml index f4a1e37847..755c96c709 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/pom.xml +++ b/opendaylight/md-sal/sal-distributed-datastore/pom.xml @@ -240,10 +240,6 @@ org.opendaylight.controller.cluster.sharding; org.opendaylight.controller.cluster.databroker.actors.dds; - - *; - org.opendaylight.controller.md.sal.dom.broker.impl.jmx - diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/org/opendaylight/blueprint/clustered-datastore.xml b/opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml similarity index 100% rename from opendaylight/md-sal/sal-distributed-datastore/src/main/resources/org/opendaylight/blueprint/clustered-datastore.xml rename to opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/resources/org/opendaylight/blueprint/dom-broker.xml b/opendaylight/md-sal/sal-dom-broker/src/main/resources/OSGI-INF/blueprint/dom-broker.xml similarity index 100% rename from opendaylight/md-sal/sal-dom-broker/src/main/resources/org/opendaylight/blueprint/dom-broker.xml rename to opendaylight/md-sal/sal-dom-broker/src/main/resources/OSGI-INF/blueprint/dom-broker.xml diff --git a/opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/org/opendaylight/blueprint/remote-rpc.xml b/opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/OSGI-INF/blueprint/remote-rpc.xml similarity index 100% rename from opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/org/opendaylight/blueprint/remote-rpc.xml rename to opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/OSGI-INF/blueprint/remote-rpc.xml diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/org/opendaylight/blueprint/cluster-test-app.xml b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/OSGI-INF/blueprint/cluster-test-app.xml similarity index 100% rename from opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/org/opendaylight/blueprint/cluster-test-app.xml rename to opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/OSGI-INF/blueprint/cluster-test-app.xml diff --git a/opendaylight/md-sal/samples/toaster-consumer/src/main/resources/org/opendaylight/blueprint/toaster-consumer.xml b/opendaylight/md-sal/samples/toaster-consumer/src/main/resources/OSGI-INF/blueprint/toaster-consumer.xml similarity index 100% rename from opendaylight/md-sal/samples/toaster-consumer/src/main/resources/org/opendaylight/blueprint/toaster-consumer.xml rename to opendaylight/md-sal/samples/toaster-consumer/src/main/resources/OSGI-INF/blueprint/toaster-consumer.xml diff --git a/opendaylight/md-sal/samples/toaster-provider/src/main/resources/org/opendaylight/blueprint/toaster-provider.xml b/opendaylight/md-sal/samples/toaster-provider/src/main/resources/OSGI-INF/blueprint/toaster-provider.xml similarity index 100% rename from opendaylight/md-sal/samples/toaster-provider/src/main/resources/org/opendaylight/blueprint/toaster-provider.xml rename to opendaylight/md-sal/samples/toaster-provider/src/main/resources/OSGI-INF/blueprint/toaster-provider.xml -- 2.36.6