Move BP xml files to standard OSGI-INF/blueprint 49/75549/7
authorTom Pantelis <tompantelis@gmail.com>
Tue, 22 Jan 2019 15:46:56 +0000 (10:46 -0500)
committerRobert Varga <nite@hq.sk>
Wed, 23 Jan 2019 12:20:39 +0000 (12:20 +0000)
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 <tompantelis@gmail.com>
23 files changed:
benchmark/dsbenchmark/src/main/resources/OSGI-INF/blueprint/dsbenchmark.xml [moved from benchmark/dsbenchmark/src/main/resources/org/opendaylight/blueprint/dsbenchmark.xml with 100% similarity]
benchmark/ntfbenchmark/src/main/resources/OSGI-INF/blueprint/ntfbenchmark.xml [moved from benchmark/ntfbenchmark/src/main/resources/org/opendaylight/blueprint/ntfbenchmark.xml with 100% similarity]
benchmark/rpcbenchmark/src/main/resources/OSGI-INF/blueprint/rpcbenchmark.xml [moved from benchmark/rpcbenchmark/src/main/resources/org/opendaylight/blueprint/rpcbenchmark.xml with 100% similarity]
features/config-netty/odl-config-netty/pom.xml
features/mdsal/odl-mdsal-broker-local/pom.xml
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/BlueprintBundleTracker.java
opendaylight/config/netty-event-executor-config/src/main/java/org/opendaylight/controller/config/yang/netty/eventexecutor/AutoCloseableEventExecutor.java
opendaylight/config/netty-event-executor-config/src/main/resources/OSGI-INF/blueprint/netty-event-executor.xml [moved from opendaylight/config/netty-event-executor-config/src/main/resources/org/opendaylight/blueprint/netty-event-executor.xml with 77% similarity]
opendaylight/config/netty-threadgroup-config/pom.xml
opendaylight/config/netty-threadgroup-config/src/main/resources/OSGI-INF/blueprint/netty-threadgroup.xml [moved from opendaylight/config/netty-threadgroup-config/src/main/resources/org/opendaylight/blueprint/netty-threadgroup.xml with 100% similarity]
opendaylight/config/netty-timer-config/src/main/resources/OSGI-INF/blueprint/netty-timer.xml [moved from opendaylight/config/netty-timer-config/src/main/resources/org/opendaylight/blueprint/netty-timer.xml with 100% similarity]
opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml [moved from opendaylight/md-sal/mdsal-trace/binding-impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml with 100% similarity]
opendaylight/md-sal/mdsal-trace/dom-impl/src/main/resources/OSGI-INF/blueprint/impl-blueprint.xml [moved from opendaylight/md-sal/mdsal-trace/dom-impl/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml with 100% similarity]
opendaylight/md-sal/messagebus-impl/src/main/resources/OSGI-INF/blueprint/messagebus.xml [moved from opendaylight/md-sal/messagebus-impl/src/main/resources/org/opendaylight/blueprint/messagebus.xml with 100% similarity]
opendaylight/md-sal/sal-binding-broker/src/main/resources/OSGI-INF/blueprint/binding-broker.xml [moved from opendaylight/md-sal/sal-binding-broker/src/main/resources/org/opendaylight/blueprint/binding-broker.xml with 100% similarity]
opendaylight/md-sal/sal-cluster-admin-impl/src/main/resources/OSGI-INF/blueprint/cluster-admin.xml [moved from opendaylight/md-sal/sal-cluster-admin-impl/src/main/resources/org/opendaylight/blueprint/cluster-admin.xml with 100% similarity]
opendaylight/md-sal/sal-distributed-datastore/pom.xml
opendaylight/md-sal/sal-distributed-datastore/src/main/resources/OSGI-INF/blueprint/clustered-datastore.xml [moved from opendaylight/md-sal/sal-distributed-datastore/src/main/resources/org/opendaylight/blueprint/clustered-datastore.xml with 100% similarity]
opendaylight/md-sal/sal-dom-broker/src/main/resources/OSGI-INF/blueprint/dom-broker.xml [moved from opendaylight/md-sal/sal-dom-broker/src/main/resources/org/opendaylight/blueprint/dom-broker.xml with 100% similarity]
opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/OSGI-INF/blueprint/remote-rpc.xml [moved from opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/org/opendaylight/blueprint/remote-rpc.xml with 100% similarity]
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/OSGI-INF/blueprint/cluster-test-app.xml [moved from opendaylight/md-sal/samples/clustering-test-app/provider/src/main/resources/org/opendaylight/blueprint/cluster-test-app.xml with 100% similarity]
opendaylight/md-sal/samples/toaster-consumer/src/main/resources/OSGI-INF/blueprint/toaster-consumer.xml [moved from opendaylight/md-sal/samples/toaster-consumer/src/main/resources/org/opendaylight/blueprint/toaster-consumer.xml with 100% similarity]
opendaylight/md-sal/samples/toaster-provider/src/main/resources/OSGI-INF/blueprint/toaster-provider.xml [moved from opendaylight/md-sal/samples/toaster-provider/src/main/resources/org/opendaylight/blueprint/toaster-provider.xml with 100% similarity]

