You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by va...@apache.org on 2008/11/05 14:51:59 UTC

svn commit: r711569 - in /geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main: java/org/apache/tuscany/sca/implementation/web/runtime/ java/org/apache/tuscany/sca/implementation/web/taglib/ resources/ resources/META-INF/ resourc...

Author: vamsic007
Date: Wed Nov  5 05:51:59 2008
New Revision: 711569

URL: http://svn.apache.org/viewvc?rev=711569&view=rev
Log:
GERONIMO-4343 Tuscany Geronimo plugin bring up
 o Missed a few files from implementation-web-runtime.diff in the last commit.

Added:
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java   (with props)
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java   (with props)
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTEI.java   (with props)
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/sca.tld
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/services/
    geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
Modified:
    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/runtime/ComponentContextProxy.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java?rev=711569&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java (added)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java Wed Nov  5 05:51:59 2008
@@ -0,0 +1,87 @@
+/*
+ * 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.runtime;
+
+import java.util.Collection;
+
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.osoa.sca.CallableReference;
+import org.osoa.sca.ComponentContext;
+import org.osoa.sca.RequestContext;
+import org.osoa.sca.ServiceReference;
+
+/**
+ * Proxy ComponentContext wrappering a RuntimeComponent as the
+ * RuntimeComponent ComponentContext has not been created till later 
+ */
+public class ComponentContextProxy implements ComponentContext {
+
+    protected RuntimeComponent runtimeComponent;
+    
+    public ComponentContextProxy(RuntimeComponent runtimeComponent) {
+        this.runtimeComponent = runtimeComponent;
+    }
+    
+    protected ComponentContext getComponentContext() {
+        return runtimeComponent.getComponentContext();
+    }
+    
+    @SuppressWarnings("unchecked")
+    public <B, R extends CallableReference<B>> R cast(B arg0) throws IllegalArgumentException {
+        return (R) getComponentContext().cast(arg0);
+    }
+
+    public <B> ServiceReference<B> createSelfReference(Class<B> arg0) {
+        return getComponentContext().createSelfReference(arg0);
+    }
+
+    public <B> ServiceReference<B> createSelfReference(Class<B> arg0, String arg1) {
+        return getComponentContext().createSelfReference(arg0, arg1);
+    }
+
+    public <B> B getProperty(Class<B> arg0, String arg1) {
+        return getComponentContext().getProperty(arg0, arg1);
+    }
+
+    public RequestContext getRequestContext() {
+        return getComponentContext().getRequestContext();
+    }
+
+    public <B> B getService(Class<B> arg0, String arg1) {
+        return getComponentContext().getService(arg0, arg1);
+    }
+
+    public <B> ServiceReference<B> getServiceReference(Class<B> arg0, String arg1) {
+        return getComponentContext().getServiceReference(arg0, arg1);
+    }
+
+    public String getURI() {
+        return getComponentContext().getURI();
+    }
+
+    public <B> Collection<ServiceReference<B>> getServiceReferences(Class<B> businessInterface, String referenceName) {
+        return getComponentContext().getServiceReferences(businessInterface, referenceName);
+    }
+
+    public <B> Collection<B> getServices(Class<B> businessInterface, String referenceName) {
+        return getComponentContext().getServices(businessInterface, referenceName);
+    }
+
+}

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

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

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

