(no commit message)
[utils] / system / general / src / main / java / org / wamblee / system / container / Container.java
index fe744f74c8be805d95842588e173b724a7091e22..60456c5e4cdb98f84b74ab811eeab0c96cac53bf 100644 (file)
@@ -16,6 +16,7 @@
 package org.wamblee.system.container;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -63,7 +64,7 @@ public class Container extends AbstractComponent<Scope> {
      *            Required services by the container.
      */
     public Container(String aName, Component[] aComponents,
-            ProvidedInterface[] aProvided, RequiredInterface[] aRequired) {
+            List<ProvidedInterface> aProvided, List<RequiredInterface> aRequired) {
         super(aName, aProvided, aRequired);
         _components = new ArrayList<Component>();
 
@@ -74,6 +75,23 @@ public class Container extends AbstractComponent<Scope> {
             addComponent(component);
         }
     }
+    
+    /**
+     * Constructs the container
+     * 
+     * @param aName
+     *            Name of the container
+     * @param aComponents
+     *            Components.
+     * @param aProvided
+     *            Provided services of the container
+     * @param aRequired
+     *            Required services by the container.
+     */
+    public Container(String aName, Component[] aComponents,
+            ProvidedInterface[] aProvided, RequiredInterface[] aRequired) {
+        this(aName, aComponents, Arrays.asList(aProvided), Arrays.asList(aRequired));
+    }
 
     public Container(String aName) {
         this(aName, new Component[0], new ProvidedInterface[0],
@@ -194,7 +212,7 @@ public class Container extends AbstractComponent<Scope> {
      * @return Scope.
      */
     public Scope start() {
-        Scope scope = new DefaultScope(getProvidedInterfaces().toArray());
+        Scope scope = new DefaultScope(getProvidedInterfaces());
         return super.start(scope);
     }
 
@@ -202,7 +220,7 @@ public class Container extends AbstractComponent<Scope> {
     protected Scope doStart(Scope aExternalScope) {
         checkSealed();
         validate();
-        Scope scope = new DefaultScope(getProvidedInterfaces().toArray(), aExternalScope);
+        Scope scope = new DefaultScope(getProvidedInterfaces().toArray(new ProvidedInterface[0]), aExternalScope);
         ComponentGraph graph = doStartOptionalDryRun(scope, false);
         exposeProvidedInterfaces(graph, aExternalScope, scope);
         seal();