You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/03/19 02:43:18 UTC

svn commit: r519788 - in /incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core: component/instancefactory/impl/ReflectiveIFProviderBuilder.java implementation/java/JavaPhysicalComponentBuilder.java

Author: jboynes
Date: Sun Mar 18 18:43:17 2007
New Revision: 519788

URL: http://svn.apache.org/viewvc?view=rev&rev=519788
Log:
cosmetic

Modified:
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/instancefactory/impl/ReflectiveIFProviderBuilder.java
    incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/instancefactory/impl/ReflectiveIFProviderBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/instancefactory/impl/ReflectiveIFProviderBuilder.java?view=diff&rev=519788&r1=519787&r2=519788
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/instancefactory/impl/ReflectiveIFProviderBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/component/instancefactory/impl/ReflectiveIFProviderBuilder.java Sun Mar 18 18:43:17 2007
@@ -59,9 +59,9 @@
 
             Constructor ctr = getConstructor(ifpd, cl, implClass);
 
-            Method initMethod = getInitMethod(ifpd, implClass);
+            Method initMethod = getCallBackMethod(implClass, ifpd.getInitMethod());
 
-            Method destroyMethod = getDestroyMethod(ifpd, implClass);
+            Method destroyMethod = getCallBackMethod(implClass, ifpd.getDestroyMethod());
 
             List<InjectionSource> ctrInjectSites = ifpd.getCdiSources();
 
@@ -115,28 +115,8 @@
         return injectionSites;
     }
 
-    /*
-     * Get destroy method.
-     */
-    private Method getDestroyMethod(ReflectiveIFProviderDefinition ifpd, Class implClass) throws NoSuchMethodException {
-        Method destroyMethod = null;
-        String destroyMethodName = ifpd.getDestroyMethod();
-        if (destroyMethod != null) {
-            destroyMethod = implClass.getDeclaredMethod(destroyMethodName);
-        }
-        return destroyMethod;
-    }
-
-    /*
-     * Get init method.
-     */
-    private Method getInitMethod(ReflectiveIFProviderDefinition ifpd, Class implClass) throws NoSuchMethodException {
-        Method initMethod = null;
-        String initMethodName = ifpd.getInitMethod();
-        if (initMethodName != null) {
-            initMethod = implClass.getDeclaredMethod(initMethodName);
-        }
-        return initMethod;
+    private Method getCallBackMethod(Class<?> implClass, String name) throws NoSuchMethodException {
+        return name == null ? null : implClass.getMethod(name);
     }
 
     /*
@@ -144,13 +124,12 @@
      */
     private Constructor getConstructor(ReflectiveIFProviderDefinition ifpd, ClassLoader cl, Class implClass)
         throws ClassNotFoundException, NoSuchMethodException {
-        Class[] ctrArgs = new Class[ifpd.getConstructorArguments().size()];
-        int i = 0;
-        for (String ctrArgClass : ifpd.getConstructorArguments()) {
-            ctrArgs[i++] = cl.loadClass(ctrArgClass);
+        List<String> argNames = ifpd.getConstructorArguments();
+        Class[] ctrArgs = new Class[argNames.size()];
+        for (int i = 0; i < ctrArgs.length; i++) {
+            ctrArgs[i++] = cl.loadClass(argNames.get(i));
         }
-        Constructor ctr = implClass.getDeclaredConstructor(ctrArgs);
-        return ctr;
+        return implClass.getDeclaredConstructor(ctrArgs);
     }
 
 }

Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java?view=diff&rev=519788&r1=519787&r2=519788
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaPhysicalComponentBuilder.java Sun Mar 18 18:43:17 2007
@@ -23,14 +23,13 @@
 import java.util.List;
 import java.util.Map;
 
+import org.osoa.sca.annotations.EagerInit;
 import org.osoa.sca.annotations.Reference;
 import org.osoa.sca.annotations.Service;
-import org.osoa.sca.annotations.EagerInit;
 
 import org.apache.tuscany.core.component.InstanceFactoryProvider;
 import org.apache.tuscany.core.component.instancefactory.IFProviderBuilderRegistry;
 import org.apache.tuscany.core.implementation.POJOPhysicalComponentBuilder;
-import org.apache.tuscany.core.implementation.system.component.SystemComponent;
 import org.apache.tuscany.core.injection.CallbackWireObjectFactory2;
 import org.apache.tuscany.core.injection.InstanceObjectFactory;
 import org.apache.tuscany.core.model.physical.instancefactory.InjectionSource;
@@ -50,9 +49,9 @@
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.component.ScopeContainer;
 import org.apache.tuscany.spi.component.ScopeRegistry;
-import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
-import org.apache.tuscany.spi.model.physical.InstanceFactoryProviderDefinition;
 import org.apache.tuscany.spi.model.Scope;
+import org.apache.tuscany.spi.model.physical.InstanceFactoryProviderDefinition;
+import org.apache.tuscany.spi.model.physical.PhysicalOperationDefinition;
 import org.apache.tuscany.spi.services.classloading.ClassLoaderRegistry;
 import org.apache.tuscany.spi.wire.InvocationChain;
 import org.apache.tuscany.spi.wire.ProxyService;



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