geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r721443 - in /geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany: SCAServiceReference.java TuscanyModuleBuilderExtension.java
Date Fri, 28 Nov 2008 12:01:56 GMT
Author: vamsic007
Date: Fri Nov 28 04:01:55 2008
New Revision: 721443

URL: http://svn.apache.org/viewvc?rev=721443&view=rev
Log:
Changed to use class instead of classname.

Modified:
    geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/SCAServiceReference.java
    geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java

Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/SCAServiceReference.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/SCAServiceReference.java?rev=721443&r1=721442&r2=721443&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/SCAServiceReference.java
(original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/SCAServiceReference.java
Fri Nov 28 04:01:55 2008
@@ -34,12 +34,12 @@
  */
 public class SCAServiceReference extends SimpleReference {
     private String componentName;
-    private String interfaceName;
+    private Class serviceInterface;
     private String referenceName;
     private boolean required;
     
-    public SCAServiceReference(String interfaceName, String componentName, String referenceName,
boolean required) {
-        this.interfaceName = interfaceName;
+    public SCAServiceReference(Class serviceInterface, String componentName, String referenceName,
boolean required) {
+        this.serviceInterface = serviceInterface;
         this.componentName = componentName;
         this.referenceName = referenceName;
         this.required = required;
@@ -50,27 +50,20 @@
         InitialContext ctx = new InitialContext();
         SCADomain domain = (SCADomain) ctx.lookup("ger:/SCADomain");
         ComponentContext componentContext = null;
-        try {
-            Class referenceInterface = Thread.currentThread().getContextClassLoader().loadClass(interfaceName);
-            for(Component component : ((org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain)domain).getDomainComposite().getComponents())
{
-                if(component.getName().equals(componentName)) {
-                    componentContext = ((RuntimeComponent)component).getComponentContext();
-                }
+        for(Component component : ((org.apache.tuscany.sca.host.embedded.impl.EmbeddedSCADomain)domain).getDomainComposite().getComponents())
{
+            if(component.getName().equals(componentName)) {
+                componentContext = ((RuntimeComponent)component).getComponentContext();
             }
-            
-            try {
-                return componentContext.getService(referenceInterface, referenceName);
-            } catch(ServiceRuntimeException e) {
-                if(!required && e.getMessage().startsWith("Reference not found"))
{
-                    return null;
-                } else {
-                    throw e;
-                }
+        }
+        
+        try {
+            return componentContext.getService(serviceInterface, referenceName);
+        } catch(ServiceRuntimeException e) {
+            if(!required && e.getMessage().startsWith("Reference not found")) {
+                return null;
+            } else {
+                throw e;
             }
-        } catch (ClassNotFoundException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
         }
-        return null;
     }
 }

Modified: geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java?rev=721443&r1=721442&r2=721443&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
(original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany/src/main/java/org/apache/geronimo/tuscany/TuscanyModuleBuilderExtension.java
Fri Nov 28 04:01:55 2008
@@ -207,7 +207,7 @@
                         Reference ref = field.getAnnotation(Reference.class);
                         String referenceName = ref.name() != null && !ref.name().equals("")
? ref.name() : field.getName();
                         holder.addInjection(servletClassName, new Injection(servletClassName,
field.getName(), servletClassName+"/"+field.getName()));
-                        compContext.put("env/"+servletClassName+"/"+field.getName(), new
SCAServiceReference(field.getType().getName(), thisComponentName, referenceName, ref.required()));
+                        compContext.put("env/"+servletClassName+"/"+field.getName(), new
SCAServiceReference(field.getType(), thisComponentName, referenceName, ref.required()));
                     } else if(field.isAnnotationPresent(Property.class)) {
                         Property prop = field.getAnnotation(Property.class);
                         String propertyName = prop.name() != null && !prop.name().equals("")
? prop.name() : field.getName();
@@ -232,7 +232,7 @@
                         Reference ref = method.getAnnotation(Reference.class);
                         String referenceName = ref.name() != null && !ref.name().equals("")
? ref.name() : targetName;
                         holder.addInjection(servletClassName, new Injection(servletClassName,
targetName, servletClassName+"/"+targetName));
-                        compContext.put("env/"+servletClassName+"/"+targetName, new SCAServiceReference(type.getName(),
thisComponentName, referenceName, ref.required()));
+                        compContext.put("env/"+servletClassName+"/"+targetName, new SCAServiceReference(type,
thisComponentName, referenceName, ref.required()));
                     } else if(method.isAnnotationPresent(Property.class)) {
                         Property prop = method.getAnnotation(Property.class);
                         String propertyName = prop.name() != null && !prop.name().equals("")
? prop.name() : targetName;
@@ -362,7 +362,7 @@
                     Reference ref = field.getAnnotation(Reference.class);
                     String referenceName = ref.name() != null && !ref.name().equals("")
? ref.name() : targetName; 
                     addEJBInjectionPoint(beanInfo, targetName, type);
-                    contextMap.put(beanClassName+ "/" +targetName, new SCAServiceReference(type.getName(),
componentName, referenceName, ref.required()));
+                    contextMap.put(beanClassName+ "/" +targetName, new SCAServiceReference(type,
componentName, referenceName, ref.required()));
                 } else if(field.isAnnotationPresent(ComponentName.class)) {
                     addEJBInjectionPoint(beanInfo, targetName, type);
                     contextMap.put(beanClassName+ "/" +targetName, componentName);
@@ -387,7 +387,7 @@
                     Reference ref = method.getAnnotation(Reference.class);
                     String referenceName = ref.name() != null && !ref.name().equals("")
? ref.name() : targetName; 
                     addEJBInjectionPoint(beanInfo, targetName, type);
-                    contextMap.put(beanClassName+ "/" +targetName, new SCAServiceReference(type.getName(),
componentName, referenceName, ref.required()));
+                    contextMap.put(beanClassName+ "/" +targetName, new SCAServiceReference(type,
componentName, referenceName, ref.required()));
                 } else if(method.isAnnotationPresent(ComponentName.class)) {
                     addEJBInjectionPoint(beanInfo, targetName, type);
                     contextMap.put(beanClassName+ "/" +targetName, componentName);



Mime
View raw message