You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by dr...@apache.org on 2017/02/28 14:14:48 UTC
[1/3] brooklyn-library git commit: * Added Redis integration into
hello-world-sql example*
Repository: brooklyn-library
Updated Branches:
refs/heads/master 02475704c -> 269c0436a
* Added Redis integration into hello-world-sql example*
- added Jedis dependency
- updated available.jsp to optionally display Redis link
- added a jsp for the Redis chatroom
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/8540bab9
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/8540bab9
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/8540bab9
Branch: refs/heads/master
Commit: 8540bab993029c9b667ef8121e29dde8ad3dc999
Parents: f3cbc42
Author: Justin Thompson <ju...@cloudsoftcorp.com>
Authored: Tue Feb 7 12:33:30 2017 +0000
Committer: Justin Thompson <ju...@cloudsoftcorp.com>
Committed: Tue Feb 7 12:33:30 2017 +0000
----------------------------------------------------------------------
examples/webapps/hello-world-sql/pom.xml | 5 ++
.../src/main/webapp/available.jsp | 15 +++-
.../hello-world-sql/src/main/webapp/redis.jsp | 80 ++++++++++++++++++++
3 files changed, 96 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/8540bab9/examples/webapps/hello-world-sql/pom.xml
----------------------------------------------------------------------
diff --git a/examples/webapps/hello-world-sql/pom.xml b/examples/webapps/hello-world-sql/pom.xml
index c55d0c7..fdd9189 100644
--- a/examples/webapps/hello-world-sql/pom.xml
+++ b/examples/webapps/hello-world-sql/pom.xml
@@ -101,6 +101,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>redis.clients</groupId>
+ <artifactId>jedis</artifactId>
+ <version>${redis.version}</version>
+ </dependency>
</dependencies>
<build>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/8540bab9/examples/webapps/hello-world-sql/src/main/webapp/available.jsp
----------------------------------------------------------------------
diff --git a/examples/webapps/hello-world-sql/src/main/webapp/available.jsp b/examples/webapps/hello-world-sql/src/main/webapp/available.jsp
index ddb4bf4..443e302 100644
--- a/examples/webapps/hello-world-sql/src/main/webapp/available.jsp
+++ b/examples/webapps/hello-world-sql/src/main/webapp/available.jsp
@@ -41,12 +41,19 @@ The following apps are available:
<ul>
<%
-String url=System.getProperty("brooklyn.example.db.url");
+String mySqlUrl=System.getProperty("brooklyn.example.db.url");
//URL should be supplied e.g. "-Dbrooklyn.example.db.url=jdbc:mysql://localhost/visitors?user=brooklyn&password=br00k11n"
//(note quoting needed due to ampersand)
-if (url!=null) {
+if (mySqlUrl!=null) {
%>
<li><a href="db.jsp">SQL database chatroom</a></li>
+<% }
+
+String redisUrl=System.getProperty("brooklyn.example.redis.host");
+//Host should be supplied e.g. "-Dbrooklyn.example.redis.host=localhost"
+if (redisUrl!=null) {
+%>
+<li><a href="redis.jsp">Redis chatroom</a></li>
<% } %>
<%
@@ -71,9 +78,9 @@ if (hadoop!=null) {
%>
<li><a href="riak.jsp">Riak chatroom</a></li>
<% }
-if (hadoop==null && url==null && mongo==null && riak==null) {
+if (hadoop==null && mySqlUrl==null && mongo==null && riak==null && redisUrl==null) {
%>
-<li><i>None.</i> Try one of the other Brooklyn examples to see SQL or Hadoop.</li>
+<li><i>None.</i> Try one of the other Brooklyn examples to see SQL, Hadoop or Redis</li>
<% } %>
</ul>
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/8540bab9/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp
----------------------------------------------------------------------
diff --git a/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp b/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp
new file mode 100644
index 0000000..6a3bde6
--- /dev/null
+++ b/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp
@@ -0,0 +1,80 @@
+<%@ page import="java.util.List" %>
+<%@ page import="redis.clients.jedis.Jedis" %>
+
+<html>
+<!--
+ 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.
+-->
+<head>
+ <title>Sample Application Database JSP Page</title>
+</head>
+<br/>
+<body bgcolor=white>
+
+<table border="0">
+ <tr>
+ <td align=center>
+ <img src="images/bridge-small.png">
+ </td>
+ <td>
+ <h1>Sample Brooklyn Deployed WebApp (Database JSP)</h1>
+ This is the output of a JSP page that is part of the Hello, World application,
+ deployed by brooklyn, to show <b>Redis database interactivity</b>.
+ </td>
+ </tr>
+</table>
+<br/>
+<p>Visitors:</p>
+<ul>
+<%
+ String redisUrl=System.getProperty("brooklyn.example.redis.host");
+ Jedis jedis = new Jedis(redisUrl);
+
+ if (request.getParameter("name")!=null) {
+ jedis.lpush("messages", request.getParameter("name")+":"+request.getParameter("message"));
+ }
+
+ List<String> messages = jedis.lrange("messages", 0, 10);
+ for (int i =0; i < messages.size(); i++){
+ String[] messageParts = messages.get(i).split(":");
+ String name = messageParts[0];
+ String message = messageParts[1];
+ %>
+ <li> <b><%= name %></b>: <%= message %> </li>
+ <%
+ }
+%>
+
+</ul>
+
+<br/>
+
+<p>Please enter a message:</p>
+
+<form action="redis.jsp" method="GET">
+ <table>
+ <tr><td>Name: </td><td><input type="text" name="name"></td></tr>
+ <tr><td>Message: </td><td><input type="text" name="message"></td></tr>
+ </table>
+ <input type="submit" value="Submit"/>
+</form>
+
+<br/>
+<p>Click <a href="index.html">here</a> to go back to the main page.</p>
+</body>
+</html>
[2/3] brooklyn-library git commit: - updates from review
Posted by dr...@apache.org.
- updates from review
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/3edf0ad1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/3edf0ad1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/3edf0ad1
Branch: refs/heads/master
Commit: 3edf0ad121a5bded77cbf7a3d7d093b705ffe978
Parents: 8540bab
Author: Justin Thompson <ju...@cloudsoftcorp.com>
Authored: Tue Feb 28 13:51:34 2017 +0000
Committer: Justin Thompson <ju...@cloudsoftcorp.com>
Committed: Tue Feb 28 13:51:34 2017 +0000
----------------------------------------------------------------------
examples/webapps/hello-world-sql/src/main/webapp/redis.jsp | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/3edf0ad1/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp
----------------------------------------------------------------------
diff --git a/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp b/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp
index 6a3bde6..7082fc3 100644
--- a/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp
+++ b/examples/webapps/hello-world-sql/src/main/webapp/redis.jsp
@@ -34,7 +34,7 @@
<td>
<h1>Sample Brooklyn Deployed WebApp (Database JSP)</h1>
This is the output of a JSP page that is part of the Hello, World application,
- deployed by brooklyn, to show <b>Redis database interactivity</b>.
+ deployed by Brooklyn, to show <b>Redis database interactivity</b>.
</td>
</tr>
</table>
@@ -56,10 +56,7 @@
String message = messageParts[1];
%>
<li> <b><%= name %></b>: <%= message %> </li>
- <%
- }
-%>
-
+ <% } %>
</ul>
<br/>
[3/3] brooklyn-library git commit: This closes #91
Posted by dr...@apache.org.
This closes #91
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/269c0436
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/269c0436
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/269c0436
Branch: refs/heads/master
Commit: 269c0436aaf891d5dbc12855b85c5ec659c1d3b3
Parents: 0247570 3edf0ad
Author: Duncan Godwin <dr...@googlemail.com>
Authored: Tue Feb 28 14:14:13 2017 +0000
Committer: Duncan Godwin <dr...@googlemail.com>
Committed: Tue Feb 28 14:14:13 2017 +0000
----------------------------------------------------------------------
examples/webapps/hello-world-sql/pom.xml | 5 ++
.../src/main/webapp/available.jsp | 15 +++-
.../hello-world-sql/src/main/webapp/redis.jsp | 77 ++++++++++++++++++++
3 files changed, 93 insertions(+), 4 deletions(-)
----------------------------------------------------------------------