You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2006/10/04 18:57:55 UTC
svn commit: r452935 - in /incubator/tuscany/java: distribution/sca/web/
distribution/sca/web/src/main/assembly/
samples/sca/spring/client/src/main/webapp/WEB-INF/ samples/sca/spring/server/
samples/sca/spring/server/src/main/webapp/META-INF/ samples/sc...
Author: kentam
Date: Wed Oct 4 09:57:54 2006
New Revision: 452935
URL: http://svn.apache.org/viewvc?view=rev&rev=452935
Log:
Some fixes for webapp samples, specifically the Spring server sample. Migrated the Spring server sample to use the Tuscany war plugin, and incorporated fixes contributed by Andy Piper in https://issues.apache.org/jira/browse/TUSCANY-775
Added:
incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/applicationContext.xml (with props)
incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/default.scdl (with props)
incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/
incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/
incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/spring.system.scdl (with props)
incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/test.binding.system.scdl (with props)
incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java (with props)
Removed:
incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/META-INF/
Modified:
incubator/tuscany/java/distribution/sca/web/pom.xml
incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml
incubator/tuscany/java/samples/sca/spring/server/pom.xml
incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java
incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java
incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java
incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java
incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java
incubator/tuscany/java/sca/runtime/webapp/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java
incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java
Modified: incubator/tuscany/java/distribution/sca/web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/distribution/sca/web/pom.xml?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/distribution/sca/web/pom.xml (original)
+++ incubator/tuscany/java/distribution/sca/web/pom.xml Wed Oct 4 09:57:54 2006
@@ -19,48 +19,54 @@
-->
<project>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.tuscany</groupId>
+ <parent>
+ <groupId>org.apache.tuscany.distribution.sca</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-incubator-M2-SNAPSHOT</version>
+ </parent>
<artifactId>web</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0-incubator-M2-SNAPSHOT</version>
<packaging>pom</packaging>
- <name>Apache Tuscany Web-Tier Distribution</name>
+ <name>Tuscany Web-Tier Distribution</name>
<description>Tuscany Distribution for web-tier (servlet) environments.</description>
<properties>
- <sca.version>1.0-SNAPSHOT</sca.version>
+ <sca.version>1.0-incubator-M2-SNAPSHOT</sca.version>
</properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany</groupId>
- <artifactId>core</artifactId>
- <version>${sca.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.runtime</groupId>
- <artifactId>webapp</artifactId>
- <version>${sca.version}</version>
- </dependency>
- </dependencies>
-
- <pluginRepositories>
- <pluginRepository>
- <id>apache-snapshot</id>
+ <!-- definition of repositories where the parent pom can be found -->
+ <repositories>
+ <repository>
+ <id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
- <url>http://people.apache.org/maven-snapshot-repository</url>
+ <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
- </pluginRepository>
- <pluginRepository>
- <id>codehaus-snapshot</id>
- <name>Codehaus Snapshot Repository</name>
- <url>http://snapshots.repository.codehaus.org</url>
- <snapshots>
+ </repository>
+ <repository>
+ <id>apache.incubator</id>
+ <name>Apache Incubator Repository</name>
+ <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+ <releases>
<enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
</snapshots>
- </pluginRepository>
- </pluginRepositories>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca.runtime</groupId>
+ <artifactId>webapp-host</artifactId>
+ <version>${sca.version}</version>
+ </dependency>
+ </dependencies>
<build>
<defaultGoal>install</defaultGoal>
Modified: incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml (original)
+++ incubator/tuscany/java/distribution/sca/web/src/main/assembly/servlet.xml Wed Oct 4 09:57:54 2006
@@ -18,7 +18,6 @@
* under the License.
-->
<assembly>
- <!-- id typically identifies the "type" (src vs bin etc) of the assembly -->
<id>bin</id>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
@@ -41,8 +40,10 @@
<dependencySet>
<outputDirectory>WEB-INF/lib</outputDirectory>
<includes>
- <include>org.osoa:sca-api</include>
- <include>org.apache.tuscany.runtime:webapp</include>
+ <include>org.osoa:sca-api-r0.95</include>
+ <include>org.apache.tuscany.sca.runtime:webapp</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-host-api</include>
+ <include>org.apache.tuscany.sca.kernel:tuscany-api</include>
</includes>
<fileMode>644</fileMode>
</dependencySet>
@@ -51,8 +52,14 @@
<dependencySet>
<outputDirectory>WEB-INF/tuscany/boot</outputDirectory>
<includes>
- <include>org.apache.tuscany:core</include>
+ <include>org.apache.tuscany.sca.runtime:webapp-host</include>
</includes>
+ <excludes>
+ <exclude>org.osoa:sca-api-r0.95</exclude>
+ <exclude>org.apache.tuscany.sca.runtime:webapp</exclude>
+ <exclude>org.apache.tuscany.sca.kernel:tuscany-host-api</exclude>
+ <exclude>org.apache.tuscany.sca.kernel:tuscany-api</exclude>
+ </excludes>
<fileMode>644</fileMode>
</dependencySet>
</dependencySets>
Added: incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/applicationContext.xml?view=auto&rev=452935
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/applicationContext.xml (added)
+++ incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/applicationContext.xml Wed Oct 4 09:57:54 2006
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:sca="http://www.springframework.org/schema/sca"
+ xsi:schemaLocation="
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://www.springframework.org/schema/sca http://www.springframework.org/schema/sca/spring-sca.xsd">
+
+ <bean id="testBean" class="sample.TestBeanImpl" lazy-init="true">
+ <property name="testComponent" ref="testReference"/>
+ <property name="name" value="My test bean"/>
+ </bean>
+
+</beans>
Propchange: incubator/tuscany/java/samples/sca/spring/client/src/main/webapp/WEB-INF/applicationContext.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/samples/sca/spring/server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/pom.xml?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/pom.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/server/pom.xml Wed Oct 4 09:57:54 2006
@@ -31,24 +31,6 @@
<dependencies>
<dependency>
- <groupId>org.osoa</groupId>
- <artifactId>sca-api-r0.95</artifactId>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca.kernel</groupId>
- <artifactId>core</artifactId>
- <version>${pom.version}</version>
- <scope>runtime</scope>
- <!-- runtime is need for webapp integration to include jar -->
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.apache.tuscany.sca.runtime</groupId>
<artifactId>webapp</artifactId>
<version>${pom.version}</version>
@@ -56,15 +38,16 @@
<!-- runtime is need for webapp integration to include jar -->
</dependency>
<dependency>
- <groupId>org.apache.tuscany.sca.runtime</groupId>
- <artifactId>webapp-host</artifactId>
+ <!-- Spring-SCA container extension -->
+ <groupId>org.apache.tuscany.sca.services.containers</groupId>
+ <artifactId>spring</artifactId>
<version>${pom.version}</version>
<scope>runtime</scope>
- <!-- runtime is need for webapp integration to include jar -->
</dependency>
<dependency>
- <groupId>org.apache.tuscany.sca.services.containers</groupId>
- <artifactId>spring</artifactId>
+ <!-- Test binding extension -->
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>test</artifactId>
<version>${pom.version}</version>
<scope>runtime</scope>
</dependency>
@@ -74,12 +57,31 @@
<version>2.0-rc3</version>
<scope>compile</scope>
</dependency>
+ <!--
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
-
+ -->
</dependencies>
+
+ <build>
+ <finalName>server</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.plugins</groupId>
+ <artifactId>tuscany-war-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tuscany-war</id>
+ <goals>
+ <goal>tuscany-war</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/default.scdl?view=auto&rev=452935
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/default.scdl (added)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/default.scdl Wed Oct 4 09:57:54 2006
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="SpringSample">
+
+ <component name="SpringSample">
+ <implementation.spring location="application-context.xml">
+ <service name="SpringBean">
+ <interface.java interface="sample.TestComponent"/>
+ <binding.socket port="8888"/>
+ <reference>testBean</reference>
+ </service>
+
+ </implementation.spring>
+ </component>
+</composite>
Propchange: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/default.scdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/spring.system.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/spring.system.scdl?view=auto&rev=452935
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/spring.system.scdl (added)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/spring.system.scdl Wed Oct 4 09:57:54 2006
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright (c) 2006 The Apache Software Foundation or its licensors, as applicable.
+ *
+ * Licensed 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.
+ -->
+<!--
+ Spring implementation extension configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+ name="org.apache.tuscany.launcher.SpringImplementation">
+
+ <component name="spring.implementationLoader">
+ <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringImplementationLoader"/>
+ </component>
+
+ <component name="spring.componentTypeLoader">
+ <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringComponentTypeLoader"/>
+ </component>
+
+ <component name="spring.componentBuilder">
+ <system:implementation.system class="org.apache.tuscany.container.spring.impl.SpringCompositeBuilder"/>
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/spring.system.scdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/test.binding.system.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/test.binding.system.scdl?view=auto&rev=452935
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/test.binding.system.scdl (added)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/test.binding.system.scdl Wed Oct 4 09:57:54 2006
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<!--
+ JavaScript configuration for the launcher environment.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ xmlns:system="http://tuscany.apache.org/xmlns/system/1.0-SNAPSHOT"
+
+ name="org.apache.tuscany.test.TestBindingImplementation">
+
+ <component name="BindingLoader">
+ <system:implementation.system class="org.apache.tuscany.test.binding.TestBindingLoader"/>
+ </component>
+
+ <component name="BindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.test.binding.TestBindingBuilder"/>
+ </component>
+
+ <component name="SocketBindingLoader">
+ <system:implementation.system class="org.apache.tuscany.test.binding.TestSocketBindingLoader"/>
+ </component>
+
+ <component name="SocketBindingBuilder">
+ <system:implementation.system class="org.apache.tuscany.test.binding.TestSocketBindingBuilder"/>
+ </component>
+
+</composite>
+
Propchange: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/tuscany/extensions/test.binding.system.scdl
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/tuscany/java/samples/sca/spring/server/src/main/webapp/WEB-INF/web.xml Wed Oct 4 09:57:54 2006
@@ -6,16 +6,6 @@
<display-name>Tuscany Spring Sample</display-name>
<context-param>
- <param-name>tuscany.systemScdlPath</param-name>
- <param-value>/META-INF/tuscany/webapp.scdl</param-value>
- </context-param>
-
- <context-param>
- <param-name>tuscany.applicationScdlPath</param-name>
- <param-value>/META-INF/sca/default.scdl</param-value>
- </context-param>
-
- <context-param>
<param-name>currentCompositePath</param-name>
<param-value>SpringSample</param-value>
</context-param>
@@ -50,4 +40,4 @@
</servlet-mapping>
-</web-app>
\ No newline at end of file
+</web-app>
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/launcher/LauncherImpl.java Wed Oct 4 09:57:54 2006
@@ -20,6 +20,7 @@
import java.io.File;
import java.net.URL;
+
import javax.xml.stream.XMLInputFactory;
import org.osoa.sca.CompositeContext;
@@ -184,6 +185,7 @@
// deploy the component into the runtime under the system parent
CompositeComponent parent = runtime.getRootComponent();
+ // FIXME andyp -- this seems bogus when running inside an appserver
ClassLoader ccl = Thread.currentThread().getContextClassLoader();
try {
Modified: incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java (original)
+++ incubator/tuscany/java/sca/kernel/host-api/src/main/java/org/apache/tuscany/host/runtime/TuscanyRuntime.java Wed Oct 4 09:57:54 2006
@@ -134,7 +134,13 @@
*/
SCA getContext();
+ /**
+ * Get the application classloader
+ */
ClassLoader getApplicationClassLoader();
+ /**
+ * Set the application classloader
+ */
void setApplicationClassLoader(ClassLoader applicationClassLoader);
}
Modified: incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp-host/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeImpl.java Wed Oct 4 09:57:54 2006
@@ -67,7 +67,6 @@
private ServletRequestInjector requestInjector;
-
private CompositeContextImpl context;
private RuntimeComponent runtime;
private CompositeComponent systemComponent;
@@ -97,7 +96,12 @@
systemComponent = runtime.getSystemComponent();
// register the runtime info provided by the host
+ // FIXME andyp@bea.com -- autowire appears to need an exact type match,
+ // hence the need to register this twice
systemComponent.registerJavaObject(RuntimeInfo.COMPONENT_NAME,
+ RuntimeInfo.class,
+ (WebappRuntimeInfo) getRuntimeInfo());
+ systemComponent.registerJavaObject(WebappRuntimeInfo.COMPONENT_NAME,
WebappRuntimeInfo.class,
(WebappRuntimeInfo) getRuntimeInfo());
@@ -106,6 +110,10 @@
systemComponent.start();
+ if (getSystemScdl() == null) {
+ throw new TuscanyInitException("Could not find system SCDL");
+ }
+
try {
// deploy the system scdl
Deployer deployer = bootstrapper.createDeployer();
@@ -120,6 +128,10 @@
// switch to the system deployer
deployer = (Deployer) tuscanySystem.getSystemChild("deployer").getServiceInstance();
+
+ if (getApplicationScdl() == null) {
+ throw new TuscanyInitException("Could not find application SCDL");
+ }
application = deployApplicationScdl(deployer,
runtime.getRootComponent(),
Modified: incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfo.java Wed Oct 4 09:57:54 2006
@@ -26,6 +26,7 @@
* @version $Rev$ $Date$
*/
public interface WebappRuntimeInfo extends RuntimeInfo {
+ public final static String COMPONENT_NAME = "WebappRuntimeInfo";
/**
* Returns the ServletContext associated with this webapp runtime.
*
Modified: incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappRuntimeInfoImpl.java Wed Oct 4 09:57:54 2006
@@ -43,10 +43,10 @@
}
public File getInstallDirectory() {
- throw new UnsupportedOperationException();
+ return new File("");
}
public File getApplicationRootDirectory() {
- throw new UnsupportedOperationException();
+ return new File("");
}
}
Modified: incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtil.java Wed Oct 4 09:57:54 2006
@@ -29,7 +29,6 @@
* Return the classloader that should be used to boot the Tuscany runtime.
* This will be a child of the web application's ClassLoader.
*
- * @param servletContext the servlet context for the webapp containing the bootstrap classes
* @param webappClassLoader the web application's classloader
* @return a classloader that can be used to load the Tuscany runtime classes
*/
Modified: incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/src/main/java/org/apache/tuscany/runtime/webapp/WebappUtilImpl.java Wed Oct 4 09:57:54 2006
@@ -105,13 +105,16 @@
public URL getScdlURL(String path, ClassLoader classLoader)
throws MalformedURLException {
+ URL ret = null;
if (path.charAt(0) == '/') {
// user supplied an absolute path - look up as a webapp resource
- return servletContext.getResource(path);
- } else {
+ ret = servletContext.getResource(path);
+ }
+ if (ret == null) {
// user supplied a relative path - look up as a boot classpath resource
- return classLoader.getResource(path);
+ ret = classLoader.getResource(path);
}
+ return ret;
}
public String getInitParameter(String name, String value) {
Modified: incubator/tuscany/java/sca/runtime/webapp/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/runtime/webapp/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/runtime/webapp/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java (original)
+++ incubator/tuscany/java/sca/runtime/webapp/src/test/java/org/apache/tuscany/runtime/webapp/WebappUtilTestCase.java Wed Oct 4 09:57:54 2006
@@ -79,6 +79,7 @@
String path = "/WEB-INF/test";
expect(context.getResource(path)).andReturn(null);
replay(context);
+ expect(cl.getResource(path)).andReturn(null);
replay(cl);
assertNull(listener.getScdlURL(path, cl));
verify(context);
Modified: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java?view=diff&rev=452935&r1=452934&r2=452935
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java (original)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/ScaWebApplicationContext.java Wed Oct 4 09:57:54 2006
@@ -93,11 +93,13 @@
URL systemScdl = utils.getSystemScdl(bootClassLoader);
URL applicationScdl = utils.getApplicationScdl(webappClassLoader);
+ runtime.setMonitorFactory(runtime.createDefaultMonitorFactory());
+ runtime.setApplicationName(utils.getApplicationName());
runtime.setServletContext(servletContext);
runtime.setHostClassLoader(webappClassLoader);
runtime.setSystemScdl(systemScdl);
runtime.setApplicationScdl(applicationScdl);
- runtime.setRuntimeInfo(new SpringRuntimeInfo(getApplicationRootDirectory(), this));
+ runtime.setRuntimeInfo(new SpringWebappRuntimeInfo(getApplicationRootDirectory(), this));
runtime.initialize();
} catch (TuscanyRuntimeException e) {
servletContext.log(e.getMessage(), e);
@@ -120,7 +122,7 @@
* What does this do and why to we need it?
* @return
*/
- public File getApplicationRootDirectory() {
+ private File getApplicationRootDirectory() {
String property = System.getProperty("tuscany.applicationRootDir");
if (property != null) {
return new File(property);
Added: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java?view=auto&rev=452935
==============================================================================
--- incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java (added)
+++ incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java Wed Oct 4 09:57:54 2006
@@ -0,0 +1,41 @@
+/*
+ * 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.container.spring.webapp;
+
+import java.io.File;
+import javax.servlet.ServletContext;
+
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+
+import org.apache.tuscany.container.spring.impl.SpringRuntimeInfo;
+import org.apache.tuscany.runtime.webapp.WebappRuntimeInfo;
+
+/**
+ * @author Andy Piper
+ */
+public class SpringWebappRuntimeInfo extends SpringRuntimeInfo implements WebappRuntimeInfo {
+ public SpringWebappRuntimeInfo(File appRootDir, XmlWebApplicationContext applicationContext) {
+ super(appRootDir, applicationContext);
+ }
+
+ public ServletContext getServletContext() {
+ return ((WebApplicationContext) getApplicationContext()).getServletContext();
+ }
+}
Propchange: incubator/tuscany/java/sca/services/containers/container.spring/src/main/java/org/apache/tuscany/container/spring/webapp/SpringWebappRuntimeInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org