Author: antelder
Date: Mon Aug 11 00:21:22 2008
New Revision: 684655

URL: http://svn.apache.org/viewvc?rev=684655&view=rev
Log:
Start getting implementation-web to work with the new model

Added:
    
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/
    
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java
    
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java
    
tuscany/java/sca/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory

Added: 
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java?rev=684655&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java
 (added)
+++ 
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java
 Mon Aug 11 00:21:22 2008
@@ -0,0 +1,77 @@
+/*
+ * 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 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();
+    }
+
+}

Added: 
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java?rev=684655&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java
 (added)
+++ 
tuscany/java/sca/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java
 Mon Aug 11 00:21:22 2008
@@ -0,0 +1,57 @@
+/*
+ * 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 org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.host.webapp.WebAppServletHost;
+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;
+public class WebImplementationProviderFactory implements 
ImplementationProviderFactory<WebImplementation> {
+
+    public WebImplementationProviderFactory(ExtensionPointRegistry 
extensionPoints) {
+    }
+
+    public ImplementationProvider 
createImplementationProvider(RuntimeComponent component, WebImplementation 
implementation) {
+
+        
WebAppServletHost.getInstance().setAttribute("org.osoa.sca.ComponentContext", 
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;
+    }
+    
+}

Added: 
tuscany/java/sca/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory?rev=684655&view=auto
==============================================================================
--- 
tuscany/java/sca/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
 (added)
+++ 
tuscany/java/sca/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
 Mon Aug 11 00:21:22 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


Reply via email to