geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vamsic...@apache.org
Subject svn commit: r711562 - in /geronimo/plugins/tuscany/trunk: ./ geronimo-tuscany-implementation-web/ geronimo-tuscany-implementation-web/src/ geronimo-tuscany-implementation-web/src/main/ geronimo-tuscany-implementation-web/src/main/java/ geronimo-tuscany...
Date Wed, 05 Nov 2008 13:39:01 GMT
Author: vamsic007
Date: Wed Nov  5 05:39:00 2008
New Revision: 711562

URL: http://svn.apache.org/viewvc?rev=711562&view=rev
Log:
GERONIMO-4343 Tuscany Geronimo plugin bring up
 o Applying implementation-web-runtime.diff.
 o Thanks Ant Elder for providing the patch.

Added:
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java
  (with props)
Modified:
    geronimo/plugins/tuscany/trunk/pom.xml
    geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml

Added: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java?rev=711562&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java
(added)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java
Wed Nov  5 05:39:00 2008
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+
+package org.apache.tuscany.sca.implementation.web.taglib;
+
+import javax.servlet.ServletContext;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.tuscany.sca.implementation.web.runtime.WebImplementationProviderFactory;
+import org.osoa.sca.ComponentContext;
+
+/**
+ * Tag to handle SCA references
+ * <sca:reference name="service" type="test.MyService" scope="1" />
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceTag extends TagSupport {
+    private static final long serialVersionUID = 1L;
+
+    protected String name;
+    protected String type;
+    protected Integer scope = PageContext.PAGE_SCOPE;
+
+    @Override
+    public int doStartTag() throws JspException {
+        return SKIP_BODY;
+    }
+
+    @Override
+    public int doEndTag() throws JspException {
+
+//        ComponentContext componentContext = (ComponentContext)servletContext.getAttribute("org.oasis.sca.ComponentContext");
+//        SCADomain scaDomain = null;
+//        if (componentContext == null) {
+//            scaDomain = (SCADomain)servletContext.getAttribute("org.apache.tuscany.sca.SCADomain");
+//            if (scaDomain == null) {
+//                throw new JspException("SCADomain is null. Check Tuscany configuration
in web.xml");
+//            }
+//        }
+
+        Class<?> typeClass;
+        try {
+            typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
+        } catch (ClassNotFoundException e) {
+            throw new JspException("Reference '" + name + "' type class not found: " + type);
+        }
+
+//        EmbeddedSCADomainGBean domainGBean = (EmbeddedSCADomainGBean) kernel.getGBean(EmbeddedSCADomainGBean.class);
+//		Object domain = domainGBean.getScaDomain();
+//		event.getServletContext().setAttribute("org.apache.tuscany.sca.SCADomain", domain);
+
+        ServletContext servletContext = pageContext.getServletContext();
+		String path = servletContext.getContextPath();
+		String warName = path.substring(1) + ".war";
+		ComponentContext componentContext = WebImplementationProviderFactory.getWebAppContext(warName);
+        if (componentContext == null) {
+            throw new JspException("no component found for webapp:" + warName);
+        }
+
+        Object o = componentContext.getService(typeClass, name);
+        if (o == null) {
+            throw new JspException("Reference '" + name + "' not found on component for webapp:
" + warName);
+        }
+
+        pageContext.setAttribute(name, o, scope);
+
+        return EVAL_PAGE;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getScope() {
+        return scope;
+    }
+
+    public void setScope(Integer scope) {
+        this.scope = scope;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}

Propchange: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/plugins/tuscany/trunk/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/pom.xml?rev=711562&r1=711561&r2=711562&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/pom.xml (original)
+++ geronimo/plugins/tuscany/trunk/pom.xml Wed Nov  5 05:39:00 2008
@@ -477,6 +477,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.tuscany.sca</groupId>
+                <artifactId>tuscany-implementation-web</artifactId>
+                <version>${tuscanyVersion}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.tuscany.sca</groupId>
                 <artifactId>tuscany-interface</artifactId>
                 <version>${tuscanyVersion}</version>
             </dependency>
@@ -790,6 +795,7 @@
     <modules>
         <module>geronimo-tuscany</module>
         <module>geronimo-tuscany-http-tomcat</module>
+        <module>geronimo-tuscany-implementation-web</module>
         <module>tuscany-tomcat</module>
         <module>geronimo-tuscany-http-jetty</module>
         <module>tuscany-jetty</module>

Modified: geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml?rev=711562&r1=711561&r2=711562&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml (original)
+++ geronimo/plugins/tuscany/trunk/tuscany-tomcat/pom.xml Wed Nov  5 05:39:00 2008
@@ -44,6 +44,12 @@
             <version>${version}</version>
             <type>jar</type>
         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.plugins</groupId>
+            <artifactId>geronimo-tuscany-implementation-web</artifactId>
+            <version>${version}</version>
+            <type>jar</type>
+        </dependency>
 
         <dependency>
             <groupId>annogen</groupId>
@@ -281,10 +287,6 @@
         </dependency>
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-host-webapp</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-implementation-java</artifactId>
         </dependency>
         <dependency>
@@ -301,6 +303,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-interface</artifactId>
         </dependency>
         <dependency>



Mime
View raw message