index 6fca0dd4324d4d89619f61b44a5cc7d7db8b244e..98f5a7b1e850a35f4f42d823f8b4928171592351 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>threadpool-config-impl</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>blueprint</artifactId>
+            <version>0.10.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
 </project>
index 436764a3b7264c60e75f5d2e45e96c9b11621c14..afd5ca42a79a35f85c6f10956fdacc4eb9e7c5db 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>sal-inmemory-datastore</artifactId>
         </dependency>
-        <dependency>
-            <!-- TODO start-level="40" -->
-            <groupId>${project.groupId}</groupId>
-            <artifactId>blueprint</artifactId>
-            <version>0.10.0-SNAPSHOT</version>
-        </dependency>
     </dependencies>
 
 </project>
index 3f821ba731ac44e51dd380bb59fe0687b88f320d..b79d3662f966b36aca51fd6fee3ba106cb951bd4 100644 (file)
@@ -51,7 +51,8 @@ import org.slf4j.LoggerFactory;
 public class BlueprintBundleTracker implements BundleActivator, BundleTrackerCustomizer<Bundle>, 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<Object> paths = findBlueprintPaths(bundle);
+            List<Object> 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<Object> findBlueprintPaths(final Bundle bundle) {
-        Enumeration<?> rntries = bundle.findEntries(BLUEPRINT_FILE_PATH, BLUEPRINT_FLE_PATTERN, false);
+        List<Object> paths = findBlueprintPaths(bundle, STANDARD_BLUEPRINT_FILE_PATH);
+        return !paths.isEmpty() ? paths : findBlueprintPaths(bundle, ODL_CUSTOM_BLUEPRINT_FILE_PATH);
+    }
+
+    @SuppressWarnings({ "rawtypes", "unchecked" })
+    private static List<Object> findBlueprintPaths(final Bundle bundle, final String path) {
+        Enumeration<?> rntries = bundle.findEntries(path, BLUEPRINT_FLE_PATTERN, false);
         if (rntries == null) {
             return Collections.emptyList();
         } else {
index d4e58db36a1b98d1c0cc7ab9f91f85591911be46..7162eb6c2536e620c5bbe9d023eabf262756800a 100644 (file)
@@ -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
+}
@@ -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">
 
-  <bean id="executor" class="org.opendaylight.controller.config.yang.netty.eventexecutor.AutoCloseableEventExecutor.CloseableEventExecutorMixin"
-          factory-method="globalEventExecutor"/>
+  <bean id="executor" class="org.opendaylight.controller.config.yang.netty.eventexecutor.AutoCloseableEventExecutor"
+          factory-method="globalEventExecutor" destroy-method="close"/>
 
   <service ref="executor" interface="io.netty.util.concurrent.EventExecutor"
         odl:type="global-event-executor"/>
index fd1f5167b6265a691d78d9bc63c31f1bf6659d2d..c16dfd11cb016a0355cefeb95fbe7ebf6b2f2765 100644 (file)
       <artifactId>netty-config-api</artifactId>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Import-Package>*,io.netty.channel</Import-Package>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 </project>
index f4a1e37847bca902ccbae59d2442c8fe50033e28..755c96c70959b87111a35bc68694ab1f5c72b32d 100644 (file)
                 org.opendaylight.controller.cluster.sharding;
                 org.opendaylight.controller.cluster.databroker.actors.dds;
             </Export-Package>
-            <Import-Package>
-                *;
-                org.opendaylight.controller.md.sal.dom.broker.impl.jmx
-            </Import-Package>
           </instructions>
         </configuration>
       </plugin>