UI-Lion: start integration of LionBundles into UiExtension.

Change-Id: I5c693f7f218fcd4fecbc34e2a18ef3ee29ed1e45
diff --git a/core/api/src/main/java/org/onosproject/ui/UiExtension.java b/core/api/src/main/java/org/onosproject/ui/UiExtension.java
index 9edcba9a..5255fa0 100644
--- a/core/api/src/main/java/org/onosproject/ui/UiExtension.java
+++ b/core/api/src/main/java/org/onosproject/ui/UiExtension.java
@@ -16,6 +16,7 @@
 package org.onosproject.ui;
 
 import com.google.common.collect.ImmutableList;
+import org.onosproject.ui.lion.LionBundle;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,6 +46,7 @@
     private final ClassLoader classLoader;
     private final String resourcePath;
     private final List<UiView> viewList;
+    private final List<LionBundle> lionBundles;
     private final UiMessageHandlerFactory messageHandlerFactory;
     private final UiTopoOverlayFactory topoOverlayFactory;
     private final UiTopo2OverlayFactory topo2OverlayFactory;
@@ -54,6 +56,7 @@
 
     // private constructor - only the builder calls this
     private UiExtension(ClassLoader cl, String path, List<UiView> views,
+                        List<LionBundle> bundles,
                         UiMessageHandlerFactory mhFactory,
                         UiTopoOverlayFactory toFactory,
                         UiTopo2OverlayFactory to2Factory,
@@ -61,6 +64,7 @@
         classLoader = cl;
         resourcePath = path;
         viewList = views;
+        lionBundles = bundles;
         messageHandlerFactory = mhFactory;
         topoOverlayFactory = toFactory;
         topo2OverlayFactory = to2Factory;
@@ -96,6 +100,16 @@
     }
 
     /**
+     * Returns the list of localization bundles that this extension is
+     * contributing.
+     *
+     * @return contributed localization bundles
+     */
+    public List<LionBundle> lionBundles() {
+        return ImmutableList.copyOf(lionBundles);
+    }
+
+    /**
      * Returns input stream containing specified view-specific resource.
      *
      * @param viewId view identifier
@@ -162,6 +176,7 @@
 
         private String resourcePath = EMPTY;
         private List<UiView> viewList = new ArrayList<>();
+        private List<LionBundle> lionBundles = new ArrayList<>();
         private UiMessageHandlerFactory messageHandlerFactory = null;
         private UiTopoOverlayFactory topoOverlayFactory = null;
         private UiTopo2OverlayFactory topo2OverlayFactory = null;
@@ -184,6 +199,19 @@
         }
 
         /**
+         * Sets the localization bundles (aka {@code LionBundle}s) that this
+         * UI extension is contributing.
+         *
+         * @param bundles the bundles to register
+         * @return self, for chaining
+         */
+        public Builder lionBundles(List<LionBundle> bundles) {
+            checkNotNull(bundles, "Must provide a list");
+            lionBundles = bundles;
+            return this;
+        }
+
+        /**
          * Set the resource path. That is, the path to where the CSS and JS
          * files are located.
          *
@@ -246,6 +274,7 @@
          */
         public UiExtension build() {
             return new UiExtension(classLoader, resourcePath, viewList,
+                                   lionBundles,
                                    messageHandlerFactory, topoOverlayFactory,
                                    topo2OverlayFactory, topoMapFactory);
         }