summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-18 17:15:48 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2009-02-18 17:15:48 +0000
commitd05eb9a9012a851f2fc4990ccc992c695640e959 (patch)
tree7d2512de4b2bbc4b82e3b33e1c699913c17fe9af /java/sca
parent6b3fdebfeefa99e9329cbb295c920f5e3a8471a7 (diff)
Simplify the code a bit
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@745577 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca')
-rw-r--r--java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/jsp/ReferenceTag.java19
1 files changed, 5 insertions, 14 deletions
diff --git a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/jsp/ReferenceTag.java b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/jsp/ReferenceTag.java
index c46b507749..a82b33fc2d 100644
--- a/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/jsp/ReferenceTag.java
+++ b/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/jsp/ReferenceTag.java
@@ -24,7 +24,6 @@ import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
-import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.runtime.RuntimeComponent;
import org.oasisopen.sca.ServiceReference;
@@ -52,27 +51,19 @@ public class ReferenceTag extends TagSupport {
ServletContext servletContext = pageContext.getServletContext();
RuntimeComponent component = (RuntimeComponent)servletContext.getAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent");
- Class typeClass;
+ Class<?> typeClass;
try {
typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new JspException("Reference '" + name + "' type class not found: " + type);
}
- Object o = null;
- for (ComponentReference ref : component.getReferences()) {
- if (name.equals(ref.getName())) {
- ServiceReference sr = component.getComponentContext().getServiceReference(typeClass, name);
- o = sr.getService();
- break;
- }
- }
-
- if (o == null) {
- throw new JspException("Reference '" + name + "' not found");
+ ServiceReference<?> sr = component.getComponentContext().getServiceReference(typeClass, name);
+ if (sr == null) {
+ throw new JspException("Reference '" + name + "' undefined");
}
- pageContext.setAttribute(name, o, scope);
+ pageContext.setAttribute(name, sr.getService(), scope);
return EVAL_PAGE;
}