Added: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java?rev=711569&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java (added)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java Wed Nov  5 05:51:59 2008
@@ -0,0 +1,66 @@
+/*
+ * 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.runtime;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.implementation.web.WebImplementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+import org.osoa.sca.ComponentContext;
+public class WebImplementationProviderFactory implements ImplementationProviderFactory<WebImplementation> {
+
+    private static Map<String, ComponentContext> contexts = new HashMap<String, ComponentContext>();
+
+    public WebImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+    }
+
+    public ImplementationProvider createImplementationProvider(RuntimeComponent component, WebImplementation implementation) {
+
+        contexts.put(implementation.getWebURI(), new ComponentContextProxy(component));
+
+        return new ImplementationProvider() {
+            public Invoker createInvoker(RuntimeComponentService arg0, Operation arg1) {
+                throw new UnsupportedOperationException("Components using implementation.web have no services");
+            }
+            public void start() {
+            }
+            public void stop() {
+            }
+            public boolean supportsOneWayInvocation() {
+                return false;
+            }
+        };
+    }
+    
+    public Class<WebImplementation> getModelType() {
+        return WebImplementation.class;
+    }
+
+    // TODO: don't use static create a proper mechanisim to pass these around
+    public static ComponentContext getWebAppContext(String webappURI) {
+        return contexts.get(webappURI);
+    }
+}

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

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

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

Added: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTEI.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/ReferenceTEI.java?rev=711569&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTEI.java (added)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTEI.java Wed Nov  5 05:51:59 2008
@@ -0,0 +1,45 @@
+/*
+ * 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.jsp.tagext.TagData;
+import javax.servlet.jsp.tagext.TagExtraInfo;
+import javax.servlet.jsp.tagext.VariableInfo;
+
+/**
+ * TagExtraInfo class for the SCA reference tags
+ * <sca:reference name="service" type="test.MyService" scope="1" />
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReferenceTEI extends TagExtraInfo {
+
+    @Override
+    public VariableInfo[] getVariableInfo(TagData data) {
+        VariableInfo info1
+           = new VariableInfo(
+              data.getAttributeString("name"),
+              data.getAttributeString("type"),
+              true,
+              VariableInfo.AT_END);
+        VariableInfo[] info = { info1 } ;
+        return info;
+     }
+}

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

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

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

Modified: 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=711569&r1=711568&r2=711569&view=diff
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java (original)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/taglib/ReferenceTag.java Wed Nov  5 05:51:59 2008
@@ -65,13 +65,13 @@
         }
 
 //        EmbeddedSCADomainGBean domainGBean = (EmbeddedSCADomainGBean) kernel.getGBean(EmbeddedSCADomainGBean.class);
-//		Object domain = domainGBean.getScaDomain();
-//		event.getServletContext().setAttribute("org.apache.tuscany.sca.SCADomain", domain);
+//        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);
+        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);
         }

Added: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/sca.tld
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/sca.tld?rev=711569&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/sca.tld (added)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/sca.tld Wed Nov  5 05:51:59 2008
@@ -0,0 +1,51 @@
+<?xml version = '1.0' encoding = 'ISO-8859-1'?>
+<!--
+(c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA
+Technologies, Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens
+AG., Software AG., Sun Microsystems, Inc., Sybase Inc., TIBCO Software Inc., 2005, 2008. All rights reserved.
+
+see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
+ -->
+
+<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
+
+<taglib version="2.1">
+
+  <tlib-version>1.0</tlib-version>
+  <short-name>SCA-JSP</short-name>
+  <uri>http://www.osoa.org/sca/sca_jsp.tld</uri>
+  <description>A tag library for integrating sca components with jsp</description>
+
+  <tag>
+
+    <name>reference</name>
+
+    <tag-class>org.apache.tuscany.sca.implementation.web.taglib.ReferenceTag</tag-class>
+    <tei-class>org.apache.tuscany.sca.implementation.web.taglib.ReferenceTEI</tei-class>
+    
+    <attribute>
+      <name>name</name>
+      <required>true</required>
+      <rtexprvalue>false</rtexprvalue>
+      <type>java.lang.String</type>
+    </attribute>
+
+    <attribute>
+      <name>type</name>
+      <required>true</required>
+      <rtexprvalue>false</rtexprvalue>
+      <type>java.lang.String</type>
+    </attribute>
+
+    <attribute>
+      <name>scope</name>
+      <required>false</required>
+      <rtexprvalue>false</rtexprvalue>
+      <type>java.lang.Integer</type>
+    </attribute>
+
+    <body-content>empty</body-content>
+
+  </tag>
+
+</taglib>

Added: geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
URL: http://svn.apache.org/viewvc/geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory?rev=711569&view=auto
==============================================================================
--- geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory (added)
+++ geronimo/plugins/tuscany/trunk/geronimo-tuscany-implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory Wed Nov  5 05:51:59 2008
@@ -0,0 +1,19 @@
+# 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. 
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.web.runtime.WebImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.web.WebImplementation