summaryrefslogtreecommitdiffstats
path: root/tags/java/sca/1.1-RC1/modules/runtime-war/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/sca/1.1-RC1/modules/runtime-war/src/main')
-rw-r--r--tags/java/sca/1.1-RC1/modules/runtime-war/src/main/java/org/apache/tuscany/sca/runtime/war/WarContextListener.java73
-rw-r--r--tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/WEB-INF/web.xml46
-rw-r--r--tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jarbin0 -> 7065 bytes
-rw-r--r--tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/tuscany.properties4
4 files changed, 123 insertions, 0 deletions
diff --git a/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/java/org/apache/tuscany/sca/runtime/war/WarContextListener.java b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/java/org/apache/tuscany/sca/runtime/war/WarContextListener.java
new file mode 100644
index 0000000000..086d5c3026
--- /dev/null
+++ b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/java/org/apache/tuscany/sca/runtime/war/WarContextListener.java
@@ -0,0 +1,73 @@
+/*
+ * 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.runtime.war;
+
+import java.io.File;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.apache.tuscany.sca.runtime.Launcher;
+
+public class WarContextListener implements ServletContextListener {
+
+ private static final Logger logger = Logger.getLogger(WarContextListener.class.getName());
+
+ protected Launcher launcher;
+
+ protected static final String DEFAULT_REPOSITORY_FOLDER = "sca-contributions";
+
+ public void contextInitialized(ServletContextEvent event) {
+ try {
+ launcher = new Launcher(getRepositoryFolder(event));
+ launcher.start();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ logger.log(Level.SEVERE, "exception starting SCA runtime", e);
+ }
+ }
+
+ public void contextDestroyed(ServletContextEvent event) {
+ if (launcher != null)
+ try {
+ launcher.stop();
+ } catch (Throwable e) {
+ logger.log(Level.SEVERE, "exception stopping SCA runtime", e);
+ }
+ }
+
+ protected File getRepositoryFolder(ServletContextEvent event) {
+ ServletContext servletContext = event.getServletContext();
+
+ File repositoryFolder;
+ if (servletContext.getInitParameter("repositoryFolder") != null) {
+ repositoryFolder = new File(servletContext.getInitParameter("repositoryFolder"));
+ } else {
+ repositoryFolder = new File(servletContext.getRealPath("sca-contributions"));
+ }
+
+ logger.info((new StringBuilder()).append("Contribution Repository -> ").append(repositoryFolder).toString());
+ return repositoryFolder;
+ }
+
+}
diff --git a/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/WEB-INF/web.xml b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000000..235b3926f2
--- /dev/null
+++ b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ * 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.
+-->
+
+<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
+Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <display-name>Apache Tuscany WebApp Runtime</display-name>
+
+ <listener>
+ <listener-class>org.apache.tuscany.sca.runtime.war.WarContextListener</listener-class>
+ </listener>
+
+ <!-- context-param>
+ <param-name>repositoryFolder</param-name>
+ <param-value>/sca-contributions</param-value>
+ </context-param -->
+
+ <filter>
+ <filter-name>tuscany</filter-name>
+ <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>tuscany</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
+</web-app>
diff --git a/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jar b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jar
new file mode 100644
index 0000000000..acf47451b3
--- /dev/null
+++ b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/sample-helloworld-ws-service.jar
Binary files differ
diff --git a/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/tuscany.properties b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/tuscany.properties
new file mode 100644
index 0000000000..70de9ceca0
--- /dev/null
+++ b/tags/java/sca/1.1-RC1/modules/runtime-war/src/main/webapp/sca-contributions/tuscany.properties
@@ -0,0 +1,4 @@
+nodeName=http://myNode
+#nodeName=http://localhost:8080/tuscany/myNode/
+#domainName=http://localhost:9876/tuscany/domainManager
+hotDeployInterval=10000