Now the component provides read-only access to the interfaces.
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Thu, 5 Jun 2008 20:47:50 +0000 (20:47 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Thu, 5 Jun 2008 20:47:50 +0000 (20:47 +0000)
system/spring/src/main/java/org/wamblee/system/spring/RequiredServiceBean.java
system/spring/src/main/java/org/wamblee/system/spring/SpringComponent.java
system/spring/src/test/java/org/wamblee/system/spring/SpringComponentTest.java

index 2e72f733825556002864917afda508e8acdf0e52..abd5115ea68ab78384175e974280d43fa606fdee 100644 (file)
@@ -18,6 +18,7 @@ package org.wamblee.system.spring;
 import org.springframework.beans.factory.FactoryBean;
 import org.wamblee.system.core.ProvidedInterface;
 import org.wamblee.system.core.RequiredInterface;
+import org.wamblee.system.core.RequiredInterfaces;
 import org.wamblee.system.core.SystemAssemblyException;
 
 /**
@@ -35,7 +36,7 @@ class RequiredServiceBean implements FactoryBean {
         * @param aId Id of the bean in the service registry.  
         */
        public RequiredServiceBean(String aId) { 
-               RequiredInterface[] required = SpringComponent.THIS.get().getRequiredInterfaces();
+               RequiredInterfaces required = SpringComponent.THIS.get().getRequiredInterfaces();
                for ( RequiredInterface intf: required) { 
                        if ( intf.getName().equals(aId)) { 
                                _required = intf; 
index 83a5133bd74122ef48213941ddffcd9ce6137f6b..c1e3a7b302f9098858cc468886b48e1f256bc3cb 100644 (file)
@@ -113,7 +113,7 @@ public class SpringComponent extends AbstractComponent<Scope> {
                SpringComponent old = THIS.get();
                Scope oldScope = SCOPE.get();
                THIS.set(this);
-               Scope scope = new DefaultScope(getProvidedInterfaces(), aExternalScope);
+               Scope scope = new DefaultScope(getProvidedInterfaces().toArray(), aExternalScope);
                SCOPE.set(scope);
                try {
                        GenericApplicationContext parentContext = new GenericApplicationContext();
index 10e2ca8eb8a277b3319c9b712b48b53f3ac9a2d9..67ed048df8f19dbaed681191c855686d785486ac 100644 (file)
@@ -158,7 +158,7 @@ public class SpringComponentTest extends TestCase {
                 HelloService.class);
         Scope scope = new DefaultScope(new ProvidedInterface[] { helloService });
         scope.publishInterface(helloService, helloObject);
-        system.getRequiredInterfaces()[0].setProvider(helloService);
+        system.getRequiredInterfaces().get(0).setProvider(helloService);
 
         Scope runtime = system.start(scope);
         system.stop(runtime);
@@ -181,7 +181,7 @@ public class SpringComponentTest extends TestCase {
                 HelloService.class);
         Scope scope = new DefaultScope(new ProvidedInterface[] { helloService });
         scope.publishInterface(helloService, helloObject);
-        system.getRequiredInterfaces()[0].setProvider(helloService);
+        system.getRequiredInterfaces().get(0).setProvider(helloService);
         Scope runtime = system.start(scope);
         ProvidedInterface started = runtime.getProvidedInterfaces()[0];
 
@@ -222,7 +222,7 @@ public class SpringComponentTest extends TestCase {
         assertSame(service, service2);
 
         Object floatsvc = _externalScope.getInterfaceImplementation(system
-                .getProvidedInterfaces()[1], Object.class);
+                .getProvidedInterfaces().get(1), Object.class);
         assertTrue(floatsvc instanceof Float);
         assertTrue((((Float) floatsvc).floatValue() - 100.345f) < 0.00001);
 
@@ -251,8 +251,8 @@ public class SpringComponentTest extends TestCase {
         Scope scope = new DefaultScope(new ProvidedInterface[] { helloService });
         scope.publishInterface(helloService, helloObject);
         scope.publishInterface(floatService, 100.234f);
-        system.getRequiredInterfaces()[0].setProvider(helloService);
-        system.getRequiredInterfaces()[1].setProvider(floatService);
+        system.getRequiredInterfaces().get(0).setProvider(helloService);
+        system.getRequiredInterfaces().get(1).setProvider(floatService);
 
         Scope runtime = system.start(scope);
         system.stop(runtime);