tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r443344 - in /incubator/tuscany/sandbox/ant/container.easy/src: main/java/org/apache/tuscany/container/easy/ test/java/org/apache/tuscany/container/easy/ test/java/org/apache/tuscany/container/easy/mock/
Date Thu, 14 Sep 2006 13:33:47 GMT
Author: antelder
Date: Thu Sep 14 06:33:46 2006
New Revision: 443344

URL: http://svn.apache.org/viewvc?view=rev&rev=443344
Log:
temporarily add service interface classes to the createInstance method. Until what to do with
the response type is sorted out

Modified:
    incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyComponent.java
    incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyInstanceFactory.java
    incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/EasyInstanceFactoryTestCase.java
    incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/mock/MockInstanceFactory.java

Modified: incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyComponent.java?view=diff&rev=443344&r1=443343&r2=443344
==============================================================================
--- incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyComponent.java
(original)
+++ incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyComponent.java
Thu Sep 14 06:33:46 2006
@@ -71,7 +71,7 @@
             }
         }
 
-        return instanceFactory.createInstance(context);
+        return instanceFactory.createInstance(services, context);
     }
 
     public TargetInvoker createTargetInvoker(String targetName, Operation operation) {

Modified: incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyInstanceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyInstanceFactory.java?view=diff&rev=443344&r1=443343&r2=443344
==============================================================================
--- incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyInstanceFactory.java
(original)
+++ incubator/tuscany/sandbox/ant/container.easy/src/main/java/org/apache/tuscany/container/easy/EasyInstanceFactory.java
Thu Sep 14 06:33:46 2006
@@ -18,6 +18,9 @@
  */
 package org.apache.tuscany.container.easy;
 
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -36,12 +39,14 @@
 
     /**
      * Create a new invokeable instance of the script
+     * @param services 
      * 
      * @param context
      *            objects to add to scope of the script instance
      * @return a RhinoScriptInstance
+     * TODO: services should be on the constructor not on this method
      */
-    public abstract T createInstance(Map<String, Object> context);
+    public abstract T createInstance(List<Class> services, Map<String, Object>
context);
 
     public String getResourceName() {
         return resourceName;
@@ -50,4 +55,17 @@
     public ClassLoader getClassLoader() {
         return classLoader;
     }
+
+    protected Map<String, Class> getResponseClasses(List<Class> services) {
+        Map<String, Class> responseClasses = new HashMap<String, Class>();
+        if (services != null) {
+            for (Class s : services) {
+                for (Method m : s.getMethods()) {
+                    responseClasses.put(m.getName(), m.getReturnType());
+                }
+            }
+        }
+        return responseClasses;
+    }
+
 }

Modified: incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/EasyInstanceFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/EasyInstanceFactoryTestCase.java?view=diff&rev=443344&r1=443343&r2=443344
==============================================================================
--- incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/EasyInstanceFactoryTestCase.java
(original)
+++ incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/EasyInstanceFactoryTestCase.java
Thu Sep 14 06:33:46 2006
@@ -14,7 +14,7 @@
         MockInstanceFactory factory = new MockInstanceFactory("foo.mock", getClass().getClassLoader());
         Map<String, Object> context = new HashMap<String, Object>();
         context.put("foo", "bar");
-        EasyInstance instance = factory.createInstance(context);
+        EasyInstance instance = factory.createInstance(null, context);
         assertNotNull(instance);
     }
 
@@ -22,7 +22,7 @@
         MockInstanceFactory factory = new MockInstanceFactory("foo.mock", getClass().getClassLoader());
         Map<String, Object> context = new HashMap<String, Object>();
         context.put("foo", "bar");
-        EasyInstance instance = factory.createInstance(context);
+        EasyInstance instance = factory.createInstance(null, context);
         assertNotNull(instance);
     }
 
@@ -30,7 +30,7 @@
         MockInstanceFactory factory = new MockInstanceFactory("foo.mock", getClass().getClassLoader());
         Map<String, Object> context = new HashMap<String, Object>();
         context.put("foo", "bar");
-        EasyInstance instance = factory.createInstance(context);
+        EasyInstance instance = factory.createInstance(null, context);
         assertNotNull(instance);
     }
 

Modified: incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/mock/MockInstanceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/mock/MockInstanceFactory.java?view=diff&rev=443344&r1=443343&r2=443344
==============================================================================
--- incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/mock/MockInstanceFactory.java
(original)
+++ incubator/tuscany/sandbox/ant/container.easy/src/test/java/org/apache/tuscany/container/easy/mock/MockInstanceFactory.java
Thu Sep 14 06:33:46 2006
@@ -1,6 +1,7 @@
 package org.apache.tuscany.container.easy.mock;
 
 import java.lang.reflect.InvocationTargetException;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.tuscany.container.easy.EasyInstance;
@@ -13,8 +14,7 @@
     }
 
     @Override
-    public MockInstance createInstance(Map<String, Object> context) {
-        // TODO Auto-generated method stub
+    public MockInstance createInstance(List<Class> services, Map<String, Object>
context) {
         return new MockInstance();
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message