Author: scottbw
Date: Fri Nov 27 12:39:18 2009
New Revision: 884862
URL: http://svn.apache.org/viewvc?rev=884862&view=rev
Log:
Applied patch supporting dynamic build and deploy of widgets (thanks to Ross
Gardler for the patch) and removed the default widgets from the core package
and database creation scripts; these are now added dynamically. (Note that
this means default widgets are no longer placed in categories). This fix
applies to WOOKIE-51
Added:
incubator/wookie/trunk/WebContent/wservices/notsupported/
incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/localizedStrings.js
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/localizedStrings.js
(with props)
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/localizedStrings.js
(with props)
Removed:
incubator/wookie/trunk/WebContent/wservices/www.getwookie.org/
incubator/wookie/trunk/WebContent/wservices/www.tencompetence.org/
Modified:
incubator/wookie/trunk/build.properties
incubator/wookie/trunk/build.xml
incubator/wookie/trunk/scripts/derby/widgetdb.sql
incubator/wookie/trunk/scripts/mysql/widgetdb.sql
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
incubator/wookie/trunk/src/org/apache/wookie/server/Start.java
incubator/wookie/trunk/src/widgetserver.properties
incubator/wookie/trunk/widgets/build.xml
Added: incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm?rev=884862&view=auto
==============================================================================
--- incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm (added)
+++ incubator/wookie/trunk/WebContent/wservices/notsupported/index.htm Fri Nov
27 12:39:18 2009
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<title>Widget type not supported</title>
+<script type='text/javascript' src='/wookie/dwr/util.js'> </script>
+<script type='text/javascript' src='/wookie/dwr/engine.js'> </script>
+<script type='text/javascript' src='/wookie/dwr/interface/WidgetImpl.js'>
</script>
+<script type='text/javascript' src='/wookie/shared/js/wookie-wrapper.js'>
</script>
+
+<script type='text/javascript' src='locales/en/localizedStrings.js'> </script>
+<script type='text/javascript' src='locales/bu/localizedStrings.js'> </script>
+<script>
+
+
+function init(){
+ document.title = LanguageHelper.getLocalizedString('Widget type not
supported');
+ var mainText = "<h3>"+ LanguageHelper.getLocalizedString('Widget
Server') +"</div></h3>";
+ mainText += "<p>"+ LanguageHelper.getLocalizedString('Sorry, but the
widget server does not support this type of widget') +"</p>";
+ document.getElementById('maindiv').innerHTML = mainText
+
+ var langText = LanguageHelper.getLangOpts(updateLanguage)
+ document.getElementById('langdiv').innerHTML = langText;
+}
+
+function updateLanguage(){
+ init();
+}
+
+ </script>
+ </head>
+<body onload="init()">
+ <div id="wrapper">
+ <div id="langdiv">
+ </div>
+ <div id="maindiv"></div>
+ </div>
+</body>
+</html>
\ No newline at end of file
Added:
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/localizedStrings.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/localizedStrings.js?rev=884862&view=auto
==============================================================================
---
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/localizedStrings.js
(added)
+++
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/bu/localizedStrings.js
Fri Nov 27 12:39:18 2009
@@ -0,0 +1,22 @@
+/*
+* not supported strings
+*/
+
+
+var bu_localizedStrings = new Array;
+
+bu_localizedStrings["en"]
+= "bu";
+
+bu_localizedStrings["close"]
+= "заÑвоÑи";
+
+bu_localizedStrings["Widget type not supported"]
+="ÐпÑиÑÑа не Ñе поддÑÑжа";
+
+bu_localizedStrings["Widget Server"]
+="СÑÑвÑÑ Ñ Ð´Ð¾Ð¿ÑлниÑелни опÑии";
+
+bu_localizedStrings["Sorry, but the widget server does not support this type
of widget"]
+= "СÑÑвÑÑÑÑ Ð½Ðµ поддÑÑжа Ñази опÑиÑ";
+
Added:
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/localizedStrings.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/localizedStrings.js?rev=884862&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/en/localizedStrings.js
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/localizedStrings.js
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/localizedStrings.js?rev=884862&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/wookie/trunk/WebContent/wservices/notsupported/locales/fr/localizedStrings.js
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified: incubator/wookie/trunk/build.properties
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/build.properties?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
--- incubator/wookie/trunk/build.properties (original)
+++ incubator/wookie/trunk/build.properties Fri Nov 27 12:39:18 2009
@@ -3,9 +3,30 @@
project.using.derby=true
#project.using.mysql=true
+# Widgets to deploy
+# This is an ant include file that will filter the directories in the widgets
src folder
+# any widgets that match this filter will be deployed at runtime in the
standalone server
+widget.deploy.dir=build/webapp/wookie/deploy
+widget.deploy.include=*/build.xml
+
+# The location of your servlets webapp directory (defaults to location for
standalone server)
+servletEngine.webapp.dir=build/webapp
+
+################################################################################
+################################################################################
# In most cases you will not not to change the settings below this line
# Only change them if you know what you are doing.
+################################################################################
+################################################################################
+
+# build configuration properties
build.dir=build
ivy.repository.dir=ant
-main.class.name=org.apache.wookie.server.Start
\ No newline at end of file
+#widget handling properties
+wookie.widgets.dir=widgets
+widget.deploy.exclude=widget-template/build.xml
+
+#standalone server configuration
+main.class.name=org.apache.wookie.server.Start
+jvmargs=
Modified: incubator/wookie/trunk/build.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/build.xml?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
--- incubator/wookie/trunk/build.xml (original)
+++ incubator/wookie/trunk/build.xml Fri Nov 27 12:39:18 2009
@@ -20,19 +20,38 @@
Ivy based build system for Apache Wookie.
</description>
+ <property file="local.build.properties"/>
<property file="build.properties"/>
<property name="db.name" value="widgetDB" />
+ <property file="${project.core.src.dir}/widgetserver.properties"/>
<import file="ant/ivy-webapp-common.xml"/>
<target name="set-mysql-script-dir" if="project.using.mysql">
<property name="project.scripts.dir" value="scripts/mysql"/>
</target>
+
<target name="set-derby-script-dir" if="project.using.derby">
<property name="project.scripts.dir" value="scripts/derby"/>
</target>
+ <target name="run" depends="deploy-webapp">
+ <ant antfile="ant/ivy-java-common.xml" target="run"/>
+ </target>
+
+ <target name="post-deploy-webapp">
+ <!-- deploy widgets -->
+ <delete dir="${widget.build.dir}"/>
+ <subant antfile="build.xml" target="deploy-widget" inheritall="true">
+ <fileset dir="${wookie.widgets.dir}">
+ <include name="${widget.deploy.include}"/>
+ <exclude name="${widget.deploy.exclude}"/>
+ </fileset>
+ </subant>
+ </target>
+
<target name="post-compile-core" depends="set-mysql-script-dir,
set-derby-script-dir">
+ <!-- copy database resources -->
<copy file="${project.scripts.dir}/widgetdb.sql"
tofile="${project.build.classes.dir}/widgetdb.sql"/>
<copy file="${project.scripts.dir}/hibernate.cfg.xml"
tofile="${project.build.classes.dir}/hibernate.cfg.xml"/>
</target>
Modified: incubator/wookie/trunk/scripts/derby/widgetdb.sql
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scripts/derby/widgetdb.sql?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
--- incubator/wookie/trunk/scripts/derby/widgetdb.sql (original)
+++ incubator/wookie/trunk/scripts/derby/widgetdb.sql Fri Nov 27 12:39:18 2009
@@ -1,7 +1,7 @@
-INSERT INTO Widget VALUES (1,'Unsupported widget widget','','This widget is a
placeholder for when no corresponding widget is found for a given type','Paul
Sharples','/wookie/shared/images/defaultwidget.png','/wookie/wservices/www.tencompetence.org/widgets/default/notsupported/index.htm','http://www.tencompetence.org/widgets/default/notsupported',350,500,'f','v1.0'),(2,'Default
chat widget','','This widget provides a simple chat or Instant messaging
facility','Paul
Sharples','/wookie/shared/images/chat.png','/wookie/wservices/www.tencompetence.org/widgets/default/chat/index.htm','http://www.tencompetence.org/widgets/default/chat',358,500,'f','v1.0'),(3,'Default
discussion/forum widget','','This widget provides a threaded discussion forum
facility','Paul
Sharples','/wookie/shared/images/forum.png','/wookie/wservices/www.tencompetence.org/widgets/default/forum/index.htm','http://www.tencompetence.org/widgets/default/forum',350,520,'t','v1.0'),(4,'Default
vote widget','','This
widget provides a voting facility','Paul
Sharples','/wookie/shared/images/vote.png','/wookie/wservices/www.tencompetence.org/widgets/default/vote/index.htm','http://www.tencompetence.org/widgets/default/vote',350,500,'f','v1.0'),(5,'Natter','','A
simple chat widget','Scott
Wilson','/wookie/wservices/www.getwookie.org/widgets/natter/icon.png','/wookie/wservices/www.getwookie.org/widgets/natter/index.htm','http://www.getwookie.org/widgets/natter',383,255,'F','v1.0'),(6,'Weather','','A
simple weather widget','Scott
Wilson','/wookie/wservices/www.getwookie.org/widgets/weather/icon.png','/wookie/wservices/www.getwookie.org/widgets/weather/index.htm','http://www.getwookie.org/widgets/weather',125,125,'F','v1.0');
-INSERT INTO WidgetDefault VALUES
('unsupported',1),('chat',2),('discussion',3),('forum',3),('vote',4),('natter',5),('weather',6);
-INSERT INTO WidgetService VALUES
(1,'unsupported'),(2,'chat'),(3,'discussion'),(4,'forum'),(5,'vote'),(6,'natter'),(7,'weather');
-INSERT INTO WidgetType VALUES
(1,1,'unsupported'),(2,2,'chat'),(3,3,'forum'),(4,3,'discussion'),(5,4,'vote'),(6,5,'natter'),(7,6,'weather');
+INSERT INTO Widget VALUES (1,'Unsupported widget widget','','This widget is a
placeholder for when no corresponding widget is found for a given type','Paul
Sharples','/wookie/shared/images/defaultwidget.png','/wookie/wservices/notsupported/index.htm','http://notsupported',350,500,'f','v1.0');
+INSERT INTO WidgetDefault VALUES ('unsupported',1);
+INSERT INTO WidgetService VALUES
(1,'unsupported'),(2,'chat'),(3,'games'),(4,'voting'),(5,'weather');
+INSERT INTO WidgetType VALUES (1,1,'unsupported');
INSERT INTO Whitelist VALUES
(1,'http://127.0.0.1'),(2,'http://localhost'),(3,'http://feeds.bbc.co.uk/weather/feeds/rss');
INSERT INTO ServerFeature VALUES
(1,'org.apache.wookie.feature.wave.WaveAPIImpl','http://wave.google.com'),(2,'org.apache.wookie.feature.polling.impl.WookiePollingImpl','http://www.getwookie.org/usefeature/polling');
INSERT INTO ApiKey VALUES (1,'TEST','[email protected]')
\ No newline at end of file
Modified: incubator/wookie/trunk/scripts/mysql/widgetdb.sql
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/scripts/mysql/widgetdb.sql?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
--- incubator/wookie/trunk/scripts/mysql/widgetdb.sql (original)
+++ incubator/wookie/trunk/scripts/mysql/widgetdb.sql Fri Nov 27 12:39:18 2009
@@ -168,10 +168,10 @@
);
-INSERT INTO `Widget` VALUES (1,'Unsupported widget
widget','','/wookie/wservices/www.tencompetence.org/widgets/default/notsupported/index.htm',350,500,'f','http://www.tencompetence.org/widgets/default/notsupported','This
widget is a placeholder for when no corresponding widget is found for a given
type','Paul Sharples','/wookie/shared/images/defaultwidget.png',
'v1.0'),(2,'Default chat
widget','','/wookie/wservices/www.tencompetence.org/widgets/default/chat/index.htm',358,500,'f','http://www.tencompetence.org/widgets/default/chat','This
widget provides a simple chat or Instant messaging facility','Paul
Sharples','/wookie/shared/images/chat.png', 'v1.0'),(3,'Default
discussion/forum
widget','','/wookie/wservices/www.tencompetence.org/widgets/default/forum/index.htm',350,520,'t','http://www.tencompetence.org/widgets/default/forum','This
widget provides a threaded discussion forum facility','Paul
Sharples','/wookie/shared/images/forum.png', 'v1.0'),(4,'Default vote
widget','','
/wookie/wservices/www.tencompetence.org/widgets/default/vote/index.htm',350,500,'f','http://www.tencompetence.org/widgets/default/vote','This
widget provides a voting facility','Paul
Sharples','/wookie/shared/images/vote.png',
'v1.0'),(5,'Natter','','/wookie/wservices/www.getwookie.org/widgets/natter/index.htm',383,255,'F','http://www.getwookie.org/widgets/natter','A
simple chat widget','Scott
Wilson','/wookie/wservices/www.getwookie.org/widgets/natter/icon.png',
'v1.0'),(6,'Weather','','/wookie/wservices/www.getwookie.org/widgets/weather/index.htm',125,125,'F','http://www.getwookie.org/widgets/weather','A
simple weather widget','Scott
Wilson','/wookie/wservices/www.getwookie.org/widgets/weather/icon.png', 'v1.0');
-INSERT INTO `WidgetDefault` VALUES
('unsupported',1),('chat',2),('discussion',3),('forum',3),('vote',4),('natter',5),('weather',6);
-INSERT INTO `WidgetService` VALUES
(1,'unsupported'),(2,'chat'),(3,'discussion'),(4,'forum'),(5,'vote'),(6,'natter'),(7,'weather');
-INSERT INTO `WidgetType` VALUES
(1,1,'unsupported'),(2,2,'chat'),(3,3,'forum'),(4,3,'discussion'),(5,4,'vote'),(6,5,'natter'),(7,6,'weather');
+INSERT INTO `Widget` VALUES (1,'Unsupported widget
widget','','/wookie/wservices/notsupported/index.htm',350,500,'f','http://notsupported','This
widget is a placeholder for when no corresponding widget is found for a given
type','Paul Sharples','/wookie/shared/images/defaultwidget.png', 'v1.0');
+INSERT INTO `WidgetDefault` VALUES ('unsupported',1);
+INSERT INTO `WidgetService` VALUES
(1,'unsupported'),(2,'chat'),(3,'games'),(4,'voting'),(5,'weather');
+INSERT INTO `WidgetType` VALUES (1,1,'unsupported');
INSERT INTO `Whitelist` VALUES
(1,'http://127.0.0.1'),(2,'http://localhost'),(3,'http://feeds.bbc.co.uk/weather/feeds/rss');
INSERT INTO `ServerFeature` VALUES
(1,'http://wave.google.com','org.apache.wookie.feature.wave.WaveAPIImpl'),(2,'http://www.getwookie.org/usefeature/polling','org.apache.wookie.feature.polling.impl.WookiePollingImpl');
INSERT INTO `ApiKey` VALUES (1,'TEST','[email protected]');
\ No newline at end of file
Modified:
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
---
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
(original)
+++
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetsControllerTest.java
Fri Nov 27 12:39:18 2009
@@ -36,7 +36,7 @@
int code = get.getStatusCode();
assertEquals(200,code);
String response = get.getResponseBodyAsString();
- assertTrue(response.contains("<widget id=\"1\"
identifier=\"http://www.tencompetence.org/widgets/default/notsupported\""));
+ assertTrue(response.contains("<widget id=\"1\"
identifier=\"http://notsupported\""));
get.releaseConnection();
}
catch (Exception e) {
@@ -54,7 +54,7 @@
int code = get.getStatusCode();
assertEquals(200,code);
String response = get.getResponseBodyAsString();
- assertTrue(response.contains("<widget id=\"1\"
identifier=\"http://www.tencompetence.org/widgets/default/notsupported\""));
+ assertTrue(response.contains("<widget id=\"1\"
identifier=\"http://notsupported\""));
get.releaseConnection();
}
catch (Exception e) {
@@ -88,7 +88,7 @@
int code = get.getStatusCode();
assertEquals(200,code);
String response = get.getResponseBodyAsString();
- assertTrue(response.contains("<widget id=\"1\"
identifier=\"http://www.tencompetence.org/widgets/default/notsupported\""));
+ assertTrue(response.contains("<widget id=\"1\"
identifier=\"http://notsupported\""));
get.releaseConnection();
}
catch (Exception e) {
Modified: incubator/wookie/trunk/src/org/apache/wookie/server/Start.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/server/Start.java?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/server/Start.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/server/Start.java Fri Nov 27
12:39:18 2009
@@ -74,7 +74,7 @@
WebAppContext context = new WebAppContext();
context.setServer(server);
context.setContextPath("/wookie");
- context.setWar("WebContent");
+ context.setWar("build/webapp/wookie");
server.addHandler(context);
HashUserRealm authedRealm = new HashUserRealm("Authentication
Required","etc/jetty-realm.properties");
Modified: incubator/wookie/trunk/src/widgetserver.properties
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/widgetserver.properties?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
--- incubator/wookie/trunk/src/widgetserver.properties (original)
+++ incubator/wookie/trunk/src/widgetserver.properties Fri Nov 27 12:39:18 2009
@@ -17,7 +17,7 @@
# Set hot_deploy to true, and .wgt files dropped into widget.deployfolder
# will automatically be added to the server
widget.deployfolder=/deploy
-widget.hot_deploy=false
+widget.hot_deploy=true
#######################################################################
# Location of Shindig services
widget.shindig.url=/wookie
Modified: incubator/wookie/trunk/widgets/build.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/widgets/build.xml?rev=884862&r1=884861&r2=884862&view=diff
==============================================================================
--- incubator/wookie/trunk/widgets/build.xml (original)
+++ incubator/wookie/trunk/widgets/build.xml Fri Nov 27 12:39:18 2009
@@ -18,7 +18,7 @@
<project default="build-widget" basedir="." name="Wookie_widgets_build_file">
<property name="wookie.widgets.dir" location="."/>
<property name="widget.template.dir"
value="${wookie.widgets.dir}/widget-template"/>
- <property name="widget.build.dir" value="${wookie.widgets.dir}/build"/>
+ <property name="widget.build.dir" value="${project.build.dir}/widgets"/>
<target name="_get-widget-name" unless="widget.shortname">
<input message="What is the short name of the widget you wish
to work with?"
@@ -60,4 +60,10 @@
/>
<echo>Widget package created at
${widget.build.dir}/${widget.shortname}.wgt</echo>
</target>
+
+ <target name="deploy-widget" depends="build-widget">
+ <copy tofile="${widget.deploy.dir}/${widget.shortname}.wgt"
+ file="${widget.build.dir}/${widget.shortname}.wgt"/>
+ <echo>Deployed ${widget.shortname} to
${project.build.classes.dir}/${widget.deploy.dir}/${widget.shortname}.wgt</echo>
+ </target>
</project>