summaryrefslogtreecommitdiffstats
path: root/sandbox/rfeng/helloworld-jsp-gae-contribution/src
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/rfeng/helloworld-jsp-gae-contribution/src')
-rw-r--r--sandbox/rfeng/helloworld-jsp-gae-contribution/src/META-INF/jdoconfig.xml15
-rw-r--r--sandbox/rfeng/helloworld-jsp-gae-contribution/src/helloworld-node.xml40
-rw-r--r--sandbox/rfeng/helloworld-jsp-gae-contribution/src/log4j.properties24
-rw-r--r--sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/HelloworldService.java25
-rw-r--r--sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/appengine/HelloWorldServlet.java51
5 files changed, 155 insertions, 0 deletions
diff --git a/sandbox/rfeng/helloworld-jsp-gae-contribution/src/META-INF/jdoconfig.xml b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/META-INF/jdoconfig.xml
new file mode 100644
index 0000000000..5f56aa196e
--- /dev/null
+++ b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/META-INF/jdoconfig.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <persistence-manager-factory name="transactions-optional">
+ <property name="javax.jdo.PersistenceManagerFactoryClass"
+ value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/>
+ <property name="javax.jdo.option.ConnectionURL" value="appengine"/>
+ <property name="javax.jdo.option.NontransactionalRead" value="true"/>
+ <property name="javax.jdo.option.NontransactionalWrite" value="true"/>
+ <property name="javax.jdo.option.RetainValues" value="true"/>
+ <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
+ </persistence-manager-factory>
+</jdoconfig>
diff --git a/sandbox/rfeng/helloworld-jsp-gae-contribution/src/helloworld-node.xml b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/helloworld-node.xml
new file mode 100644
index 0000000000..b509ece2ff
--- /dev/null
+++ b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/helloworld-node.xml
@@ -0,0 +1,40 @@
+<?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.
+-->
+<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200903"
+ xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ uri="http://sample/nodes/TestNode1"
+ domainRegistry = "vm://localhost"
+ domain="http://domain1">
+
+ <!-- Configure the base URIs for a given binding -->
+ <!-- Each base URI is for a protocol supported by the binding -->
+ <binding name="sca:binding.ws" baseURIs="http://localhost:8080/ws https://localhost:8081/ws"/>
+ <binding name="tuscany:binding.rmi" baseURIs="rmi://localhost:8080/rmi"/>
+ <binding name="tuscany:binding.jsonrpc">
+ <baseURI>http://localhost:8080/jsonrpc</baseURI>
+ </binding>
+
+ <!-- Configure a list of contributions -->
+ <contribution uri="http://c1" location="../contributions/helloworld.jar">
+ <deploymentComposite location="war/WEB-INF/web.composite"/>
+ </contribution>
+
+</node> \ No newline at end of file
diff --git a/sandbox/rfeng/helloworld-jsp-gae-contribution/src/log4j.properties b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/log4j.properties
new file mode 100644
index 0000000000..d9c3edc9fe
--- /dev/null
+++ b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/log4j.properties
@@ -0,0 +1,24 @@
+# A default log4j configuration for log4j users.
+#
+# To use this configuration, deploy it into your application's WEB-INF/classes
+# directory. You are also encouraged to edit it as you like.
+
+# Configure the console as our one appender
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n
+
+# tighten logging on the DataNucleus Categories
+log4j.category.DataNucleus.JDO=WARN, A1
+log4j.category.DataNucleus.Persistence=WARN, A1
+log4j.category.DataNucleus.Cache=WARN, A1
+log4j.category.DataNucleus.MetaData=WARN, A1
+log4j.category.DataNucleus.General=WARN, A1
+log4j.category.DataNucleus.Utility=WARN, A1
+log4j.category.DataNucleus.Transaction=WARN, A1
+log4j.category.DataNucleus.Datastore=WARN, A1
+log4j.category.DataNucleus.ClassLoading=WARN, A1
+log4j.category.DataNucleus.Plugin=WARN, A1
+log4j.category.DataNucleus.ValueGeneration=WARN, A1
+log4j.category.DataNucleus.Enhancer=WARN, A1
+log4j.category.DataNucleus.SchemaTool=WARN, A1
diff --git a/sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/HelloworldService.java b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/HelloworldService.java
new file mode 100644
index 0000000000..53ff7a5ca1
--- /dev/null
+++ b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/HelloworldService.java
@@ -0,0 +1,25 @@
+/*
+ * 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 sample;
+
+public interface HelloworldService {
+
+ String sayHello(String name);
+
+}
diff --git a/sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/appengine/HelloWorldServlet.java b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/appengine/HelloWorldServlet.java
new file mode 100644
index 0000000000..2750c04c9d
--- /dev/null
+++ b/sandbox/rfeng/helloworld-jsp-gae-contribution/src/sample/appengine/HelloWorldServlet.java
@@ -0,0 +1,51 @@
+/*
+ * 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 sample.appengine;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.google.appengine.api.users.User;
+import com.google.appengine.api.users.UserService;
+import com.google.appengine.api.users.UserServiceFactory;
+
+@SuppressWarnings("serial")
+public class HelloWorldServlet extends HttpServlet {
+ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+ resp.setContentType("text/html");
+ UserService userService = UserServiceFactory.getUserService();
+ User user = userService.getCurrentUser();
+ if (user == null) {
+ resp.sendRedirect(userService.createLoginURL(req.getRequestURI()));
+ } else {
+ PrintWriter pw = resp.getWriter();
+ pw.println("<html><head><title>Test</title></head><body>");
+ pw.println("<h1>");
+ pw.println("Welcome to the SCA Cloud hosted by Google App Engine: " + user);
+ if (user != null) {
+ pw.println("User ID: " + user.getUserId() + " E-mail: " + user.getEmail());
+ }
+ pw.println("</h1></body></html>");
+ }
+ }
+}