[kune-commits] r1529 - in trunk: . src/main/java/cc/kune/core/server src/main/java/cc/kune/core/server/auth src/main/java/cc/kune/core/server/manager/file src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/lists/server src/main/java/cc/kune/lists/server/rpc src/main/java/cc/kune/wave/client src/main/java/cc/kune/wave/server src/test/java/cc/kune/core/server/integration src/test/java/cc/kune/selenium src/test/java/cc/kune/selenium/tools src/test/java/cc/kune/wave/server
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Fri Sep 23 19:07:21 CEST 2011
Author: vjrj_
Date: 2011-09-23 19:07:21 +0200 (Fri, 23 Sep 2011)
New Revision: 1529
Added:
trunk/src/main/java/cc/kune/core/server/LogThis.java
trunk/src/main/java/cc/kune/core/server/UserSessionManager.java
Removed:
trunk/src/main/java/cc/kune/wave/server/AbstractBaseRobotAgent.java
Modified:
trunk/
trunk/.classpath
trunk/DEV-GUIDE
trunk/TODO
trunk/pom.xml
trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
trunk/src/main/java/cc/kune/core/server/UserSession.java
trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java
trunk/src/main/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptor.java
trunk/src/main/java/cc/kune/core/server/auth/SuperAdminMethodInterceptor.java
trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java
trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/RPC.java
trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java
trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java
trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java
trunk/src/main/java/cc/kune/wave/client/WebClient.java
trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java
trunk/src/main/java/cc/kune/wave/server/KuneAgent.java
trunk/src/main/java/cc/kune/wave/server/WaveMain.java
trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java
trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java
trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java
Log:
NEW - # 105: Persist user sessions between restarts
http://kune.ourproject.org/issues/ticket/105
NEW - # 53: Add Selenium Framework testing
http://kune.ourproject.org/issues/ticket/53
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
- pmd-eclipse.log
.pmd
www-test
screenlog.0
client
public
target
target-local
Main-compile
.settings
.gwt-cache
repository
derby.log
star-yellow-grey.png
run.sh
tomcat
gwt-out
synccss.sh
.externalToolBuilders
.wtpmodules
www
testRepository
kune-OLD-jcr
KuneApp.launch
KuneApp NOSERVER.launch
old_src
org.ourproject.kune.app.Kune
org.ourproject.kune.iml
org.ourproject.kune.ipr
org.ourproject.kune.iws
nbproject
hibernate.reveng.xml
.gwt-tmp
target-eclipse
.checkstyle
.classpath-bien
pom.xml.*
.gwt
.jdee_sources
.jdee_classpath
prj.el
.factorypath
.apt_generated
target.old
_accounts
_certificates
_deltas
logs
test-output
.recommenders
+ pmd-eclipse.log
.pmd
www-test
screenlog.0
client
public
target
target-local
Main-compile
.settings
.gwt-cache
repository
derby.log
star-yellow-grey.png
run.sh
tomcat
gwt-out
synccss.sh
.externalToolBuilders
.wtpmodules
www
testRepository
kune-OLD-jcr
KuneApp.launch
KuneApp NOSERVER.launch
old_src
org.ourproject.kune.app.Kune
org.ourproject.kune.iml
org.ourproject.kune.ipr
org.ourproject.kune.iws
nbproject
hibernate.reveng.xml
.gwt-tmp
target-eclipse
.checkstyle
.classpath-bien
pom.xml.*
.gwt
.jdee_sources
.jdee_classpath
prj.el
.factorypath
.apt_generated
target.old
_accounts
_certificates
_deltas
logs
test-output
.recommenders
_sessions
chromedriver.log
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/.classpath 2011-09-23 17:07:21 UTC (rev 1529)
@@ -11,19 +11,19 @@
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/appengine/appengine-api-1.0-sdk/1.3.1/appengine-api-1.0-sdk-1.3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.1-SNAPSHOT/box-0.3.1-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.1-SNAPSHOT/box-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.2-SNAPSHOT/box-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.2-SNAPSHOT/box-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
<classpathentry kind="var" path="M2_REPO/c3p0/c3p0/0.9.1/c3p0-0.9.1.jar" sourcepath="M2_REPO/c3p0/c3p0/0.9.1/c3p0-0.9.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar" sourcepath="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client/0.3.1-SNAPSHOT/client-0.3.1-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common/0.3.1-SNAPSHOT/client-common-0.3.1-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common-src/0.3.1-SNAPSHOT/client-common-src-0.3.1-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.1-SNAPSHOT/client-scheduler-src-0.3.1-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-src/0.3.1-SNAPSHOT/client-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client/0.3.2-SNAPSHOT/client-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common/0.3.2-SNAPSHOT/client-common-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common-src/0.3.2-SNAPSHOT/client-common-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.2-SNAPSHOT/client-scheduler-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-src/0.3.2-SNAPSHOT/client-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/cobogw/gwt/cobogw/1.3.1/cobogw-1.3.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/common-src/0.3.1-SNAPSHOT/common-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/common-src/0.3.2-SNAPSHOT/common-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar" sourcepath="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.2/commons-cli-1.2.jar" sourcepath="M2_REPO/commons-cli/commons-cli/1.2/commons-cli-1.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4-sources.jar"/>
@@ -32,8 +32,8 @@
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.3.1/commons-io-1.3.1.jar" sourcepath="M2_REPO/commons-io/commons-io/1.3.1/commons-io-1.3.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.5/commons-lang-2.5.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.5/commons-lang-2.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/communication-src/0.3.1-SNAPSHOT/communication-src-0.3.1-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.1-SNAPSHOT/concurrencycontrol-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/communication-src/0.3.2-SNAPSHOT/communication-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.2-SNAPSHOT/concurrencycontrol-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/crawl_htmlunit/r5662-gae/crawl_htmlunit-r5662-gae.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5.jar" sourcepath="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
@@ -55,7 +55,7 @@
<classpathentry kind="var" path="M2_REPO/com/allen_sauer/gwt/log/gwt-log/gwt-log/3.0.1/gwt-log-3.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-servlet/2.1.1/gwt-servlet-2.1.1.jar" sourcepath="M2_REPO/com/google/gwt/gwt-servlet/2.1.1/gwt-servlet-2.1.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.1.1/gwt-user-2.1.1.jar" sourcepath="M2_REPO/com/google/gwt/gwt-user/2.1.1/gwt-user-2.1.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/gwt-util-src/0.3.1-SNAPSHOT/gwt-util-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/gwt-util-src/0.3.2-SNAPSHOT/gwt-util-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/com/allen_sauer/gwt/voices/gwt-voices/gwt-voices/2.0.0/gwt-voices-2.0.0.jar"/>
<classpathentry kind="var" path="M2_REPO/com/gwtext/gwtext/2.0.5/gwtext-2.0.5.jar"/>
<classpathentry kind="var" path="M2_REPO/com/gwtextux/gwtextux/0.4.0.924/gwtextux-0.4.0.924.jar"/>
@@ -113,16 +113,16 @@
<classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-profile/2.0/maven-profile-2.0.jar" sourcepath="M2_REPO/org/apache/maven/maven-profile/2.0/maven-profile-2.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0/maven-project-2.0.jar" sourcepath="M2_REPO/org/apache/maven/maven-project/2.0/maven-project-2.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0.jar" sourcepath="M2_REPO/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/media-src/0.3.1-SNAPSHOT/media-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/media-src/0.3.2-SNAPSHOT/media-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mockito/mockito-core/1.8.5/mockito-core-1.8.5.jar" sourcepath="M2_REPO/org/mockito/mockito-core/1.8.5/mockito-core-1.8.5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/model-src/0.3.1-SNAPSHOT/model-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/model-src/0.3.2-SNAPSHOT/model-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mvel/mvel2/2.0.16/mvel2-2.0.16.jar" sourcepath="M2_REPO/org/mvel/mvel2/2.0.16/mvel2-2.0.16-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/mysql/mysql-connector-java/5.1.13/mysql-connector-java-5.1.13.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.15/nekohtml-1.9.15.jar" sourcepath="M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.15/nekohtml-1.9.15-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/objenesis/objenesis/1.0/objenesis-1.0.jar" sourcepath="M2_REPO/org/objenesis/objenesis/1.0/objenesis-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.jar" sourcepath="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar" sourcepath="M2_REPO/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/proto-msg/0.3.1-SNAPSHOT/proto-msg-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/proto-msg/0.3.2-SNAPSHOT/proto-msg-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/w3c/css/sac/1.3/sac-1.3.jar" sourcepath="M2_REPO/org/w3c/css/sac/1.3/sac-1.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-android-driver/2.6.0/selenium-android-driver-2.6.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-android-driver/2.6.0/selenium-android-driver-2.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-api/2.6.0/selenium-api-2.6.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-api/2.6.0/selenium-api-2.6.0-sources.jar"/>
@@ -144,9 +144,9 @@
<classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/testng/testng/6.2.1/testng-6.2.1.jar" sourcepath="M2_REPO/org/testng/testng/6.2.1/testng-6.2.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/tigase/tigase-xmltools/3.3.5/tigase-xmltools-3.3.5.jar" sourcepath="M2_REPO/tigase/tigase-xmltools/3.3.5/tigase-xmltools-3.3.5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/util-src/0.3.1-SNAPSHOT/util-src-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/util-src/0.3.2-SNAPSHOT/util-src-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.jar" sourcepath="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-0.3/0.3.1-SNAPSHOT/waveinabox-server-0.3-0.3.1-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-0.3/0.3.2-SNAPSHOT/waveinabox-server-0.3-0.3.2-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1.jar" sourcepath="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
@@ -155,4 +155,4 @@
<classpathentry kind="var" path="M2_REPO/org/xwiki/platform/xwiki-web-gwt-dom/2.3-rc-1/xwiki-web-gwt-dom-2.3-rc-1.jar" sourcepath="M2_REPO/org/xwiki/platform/xwiki-web-gwt-dom/2.3-rc-1/xwiki-web-gwt-dom-2.3-rc-1-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path=".apt_generated" including="**/*.java"/> <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
-</classpath>
\ No newline at end of file
+</classpath>
Modified: trunk/DEV-GUIDE
===================================================================
--- trunk/DEV-GUIDE 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/DEV-GUIDE 2011-09-23 17:07:21 UTC (rev 1529)
@@ -307,6 +307,26 @@
See class WaveClientProvider in Kune (in a short term, we should define this in a .gwt.xml not there, but this is a start point).
+== kune maven repo ==
+
+For upload packages you need to configure in .m2/settings.xml something like:
+
+<?xml version="1.0" encoding="UTF-8"?>
+<settings>
+ <servers>
+ <server>
+ <id>kune.ourproject.org</id>
+ <username>YOUR_USER_IN_OURPROJECT_ORG</username>
+ </server>
+ </servers>
+</settings>
+
+also you have to
+ ssh-copy-id YOUR_USER_IN_OURPROJECT_ORG at ourproject.org
+and access via ssh with that key without problems.
+
+We usually upload new packages to this repo via bin/repopubli.sh
+
==Changelog==
Periodically update the Changelog using svn2cl:
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/TODO 2011-09-23 17:07:21 UTC (rev 1529)
@@ -284,6 +284,11 @@
2007-12-21 10:35:16,197 [btpool0-5] DEBUG - ContentManagerDefault.createContent EXCEPTION => javax.persistence.Entity
** vjrj <v> IconHyperlink.java and IconLabel.java to gwt1.5
+** chromium & selenium
+http://www.chromium.org/developers/testing/webdriver-for-chrome
+/usr/bin/chromiumdriver
+chmod og+rx /usr/bin/chromiumdriver
+
** Memory use in demo
http://rimuhosting.com/howto/memory.jsp
Resolving: High Java Memory Usage
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/pom.xml 2011-09-23 17:07:21 UTC (rev 1529)
@@ -562,17 +562,17 @@
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>waveinabox-server-0.3</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>proto-msg</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>gwt-util-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
@@ -582,67 +582,67 @@
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>box</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>box-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>model-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>client</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>client-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>client-common</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>client-common-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>common-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>util-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>concurrencycontrol-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>client-scheduler-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>media-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.waveprotocol</groupId>
<artifactId>communication-src</artifactId>
- <version>0.3.1-SNAPSHOT</version>
+ <version>0.3.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.findbugs</groupId>
Modified: trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -87,7 +87,8 @@
@Override
public void configure() {
install(FinderRegistry.init(new JpaPersistModule(jpaUnit)));
- bindInterceptor(Matchers.any(), new NotInObject(), new LoggerMethodInterceptor());
+ bindInterceptor(Matchers.annotatedWith(LogThis.class), new NotInObject(),
+ new LoggerMethodInterceptor());
bindConstant().annotatedWith(PropertiesFileName.class).to(kuneConfig);
if (sessionScope != null) {
bindScope(SessionScoped.class, sessionScope);
Added: trunk/src/main/java/cc/kune/core/server/LogThis.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/LogThis.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/LogThis.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -0,0 +1,14 @@
+package cc.kune.core.server;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import com.google.inject.BindingAnnotation;
+
+/**
+ * Anotate the classes you want to log via Guice interceptors
+ */
+ at BindingAnnotation
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface LogThis {
+}
Modified: trunk/src/main/java/cc/kune/core/server/UserSession.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/UserSession.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/UserSession.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -19,56 +19,35 @@
*/
package cc.kune.core.server;
+import java.io.Serializable;
-import cc.kune.core.server.manager.UserManager;
-import cc.kune.domain.User;
-
-import com.google.inject.Inject;
import com.google.inject.servlet.SessionScoped;
@SessionScoped
-public class UserSession {
- private String userHash;
- private Long userId;
- private final UserManager manager;
+public class UserSession implements Serializable {
- @Inject
- public UserSession(final UserManager manager) {
- this.manager = manager;
- }
+ private static final long serialVersionUID = 4665523798343705868L;
- public String getHash() {
- return userHash;
- }
+ private String userHash;
+ private Long userId;
- public User getUser() {
- return manager.find(userId);
- }
+ public UserSession() {
+ }
- public boolean isUserLoggedIn() {
- return userId != null;
- }
+ public String getHash() {
+ return userHash;
+ }
- public boolean isUserNotLoggedIn() {
- return !isUserLoggedIn();
- }
+ public Long getUserId() {
+ return userId;
+ }
- public void login(final User user, final String newUserHash) {
- setUser(user);
- setHash(newUserHash);
- }
+ public void setHash(final String hash) {
+ this.userHash = hash;
+ }
- public void logout() {
- userId = null;
- userHash = null;
- }
+ public void setUserId(final Long userId) {
+ this.userId = userId;
+ }
- private void setHash(final String hash) {
- this.userHash = hash;
- }
-
- private void setUser(final User user) {
- userId = user.getId();
- }
-
}
Added: trunk/src/main/java/cc/kune/core/server/UserSessionManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/UserSessionManager.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/UserSessionManager.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -0,0 +1,51 @@
+package cc.kune.core.server;
+
+import cc.kune.core.server.manager.UserManager;
+import cc.kune.domain.User;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class UserSessionManager {
+
+ private final UserManager manager;
+ private final Provider<UserSession> userSessionProv;
+
+ @Inject
+ public UserSessionManager(final UserManager manager, final Provider<UserSession> userSessionProv) {
+ this.manager = manager;
+ this.userSessionProv = userSessionProv;
+ }
+
+ public String getHash() {
+ return getUserSession().getHash();
+ }
+
+ public User getUser() {
+ return manager.find(getUserSession().getUserId());
+ }
+
+ private UserSession getUserSession() {
+ return userSessionProv.get();
+ }
+
+ public boolean isUserLoggedIn() {
+ return getUserSession().getUserId() != null;
+ }
+
+ public boolean isUserNotLoggedIn() {
+ return !isUserLoggedIn();
+ }
+
+ public void login(final Long userId, final String newUserHash) {
+ getUserSession().setUserId(userId);
+ getUserSession().setHash(newUserHash);
+ }
+
+ public void logout() {
+ getUserSession().setUserId(null);
+ getUserSession().setHash(null);
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/auth/AuthenticatedMethodInterceptor.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -28,7 +28,7 @@
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.errors.UserMustBeLoggedException;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -47,7 +47,7 @@
// @Inject
// private UnitOfWork unitOfWork;
@Inject
- Provider<UserSession> userSessionProvider;
+ UserSessionManager userSessionManager;
@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
@@ -63,8 +63,6 @@
LOG.info("Method: " + invocation.getMethod().getName());
LOG.info("Userhash received: " + userHash);
LOG.info("--------------------------------------------------------------------------------");
- final UserSession userSession = userSessionProvider.get();
- // final SessionService sessionService = sessionServiceProvider.get();
final Authenticated authAnnotation = invocation.getStaticPart().getAnnotation(Authenticated.class);
final boolean mandatory = authAnnotation.mandatory();
@@ -72,19 +70,19 @@
if (userHash == null && mandatory) {
// sessionService.getNewSession();
throw new UserMustBeLoggedException();
- } else if (userSession.isUserNotLoggedIn() && mandatory) {
+ } else if (userSessionManager.isUserNotLoggedIn() && mandatory) {
// sessionService.getNewSession();
LOG.info("Session expired (not logged in server and mandatory)");
throw new SessionExpiredException();
- } else if (userSession.isUserNotLoggedIn() && userHash == null) {
+ } else if (userSessionManager.isUserNotLoggedIn() && userHash == null) {
// Ok, do nothing
- } else if (userSession.isUserNotLoggedIn() && userHash != null) {
+ } else if (userSessionManager.isUserNotLoggedIn() && userHash != null) {
// sessionService.getNewSession();
LOG.info("Session expired (not logged in server)");
throw new SessionExpiredException();
- } else if (!userSession.getHash().equals(userHash)) {
- final String serverHash = userSession.getHash();
- userSession.logout();
+ } else if (!userSessionManager.getHash().equals(userHash)) {
+ final String serverHash = userSessionManager.getHash();
+ userSessionManager.logout();
// sessionService.getNewSession();
LOG.info("Session expired (userHash: " + userHash + " different from server hash: " + serverHash
+ ")");
Modified: trunk/src/main/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptor.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/auth/AuthorizatedMethodInterceptor.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -25,7 +25,7 @@
import org.aopalliance.intercept.MethodInvocation;
import cc.kune.core.client.errors.AccessViolationException;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.access.AccessRightsUtils;
import cc.kune.core.server.access.AccessService;
import cc.kune.core.server.content.ContentUtils;
@@ -49,14 +49,14 @@
@Inject
private Provider<GroupManager> groupManagerProvider;
@Inject
- private Provider<UserSession> userSessionProvider;
+ private Provider<UserSessionManager> userSessionProvider;
@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
final Object[] arguments = invocation.getArguments();
final StateToken token = (StateToken) arguments[1];
- final UserSession userSession = userSessionProvider.get();
+ final UserSessionManager userSession = userSessionProvider.get();
final GroupManager groupManager = groupManagerProvider.get();
final AccessService accessService = accessServiceProvider.get();
Modified: trunk/src/main/java/cc/kune/core/server/auth/SuperAdminMethodInterceptor.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/auth/SuperAdminMethodInterceptor.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/auth/SuperAdminMethodInterceptor.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -29,7 +29,7 @@
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.errors.UserMustBeLoggedException;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.access.AccessRightsUtils;
import cc.kune.core.server.properties.KuneProperties;
import cc.kune.core.shared.domain.AccessRol;
@@ -54,7 +54,7 @@
Provider<SessionService> sessionServiceProvider;
private Group siteGroup;
@Inject
- Provider<UserSession> userSessionProvider;
+ UserSessionManager userSessionManager;
@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
@@ -66,7 +66,6 @@
LOG.info("Method: " + invocation.getMethod().getName());
LOG.info("Userhash received: " + userHash);
LOG.info("--------------------------------------------------------------------------------");
- final UserSession userSession = userSessionProvider.get();
final SuperAdmin authAnnotation = invocation.getStaticPart().getAnnotation(SuperAdmin.class);
final AccessRol rol = authAnnotation.rol();
@@ -78,11 +77,11 @@
if (userHash == null) {
throw new UserMustBeLoggedException();
- } else if (userSession.isUserNotLoggedIn()) {
+ } else if (userSessionManager.isUserNotLoggedIn()) {
LOG.info("Session expired (not logged in server and mandatory)");
throw new SessionExpiredException();
} else {
- User user = userSession.getUser();
+ final User user = userSessionManager.getUser();
if (!AccessRightsUtils.correctMember(user, siteGroup, rol)) {
throw new AccessViolationException();
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/manager/file/FileUploadManager.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -25,7 +25,7 @@
import org.apache.commons.fileupload.FileItem;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.access.AccessService;
import cc.kune.core.server.auth.ActionLevel;
import cc.kune.core.server.auth.Authenticated;
@@ -60,7 +60,7 @@
@Inject
I18nTranslationService i18n;
@Inject
- UserSession userSession;
+ UserSessionManager userSession;
@Override
protected void beforePostStart() {
Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -31,7 +31,7 @@
import cc.kune.core.client.errors.NoDefaultContentException;
import cc.kune.core.client.errors.ToolNotFoundException;
import cc.kune.core.client.rpcservices.ContentService;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.access.AccessRightsService;
import cc.kune.core.server.access.AccessService;
import cc.kune.core.server.access.FinderService;
@@ -68,7 +68,6 @@
import cc.kune.domain.User;
import com.google.inject.Inject;
-import com.google.inject.Provider;
import com.google.inject.persist.Transactional;
public class ContentRPC implements ContentService, RPC {
@@ -83,18 +82,18 @@
private final AccessRightsService rightsService;
private final StateService stateService;
private final TagUserContentManager tagManager;
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSession;
private final KuneWaveManager waveManager;
@Inject
- public ContentRPC(final FinderService finderService, final Provider<UserSession> userSessionProvider,
+ public ContentRPC(final FinderService finderService, final UserSessionManager userSession,
final AccessService accessService, final AccessRightsService rightsService,
final StateService stateService, final CreationService creationService,
final GroupManager groupManager, final ContentManager contentManager,
final ContainerManager containerManager, final TagUserContentManager tagManager,
final Mapper mapper, final ChatManager chatManager, final KuneWaveManager waveManager) {
this.finderService = finderService;
- this.userSessionProvider = userSessionProvider;
+ this.userSession = userSession;
this.accessService = accessService;
this.rightsService = rightsService;
this.stateService = stateService;
@@ -249,7 +248,7 @@
}
private User getCurrentUser() {
- return getUserSession().getUser();
+ return userSession.getUser();
}
public StateContainerDTO getState(final Container container) {
@@ -284,12 +283,8 @@
return getSummaryTags(group);
}
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
private boolean isUserLoggedIn() {
- return getUserSession().isUserLoggedIn();
+ return userSession.isUserLoggedIn();
}
private void mapContentRightsInstate(final User user, final AccessLists groupAccessList,
Modified: trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/rpc/GroupRPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -22,7 +22,7 @@
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.GroupService;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.auth.ActionLevel;
import cc.kune.core.server.auth.Authenticated;
import cc.kune.core.server.auth.Authorizated;
@@ -41,7 +41,6 @@
import cc.kune.domain.User;
import com.google.inject.Inject;
-import com.google.inject.Provider;
import com.google.inject.persist.Transactional;
public class GroupRPC implements RPC, GroupService {
@@ -50,13 +49,13 @@
private final GroupManager groupManager;
private final Mapper mapper;
private final ReservedWordsRegistry reserverdWords;
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSessionManager;
@Inject
- public GroupRPC(final Provider<UserSession> userSessionProvider, final GroupManager groupManager,
+ public GroupRPC(final UserSessionManager userSessionManager, final GroupManager groupManager,
final ContentManager contentManager, final Mapper mapper,
final ReservedWordsRegistry reserverdWords, final ContentRPC contentRPC) {
- this.userSessionProvider = userSessionProvider;
+ this.userSessionManager = userSessionManager;
this.groupManager = groupManager;
this.contentManager = contentManager;
this.mapper = mapper;
@@ -120,15 +119,10 @@
}
private User getUserLogged() {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
+ final User user = userSessionManager.getUser();
return user;
}
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
@Override
@Authenticated(mandatory = true)
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
Modified: trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/rpc/I18nRPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -28,7 +28,7 @@
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.errors.SessionExpiredException;
import cc.kune.core.client.rpcservices.I18nService;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.auth.Authenticated;
import cc.kune.core.server.auth.SuperAdmin;
import cc.kune.core.server.manager.I18nLanguageManager;
@@ -49,15 +49,14 @@
private final I18nLanguageManager languageManager;
private final Mapper mapper;
private final Provider<HttpServletRequest> requestProvider;
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSessionManager;
@Inject
public I18nRPC(final Provider<HttpServletRequest> requestProvider,
- final Provider<UserSession> userSessionProvider,
- final I18nTranslationManager i18nTranslationManager, final I18nLanguageManager languageManager,
- final Mapper mapper) {
+ final UserSessionManager userSessionManager, final I18nTranslationManager i18nTranslationManager,
+ final I18nLanguageManager languageManager, final Mapper mapper) {
this.requestProvider = requestProvider;
- this.userSessionProvider = userSessionProvider;
+ this.userSessionManager = userSessionManager;
this.i18nTranslationManager = i18nTranslationManager;
this.languageManager = languageManager;
this.mapper = mapper;
@@ -68,12 +67,11 @@
public I18nLanguageDTO getInitialLanguage(final String localeParam) {
String initLanguage;
I18nLanguage lang;
- final UserSession userSession = getUserSession();
if (localeParam != null) {
initLanguage = localeParam;
} else {
- if (userSession.isUserLoggedIn()) {
- initLanguage = userSession.getUser().getLanguage().getCode();
+ if (userSessionManager.isUserLoggedIn()) {
+ initLanguage = userSessionManager.getUser().getLanguage().getCode();
} else {
final String browserLang = requestProvider.get().getLocale().getLanguage();
if (browserLang != null) {
@@ -134,10 +132,6 @@
return i18nTranslationManager.getTranslation(language, text, noteForTranslators);
}
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
@Override
@Authenticated
@Transactional
Modified: trunk/src/main/java/cc/kune/core/server/rpc/RPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/RPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/rpc/RPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.server.rpc;
+import cc.kune.core.server.LogThis;
+
import com.google.inject.Singleton;
/**
@@ -35,6 +37,7 @@
*
*/
@Singleton
+ at LogThis
public interface RPC {
}
Modified: trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -26,7 +26,7 @@
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.SiteService;
import cc.kune.core.server.InitData;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.manager.ExtMediaDescripManager;
import cc.kune.core.server.manager.I18nCountryManager;
import cc.kune.core.server.manager.I18nLanguageManager;
@@ -45,7 +45,6 @@
import cc.kune.core.shared.dto.UserInfoDTO;
import com.google.inject.Inject;
-import com.google.inject.Provider;
import com.google.inject.persist.Transactional;
public class SiteRPC implements RPC, SiteService {
@@ -61,16 +60,15 @@
private final ServerToolRegistry serverToolRegistry;
private final HashMap<String, GSpaceTheme> siteThemes;
private final UserInfoService userInfoService;
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSessionManager;
- // TODO: refactor: too many parameters! refactor to Facade Pattern
@Inject
- public SiteRPC(final Provider<UserSession> userSessionProvider, final UserManager userManager,
+ public SiteRPC(final UserSessionManager userSessionManager, final UserManager userManager,
final UserInfoService userInfoService, final LicenseManager licenseManager, final Mapper mapper,
final KuneProperties kuneProperties, final ChatProperties chatProperties,
final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
final ServerToolRegistry serverToolRegistry, final ExtMediaDescripManager extMediaDescManager) {
- this.userSessionProvider = userSessionProvider;
+ this.userSessionManager = userSessionManager;
this.userInfoService = userInfoService;
this.licenseManager = licenseManager;
this.mapper = mapper;
@@ -93,9 +91,9 @@
@Transactional
public InitDataDTO getInitData(final String userHash) throws DefaultException {
final InitDataDTO dataMapped = mapper.map(data, InitDataDTO.class);
- final UserSession userSession = getUserSession();
- final UserInfo userInfo = userInfoService.buildInfo(userSession.getUser(), userSession.getHash());
+ final UserInfo userInfo = userInfoService.buildInfo(userSessionManager.getUser(),
+ userSessionManager.getHash());
if (userInfo != null) {
dataMapped.setUserInfo(mapper.map(userInfo, UserInfoDTO.class));
}
@@ -120,10 +118,6 @@
return theme;
}
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
private InitData loadInitData() {
data = new InitData();
data.setSiteUrl(kuneProperties.get(KuneProperties.SITE_URL));
Modified: trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/rpc/SocialNetworkRPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -21,7 +21,7 @@
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.SocialNetworkService;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.auth.ActionLevel;
import cc.kune.core.server.auth.Authenticated;
import cc.kune.core.server.auth.Authorizated;
@@ -36,7 +36,6 @@
import cc.kune.domain.User;
import com.google.inject.Inject;
-import com.google.inject.Provider;
import com.google.inject.persist.Transactional;
public class SocialNetworkRPC implements SocialNetworkService, RPC {
@@ -44,13 +43,12 @@
private final GroupManager groupManager;
private final Mapper mapper;
private final SocialNetworkManager socialNetworkManager;
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSessionManager;
@Inject
- public SocialNetworkRPC(final Provider<UserSession> userSessionProvider,
- final GroupManager groupManager, final SocialNetworkManager socialNetworkManager,
- final Mapper mapper) {
- this.userSessionProvider = userSessionProvider;
+ public SocialNetworkRPC(final UserSessionManager userSessionManager, final GroupManager groupManager,
+ final SocialNetworkManager socialNetworkManager, final Mapper mapper) {
+ this.userSessionManager = userSessionManager;
this.groupManager = groupManager;
this.socialNetworkManager = socialNetworkManager;
this.mapper = mapper;
@@ -62,8 +60,7 @@
@Transactional
public SocialNetworkDataDTO acceptJoinGroup(final String hash, final StateToken groupToken,
final String groupToAcceptShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToAccept = groupManager.findByShortName(groupToAcceptShortName);
@@ -77,8 +74,7 @@
@Transactional
public SocialNetworkDataDTO addAdminMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
@@ -92,8 +88,7 @@
@Transactional
public SocialNetworkDataDTO addCollabMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
@@ -107,8 +102,7 @@
@Transactional
public SocialNetworkDataDTO addViewerMember(final String hash, final StateToken groupToken,
final String groupToAddShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToAdd = groupManager.findByShortName(groupToAddShortName);
@@ -129,8 +123,7 @@
@Transactional
public SocialNetworkDataDTO deleteMember(final String hash, final StateToken groupToken,
final String groupToDeleleShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToDelete = groupManager.findByShortName(groupToDeleleShortName);
@@ -144,8 +137,7 @@
@Transactional
public SocialNetworkDataDTO denyJoinGroup(final String hash, final StateToken groupToken,
final String groupToDenyShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToDenyJoin = groupManager.findByShortName(groupToDenyShortName);
@@ -165,23 +157,17 @@
@Transactional
public SocialNetworkDataDTO getSocialNetwork(final String hash, final StateToken groupToken)
throws DefaultException {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
+ final User user = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
return generateResponse(user, group);
}
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
@Override
@Authenticated
@Transactional
public SocialNetworkRequestResult requestJoinGroup(final String hash, final StateToken groupToken)
throws DefaultException {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
+ final User user = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
return socialNetworkManager.requestToJoin(user, group);
@@ -193,8 +179,7 @@
@Transactional
public SocialNetworkDataDTO setAdminAsCollab(final String hash, final StateToken groupToken,
final String groupToSetCollabShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToSetCollab = groupManager.findByShortName(groupToSetCollabShortName);
@@ -208,8 +193,7 @@
@Transactional
public SocialNetworkDataDTO setCollabAsAdmin(final String hash, final StateToken groupToken,
final String groupToSetAdminShortName) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
final Group groupToSetAdmin = groupManager.findByShortName(groupToSetAdminShortName);
@@ -221,8 +205,7 @@
@Authenticated
@Transactional
public void unJoinGroup(final String hash, final StateToken groupToken) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User userLogged = userSession.getUser();
+ final User userLogged = userSessionManager.getUser();
final Group group = groupManager.findByShortName(groupToken.getGroup());
checkIsNotPersonalGroup(group);
socialNetworkManager.unJoinGroup(userLogged.getUserGroup(), group);
Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -31,6 +31,7 @@
import cc.kune.core.client.errors.UserAuthException;
import cc.kune.core.client.rpcservices.UserService;
import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.auth.ActionLevel;
import cc.kune.core.server.auth.Authenticated;
import cc.kune.core.server.auth.Authorizated;
@@ -63,7 +64,7 @@
private final ReservedWordsRegistry reserverdWords;
private final UserInfoService userInfoService;
private final UserManager userManager;
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSessionManager;
private final Boolean useSocketIO;
private final CustomWaveClientServlet waveClientServlet;
private final SessionManager waveSessionManager;
@@ -73,8 +74,8 @@
@Named(CoreSettings.USE_SOCKETIO) final Boolean useSocketIO,
final UserInfoService userInfoService, final Mapper mapper,
final SessionManager waveSessionManager, final CustomWaveClientServlet waveClientServlet,
- final ReservedWordsRegistry reserverdWords, final ContentRPC contentRPC) {
- this.userSessionProvider = userSessionProvider;
+ final ReservedWordsRegistry reserverdWords, final ContentRPC contentRPC,
+ final UserSessionManager userSessionManager) {
this.userManager = userManager;
this.useSocketIO = useSocketIO;
this.userInfoService = userInfoService;
@@ -83,6 +84,7 @@
this.waveClientServlet = waveClientServlet;
this.reserverdWords = reserverdWords;
this.contentRPC = contentRPC;
+ this.userSessionManager = userSessionManager;
}
@Override
@@ -101,8 +103,7 @@
@Authorizated(accessRolRequired = AccessRol.Administrator, actionLevel = ActionLevel.group)
public String getUserAvatarBaser64(final String userHash, final StateToken userToken)
throws DefaultException {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
+ final User user = userSessionManager.getUser();
final Group userGroup = user.getUserGroup();
if (!userGroup.getShortName().equals(userToken.getGroup())) {
throw new AccessViolationException();
@@ -114,10 +115,6 @@
}
}
- private UserSession getUserSession() {
- return userSessionProvider.get();
- }
-
@Override
@Authenticated(mandatory = true)
public WaveClientParams getWaveClientParameters(final String userHash) {
@@ -128,7 +125,7 @@
}
private UserInfoDTO loadUserInfo(final User user) throws DefaultException {
- final UserInfo userInfo = userInfoService.buildInfo(user, getUserSession().getHash());
+ final UserInfo userInfo = userInfoService.buildInfo(user, userSessionManager.getHash());
return mapper.map(userInfo, UserInfoDTO.class);
}
@@ -144,8 +141,7 @@
private UserInfoDTO loginUser(final User user, final String waveToken) throws DefaultException {
if (user != null) {
- // Maybe use terracotta.org for http session clustering
- getUserSession().login(user, waveToken);
+ userSessionManager.login(user.getId(), waveToken);
return loadUserInfo(user);
} else {
throw new UserAuthException();
@@ -156,7 +152,7 @@
@Authenticated
@Transactional
public void logout(final String userHash) throws DefaultException {
- getUserSession().logout();
+ userSessionManager.logout();
// FIXME final SessionService sessionService =
// sessionServiceProvider.get();
// FIXME sessionService.getNewSession();
@@ -173,8 +169,7 @@
@Authenticated
@Transactional
public UserInfoDTO reloadUserInfo(final String userHash) throws DefaultException {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
+ final User user = userSessionManager.getUser();
return loadUserInfo(user);
}
@@ -184,8 +179,7 @@
@Transactional
public void setBuddiesVisibility(final String userHash, final StateToken groupToken,
final UserSNetVisibility visibility) {
- final UserSession userSession = getUserSession();
- final User user = userSession.getUser();
+ final User user = userSessionManager.getUser();
if (!groupToken.getGroup().equals(user.getShortName())) {
throw new AccessViolationException();
}
@@ -197,7 +191,7 @@
@Transactional
public StateAbstractDTO updateUser(final String userHash, final UserDTO user,
final I18nLanguageSimpleDTO lang) throws DefaultException {
- final Long id = getUserSession().getUser().getId();
+ final Long id = userSessionManager.getUser().getId();
if (!id.equals(user.getId())) {
throw new AccessViolationException();
}
Modified: trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/lists/server/ListsServerTool.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -32,7 +32,7 @@
import java.util.Set;
import cc.kune.core.server.AbstractServerTool;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.content.ContainerManager;
import cc.kune.core.server.content.ContentManager;
import cc.kune.core.server.manager.ToolConfigurationManager;
@@ -47,26 +47,25 @@
import cc.kune.wave.server.KuneWaveUtils;
import com.google.inject.Inject;
-import com.google.inject.Provider;
public class ListsServerTool extends AbstractServerTool {
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSessionManager;
private final KuneWaveService waveManager;
@Inject
public ListsServerTool(final ContentManager contentManager, final ContainerManager containerManager,
final ToolConfigurationManager configurationManager, final I18nTranslationService i18n,
- final Provider<UserSession> userSessionProvider, final KuneWaveService waveManager) {
+ final UserSessionManager userSessionManager, final KuneWaveService waveManager) {
super(NAME, ROOT_NAME, TYPE_ROOT, Arrays.asList(TYPE_POST), Arrays.asList(TYPE_LIST),
Arrays.asList(TYPE_LIST), Arrays.asList(TYPE_ROOT), contentManager, containerManager,
configurationManager, i18n, ServerToolTarget.forGroups);
- this.userSessionProvider = userSessionProvider;
+ this.userSessionManager = userSessionManager;
this.waveManager = waveManager;
}
private Group getUserGroup() {
- return userSessionProvider.get().getUser().getUserGroup();
+ return userSessionManager.getUser().getUserGroup();
}
@Override
Modified: trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/lists/server/rpc/ListsRPC.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -1,7 +1,7 @@
package cc.kune.lists.server.rpc;
import cc.kune.core.client.errors.AccessViolationException;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.auth.ActionLevel;
import cc.kune.core.server.auth.Authenticated;
import cc.kune.core.server.auth.Authorizated;
@@ -21,19 +21,18 @@
import cc.kune.lists.shared.ListsConstants;
import com.google.inject.Inject;
-import com.google.inject.Provider;
import com.google.inject.persist.Transactional;
public class ListsRPC implements ListsService, RPC {
private final ContainerManager contentManager;
private final ContentRPC contentRPC;
- private final Provider<UserSession> userSessionProvider;
+ private final UserSessionManager userSessionManager;
@Inject
- public ListsRPC(final ContentRPC contentRPC, final Provider<UserSession> userSessionProvider,
+ public ListsRPC(final ContentRPC contentRPC, final UserSessionManager userSessionManager,
final ContainerManager contentManager) {
this.contentRPC = contentRPC;
- this.userSessionProvider = userSessionProvider;
+ this.userSessionManager = userSessionManager;
this.contentManager = contentManager;
}
@@ -50,7 +49,7 @@
}
private Group getUserGroup() {
- return userSessionProvider.get().getUser().getUserGroup();
+ return userSessionManager.getUser().getUserGroup();
}
@Override
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -25,7 +25,6 @@
import java.util.Date;
import java.util.logging.Logger;
-import org.apache.commons.lang.NotImplementedException;
import org.waveprotocol.box.webclient.client.ClientEvents;
import org.waveprotocol.box.webclient.client.ClientIdGenerator;
import org.waveprotocol.box.webclient.client.DebugMessagePanel;
@@ -34,6 +33,7 @@
import org.waveprotocol.box.webclient.client.Session;
import org.waveprotocol.box.webclient.client.SimpleWaveStore;
import org.waveprotocol.box.webclient.client.WaveWebSocketClient;
+import org.waveprotocol.box.webclient.client.events.Log;
import org.waveprotocol.box.webclient.client.events.NetworkStatusEvent;
import org.waveprotocol.box.webclient.client.events.NetworkStatusEventHandler;
import org.waveprotocol.box.webclient.client.events.WaveCreationEvent;
@@ -47,7 +47,6 @@
import org.waveprotocol.box.webclient.search.SearchPresenter;
import org.waveprotocol.box.webclient.search.SimpleSearch;
import org.waveprotocol.box.webclient.search.WaveStore;
-import org.waveprotocol.box.webclient.util.Log;
import org.waveprotocol.box.webclient.widget.frame.FramedPanel;
import org.waveprotocol.box.webclient.widget.loading.LoadingIndicator;
import org.waveprotocol.wave.client.account.ProfileManager;
@@ -56,12 +55,16 @@
import org.waveprotocol.wave.client.common.util.AsyncHolder.Accessor;
import org.waveprotocol.wave.client.debug.logger.LogLevel;
import org.waveprotocol.wave.client.widget.common.ImplPanel;
+import org.waveprotocol.wave.client.widget.popup.CenterPopupPositioner;
+import org.waveprotocol.wave.client.widget.popup.PopupChrome;
+import org.waveprotocol.wave.client.widget.popup.PopupChromeFactory;
+import org.waveprotocol.wave.client.widget.popup.PopupFactory;
+import org.waveprotocol.wave.client.widget.popup.UniversalPopup;
import org.waveprotocol.wave.model.id.IdGenerator;
import org.waveprotocol.wave.model.id.WaveId;
import org.waveprotocol.wave.model.wave.ParticipantId;
import org.waveprotocol.wave.model.waveref.WaveRef;
-import cc.kune.common.client.errors.UIException;
import cc.kune.common.client.notify.NotifyUser;
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.sitebar.spaces.Space;
@@ -81,9 +84,9 @@
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockLayoutPanel;
+import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.SplitLayoutPanel;
import com.google.gwt.user.client.ui.UIObject;
import com.google.inject.Inject;
@@ -103,31 +106,6 @@
* prepared, it is revealed in the banner via a link.
*/
public static class ErrorHandler implements UncaughtExceptionHandler {
- public static void install() {
- GWT.setUncaughtExceptionHandler(new ErrorHandler(GWT.getUncaughtExceptionHandler()));
- }
-
- private static String maybe(final int value, final String otherwise) {
- return value != -1 ? String.valueOf(value) : otherwise;
- }
-
- private static String maybe(final String value, final String otherwise) {
- return value != null ? value : otherwise;
- }
-
- /**
- * Indicates whether an error has already been reported (at most one error
- * is ever reported by this handler).
- */
- private boolean hasFired;
-
- /** Next handler in the handler chain. */
- private final UncaughtExceptionHandler next;
-
- private ErrorHandler(final UncaughtExceptionHandler next) {
- this.next = next;
- }
-
public static void getStackTraceAsync(final Throwable t, final Accessor<SafeHtml> whenReady) {
// TODO: Request stack-trace de-obfuscation. For now, just use the
// javascript stack trace.
@@ -166,6 +144,31 @@
}.schedule(1);
}
+ public static void install() {
+ GWT.setUncaughtExceptionHandler(new ErrorHandler(GWT.getUncaughtExceptionHandler()));
+ }
+
+ private static String maybe(final int value, final String otherwise) {
+ return value != -1 ? String.valueOf(value) : otherwise;
+ }
+
+ private static String maybe(final String value, final String otherwise) {
+ return value != null ? value : otherwise;
+ }
+
+ /**
+ * Indicates whether an error has already been reported (at most one error
+ * is ever reported by this handler).
+ */
+ private boolean hasFired;
+
+ /** Next handler in the handler chain. */
+ private final UncaughtExceptionHandler next;
+
+ private ErrorHandler(final UncaughtExceptionHandler next) {
+ this.next = next;
+ }
+
@Override
public void onUncaughtException(final Throwable e) {
if (!hasFired) {
@@ -175,8 +178,8 @@
getStackTraceAsync(e, new Accessor<SafeHtml>() {
@Override
public void use(final SafeHtml stack) {
- //NotifyUser.error("Oops! Something has gone wrong. Please contact the site admins with <em>more details</em>");
// error.addDetail(stack, null);
+ // REMOTE_LOG.severe(stack.asString().replace("<br>", "\n"));
final String message = stack.asString().replace("<br>", "\n");
REMOTE_LOG.severe(message);
NotifyUser.logError(message);
@@ -194,41 +197,58 @@
}
private static final Binder BINDER = GWT.create(Binder.class);
- static final Log LOG = Log.get(WebClient.class);
+ static Log LOG = Log.get(WebClient.class);
// Use of GWT logging is only intended for sending exception reports to the
// server, nothing else in the client should use java.util.logging.
// Please also see WebClientDemo.gwt.xml.
private static final Logger REMOTE_LOG = Logger.getLogger("REMOTE_LOG");
- // TODO (Yuri Z.) Change the implementation to RemoteProfileManagerImpl when
- // it will be ready.
- private final ProfileManager profiles;
+ /** Creates a popup that warns about network disconnects. */
+ private static UniversalPopup createTurbulencePopup() {
+ final PopupChrome chrome = PopupChromeFactory.createPopupChrome();
+ final UniversalPopup popup =
+ PopupFactory.createPopup(null, new CenterPopupPositioner(), chrome, true);
+ popup.add(new HTML("<div style='color: red; padding: 5px; text-align: center;'>"
+ + "<b>A turbulence detected!<br></br>"
+ + " Please save your last changes to somewhere and reload the wave.</b></div>"));
+ return popup;
+ }
+ private RemoteViewServiceMultiplexer channel;
- @UiField
- SplitLayoutPanel splitPanel;
-
private final EventBus eventBus;
- @UiField
- Style style;
+ private IdGenerator idGenerator;
+ private final InboxCountPresenter inboxCount;
+
+ private final Element loading = new LoadingIndicator().getElement();
+
+ private ParticipantId loggedInUser;
@UiField
- FramedPanel waveFrame;
+ DebugMessagePanel logPanel;
+ private final ProfileManager profiles;
- ImplPanel waveHolder;
- private final Element loading = new LoadingIndicator().getElement();
-
@UiField(provided = true)
final SearchPanelWidget searchPanel;
@UiField
- DebugMessagePanel logPanel;
+ SplitLayoutPanel splitPanel;
+ @UiField
+ Style style;
+
+ private final UniversalPopup turbulencePopup = createTurbulencePopup();
+
/** The wave panel, if a wave is open. */
private KuneStagesProvider wave;
+ @UiField
+ FramedPanel waveFrame;
+
+ ImplPanel waveHolder;
+
private final WaveStore waveStore = new SimpleWaveStore();
/**
@@ -236,18 +256,11 @@
*/
private WaveWebSocketClient websocket;
- private ParticipantId loggedInUser;
-
- private IdGenerator idGenerator;
-
- private RemoteViewServiceMultiplexer channel;
- private final InboxCountPresenter inboxCount;
-
/**
* This is the entry point method.
*/
@Inject
- public WebClient(final EventBus eventBus, KuneWaveProfileManager profiles, InboxCountPresenter inboxCount, TokenMatcher tokenMatcher) {
+ public WebClient(final EventBus eventBus, final KuneWaveProfileManager profiles, final InboxCountPresenter inboxCount, final TokenMatcher tokenMatcher) {
// Window.alert("webclient! " + new Date());
this.eventBus = eventBus;
this.profiles = profiles;
@@ -274,43 +287,31 @@
// Done in StateManager
// HistorySupport.init();
- //createWebSocket();
-
loginImpl();
setupUi();
- if (tokenMatcher.isWaveToken(History.getToken()))
+ if (tokenMatcher.isWaveToken(History.getToken())) {
History.fireCurrentHistoryState();
+ }
LOG.info("SimpleWebClient.onModuleLoad() done");
}
- private void createWebSocket() {
- websocket = new WaveWebSocketClient(useSocketIO(), getWebSocketBaseUrl(GWT.getModuleBaseURL()));
- websocket.connect();
- }
-
@Override
- public void login() {
- loginImpl();
+ public void clear() {
+ // Duplicate below
+ if (wave != null) {
+ wave.destroy();
+ wave = null;
}
-
- @Override
- public void logout() {
- loggedInUser = null;
- channel = null;
- idGenerator = null;
- websocket = null;
- clear();
+ if (waveHolder.isAttached()) {
+ waveHolder.removeFromParent();
}
+}
- private void loginImpl() {
- createWebSocket();
- if (Session.get().isLoggedIn()) {
- loggedInUser = new ParticipantId(Session.get().getAddress());
- idGenerator = ClientIdGenerator.create();
- loginToServer();
- }
+ private void createWebSocket() {
+ websocket = new WaveWebSocketClient(useSocketIO(), getWebSocketBaseUrl(GWT.getModuleBaseURL()));
+ websocket.connect();
}
@Override
@@ -329,25 +330,42 @@
}
@Override
+ public void getStackTraceAsync(final Throwable caught, final Accessor<SafeHtml> accessor) {
+ ErrorHandler.getStackTraceAsync(caught, accessor);
+ }
+
+ @Override
public ImplPanel getWaveHolder() {
return waveHolder;
}
- at Override
-public WaveWebSocketClient getWebSocket() {
- return websocket;
-}
+
+ @Override
+ public WaveWebSocketClient getWebSocket() {
+ return websocket;
+ }
+
/**
* Returns <code>ws://yourhost[:port]/</code>.
*/
// XXX check formatting wrt GPE
private native String getWebSocketBaseUrl(String moduleBase) /*-{
- return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
+ return "ws" + /:\/\/[^\/]+/.exec(moduleBase)[0] + "/";
}-*/;
- private native boolean useSocketIO() /*-{
- return !!$wnd.__useSocketIO
- }-*/;
+ @Override
+ public void login() {
+ loginImpl();
+ }
+ private void loginImpl() {
+ createWebSocket();
+ if (Session.get().isLoggedIn()) {
+ loggedInUser = new ParticipantId(Session.get().getAddress());
+ idGenerator = ClientIdGenerator.create();
+ loginToServer();
+ }
+ }
+
/**
*/
private void loginToServer() {
@@ -355,16 +373,15 @@
channel = new RemoteViewServiceMultiplexer(websocket, loggedInUser.getAddress());
}
- public void clear() {
- // Duplicate below
- if (wave != null) {
- wave.destroy();
- wave = null;
+ @Override
+ public void logout() {
+ loggedInUser = null;
+ channel = null;
+ idGenerator = null;
+ websocket = null;
+ clear();
}
- if (waveHolder.isAttached()) {
- waveHolder.removeFromParent();
- }
-}
+
/**
* Shows a wave in a wave panel.
*
@@ -385,6 +402,7 @@
waveFrame.remove(waveHolder);
waveFrame.clear();
waveFrame.add(waveHolder);
+
// Release the display:none.
UIObject.setVisible(waveFrame.getElement(), true);
waveHolder.getElement().appendChild(loading);
@@ -399,7 +417,6 @@
}
});
final String encodedToken = History.getToken();
- // NotifyUser.info("Open Wave: " + encodedToken + " waveRef: " + waveRef.getWaveId(), true);
// Kune patch
if (encodedToken != null && !encodedToken.isEmpty() && !encodedToken.equals(SiteTokens.WAVEINBOX)) {
final WaveRef fromWaveRef = HistorySupport.waveRefFromHistoryToken(encodedToken);
@@ -421,6 +438,9 @@
private void setupConnectionIndicator() {
ClientEvents.get().addNetworkStatusEventHandler(new NetworkStatusEventHandler() {
+
+ boolean isTurbulenceDetected = false;
+
@Override
public void onNetworkStatus(final NetworkStatusEvent event) {
final Element element = Document.get().getElementById("netstatus");
@@ -430,10 +450,16 @@
case RECONNECTED:
element.setInnerText("Online");
element.setClassName("online");
+ isTurbulenceDetected = false;
+ turbulencePopup.hide();
break;
case DISCONNECTED:
element.setInnerText("Offline");
element.setClassName("offline");
+ if (!isTurbulenceDetected) {
+ isTurbulenceDetected = true;
+ turbulencePopup.show();
+ }
break;
case RECONNECTING:
element.setInnerText("Connecting...");
@@ -446,45 +472,47 @@
}
private void setupSearchPanel() {
- // On wave selection, fire an event.
- SearchPresenter.WaveSelectionHandler selectHandler =
- new SearchPresenter.WaveSelectionHandler() {
+ // On wave action fire an event.
+ final SearchPresenter.WaveActionHandler actionHandler =
+ new SearchPresenter.WaveActionHandler() {
@Override
- public void onWaveSelected(WaveId id) {
+ public void onCreateWave() {
+ ClientEvents.get().fireEvent(WaveCreationEvent.CREATE_NEW_WAVE);
+ }
+
+ @Override
+ public void onWaveSelected(final WaveId id) {
ClientEvents.get().fireEvent(new WaveSelectionEvent(WaveRef.of(id)));
}
};
- Search search = SimpleSearch.create(RemoteSearchService.create(), waveStore);
+ final Search search = SimpleSearch.create(RemoteSearchService.create(), waveStore);
search.addListener(inboxCount.getSearchListener());
- SearchPresenter.create(search, searchPanel, selectHandler, profiles);
+ SearchPresenter.create(search, searchPanel, actionHandler, profiles);
}
+private void setupUi() {
+ // Set up UI
+ final DockLayoutPanel self = BINDER.createAndBindUi(this);
+ // kune-patch
+ // RootPanel.get("app").add(self);
+ initWidget(self);
+ waveHolder = new ImplPanel("");
+ waveHolder.addStyleName("k-waveHolder");
+ waveFrame.add(waveHolder);
+ // DockLayoutPanel forcibly conflicts with sensible layout control, and
+ // sticks inline styles on elements without permission. They must be
+ // cleared.
+ self.getElement().getStyle().clearPosition();
+ splitPanel.setWidgetMinSize(searchPanel, 300);
-
- private void setupUi() {
- // Set up UI
- final DockLayoutPanel self = BINDER.createAndBindUi(this);
- // kune-patch
- // RootPanel.get("app").add(self);
- initWidget(self);
- waveHolder = new ImplPanel("");
- waveHolder.addStyleName("k-waveHolder");
- waveFrame.add(waveHolder);
- // DockLayoutPanel forcibly conflicts with sensible layout control, and
- // sticks inline styles on elements without permission. They must be
- // cleared.
- self.getElement().getStyle().clearPosition();
- splitPanel.setWidgetMinSize(searchPanel, 300);
-
- if (LogLevel.showDebug()) {
- logPanel.enable();
- } else {
- logPanel.removeFromParent();
- }
-
- setupSearchPanel();
- setupWavePanel();
+ if (LogLevel.showDebug()) {
+ logPanel.enable();
+ } else {
+ logPanel.removeFromParent();
}
+ setupSearchPanel();
+ setupWavePanel();
+}
private void setupWavePanel() {
// Hide the frame until waves start getting opened.
UIObject.setVisible(waveFrame.getElement(), false);
@@ -498,8 +526,7 @@
});
}
- @Override
- public void getStackTraceAsync(Throwable caught, Accessor<SafeHtml> accessor) {
- ErrorHandler.getStackTraceAsync(caught, accessor);
- }
+ private native boolean useSocketIO() /*-{
+ return !!$wnd.__useSocketIO
+ }-*/;
}
Deleted: trunk/src/main/java/cc/kune/wave/server/AbstractBaseRobotAgent.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/AbstractBaseRobotAgent.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/wave/server/AbstractBaseRobotAgent.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -1,162 +0,0 @@
-/**
- * Copyright 2011 Google Inc.
- *
- * 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.
- *
- */
-
-package cc.kune.wave.server;
-
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.waveprotocol.box.server.CoreSettings;
-import org.waveprotocol.box.server.account.AccountData;
-import org.waveprotocol.box.server.persistence.AccountStore;
-import org.waveprotocol.box.server.persistence.PersistenceException;
-import org.waveprotocol.box.server.robots.util.RobotsUtil;
-import org.waveprotocol.box.server.robots.util.RobotsUtil.RobotRegistrationException;
-import org.waveprotocol.wave.model.id.TokenGenerator;
-import org.waveprotocol.wave.model.wave.InvalidParticipantAddress;
-import org.waveprotocol.wave.model.wave.ParticipantId;
-
-import com.google.inject.Inject;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import com.google.inject.name.Named;
-import com.google.inject.name.Names;
-import com.google.wave.api.AbstractRobot;
-
-/**
- * The base for robot agents that run on the WIAB server.
- *
- * @author yurize at apache.org (Yuri Zelikov)
- */
- at SuppressWarnings("serial")
-public abstract class AbstractBaseRobotAgent extends AbstractRobot {
-
- static class ServerFrontendAddressHolder {
-
- private final List<String> addresses;
-
- @Inject
- ServerFrontendAddressHolder(@Named(CoreSettings.HTTP_FRONTEND_ADDRESSES) final List<String> addresses) {
- this.addresses = addresses;
- }
-
- List<String> getAddresses() {
- return addresses;
- }
- }
-
- public static final String AGENT_PREFIX_URI = "/agent";
- private static final Logger LOG = Logger.getLogger(AbstractBaseRobotAgent.class.getName());
-
- /** Account store with user and robot accounts. */
- private final AccountStore accountStore;
-
- private final ServerFrontendAddressHolder frontendAddressHolder;
-
- /** The wave server domain. */
- private final String waveDomain;
-
- /**
- * Constructor. Initializes the agent to serve on the URI provided by
- * {@link #getRobotUri()} and ensures that the agent is registered in the
- * Account store.
- *
- * @param injector
- * the injector instance.
- */
- public AbstractBaseRobotAgent(final Injector injector) {
- this(injector.getInstance(Key.get(String.class, Names.named(CoreSettings.WAVE_SERVER_DOMAIN))),
- injector.getInstance(AccountStore.class), injector.getInstance(TokenGenerator.class),
- injector.getInstance(ServerFrontendAddressHolder.class));
- }
-
- /**
- * Constructor. Initializes the agent to serve on the URI provided by
- * {@link #getRobotUri()} and ensures that the agent is registered in the
- * Account store.
- */
- AbstractBaseRobotAgent(final String waveDomain, final AccountStore accountStore,
- final TokenGenerator tokenGenerator, final ServerFrontendAddressHolder frontendAddressHolder) {
- this.waveDomain = waveDomain;
- this.accountStore = accountStore;
- this.frontendAddressHolder = frontendAddressHolder;
- ensureRegistered(tokenGenerator, getFrontEndAddress()); // NOPMD by vjrj on
- // 6/07/11 21:15
- }
-
- /**
- * Ensures that the robot agent is registered in the {@link AccountStore}.
- */
- private void ensureRegistered(final TokenGenerator tokenGenerator, final String serverFrontendAddress) {
- ParticipantId robotId = null;
- try {
- robotId = ParticipantId.of(getRobotId() + "@" + waveDomain);
- } catch (final InvalidParticipantAddress e) {
- LOG.log(Level.SEVERE, "Failed to register the agent:" + getRobotId(), e);
- return;
- }
- try {
- final String location = "http://" + serverFrontendAddress + getRobotUri();
- // Register this agent in the account store. The registration is forced
- // in order to re-register the agents if the server frontend address has
- // changed.
- final AccountData account = accountStore.getAccount(robotId);
- if ((account == null || (account != null && !account.asRobot().getUrl().equals(location)))) {
- RobotsUtil.registerRobotUri(location, robotId, accountStore, tokenGenerator, true);
- }
-
- } catch (final RobotRegistrationException e) {
- LOG.log(Level.SEVERE, "Failed to register the agent:" + getRobotId(), e);
- } catch (final PersistenceException e) {
- LOG.log(Level.SEVERE, "Failed to register the agent:" + getRobotId(), e);
- }
- }
-
- /**
- * Returns the account store.
- */
- protected AccountStore getAccountStore() {
- return accountStore;
- }
-
- public String getFrontEndAddress() {
- return frontendAddressHolder.getAddresses().get(0);
- }
-
- /**
- * Returns the robot participant id.
- */
- public abstract String getRobotId();
-
- @Override
- protected String getRobotProfilePageUrl() { // NOPMD by vjrj on 6/07/11 21:15
- return null;
- }
-
- /**
- * Returns the robot URI.
- */
- public abstract String getRobotUri();
-
- /**
- * Returns the wave domain.
- */
- public String getWaveDomain() {
- return waveDomain;
- }
-}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/wave/server/CustomUserRegistrationServlet.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -47,18 +47,22 @@
*
* @author josephg at gmail.com (Joseph Gentle)
*/
+ at SuppressWarnings("serial")
@Singleton
public final class CustomUserRegistrationServlet extends HttpServlet {
private final AccountStore accountStore;
private final String domain;
+ // private final WelcomeRobot welcomeBot;
private final Log LOG = Log.get(CustomUserRegistrationServlet.class);
@Inject
public CustomUserRegistrationServlet(AccountStore accountStore,
@Named(CoreSettings.WAVE_SERVER_DOMAIN) String domain) {
+ //, WelcomeRobot welcomeBot) {
this.accountStore = accountStore;
this.domain = domain;
+ // this.welcomeBot = welcomeBot;
}
@Override
@@ -113,14 +117,14 @@
if (id.getAddress().indexOf("@") < 1) {
return "Username portion of address cannot be empty";
}
- final String[] usernameSplit = id.getAddress().split("@");
+ String[] usernameSplit = id.getAddress().split("@");
if (usernameSplit.length != 2 || !usernameSplit[0].matches("[\\w\\.]+")) {
return "Only letters (a-z), numbers (0-9), and periods (.) are allowed in Username";
}
if (!id.getDomain().equals(domain)) {
return "You can only create users at the " + domain + " domain";
}
- } catch (final InvalidParticipantAddress e) {
+ } catch (InvalidParticipantAddress e) {
return "Invalid username";
}
@@ -128,7 +132,7 @@
if (accountStore.getAccount(id) != null) {
return "Account already exists";
}
- } catch (final PersistenceException e) {
+ } catch (PersistenceException e) {
LOG.severe("Failed to retreive account data for " + id, e);
return "An unexpected error occured while trying to retrieve account status";
}
@@ -137,16 +141,20 @@
new HumanAccountDataImpl(id, passwordDigest);
try {
accountStore.putAccount(account);
- } catch (final PersistenceException e) {
+ } catch (PersistenceException e) {
LOG.severe("Failed to create new account for " + id, e);
return "An unexpected error occured while trying to create the account";
}
-
+// try {
+ // welcomeBot.greet(account.getId());
+// } catch (IOException e) {
+// LOG.warning("Failed to create a welcome wavelet for " + id, e);
+// }
return null;
}
- private void writeRegistrationPage(final String message, final String responseType, final Locale locale,
- final HttpServletResponse dest) throws IOException {
+ private void writeRegistrationPage(String message, String responseType, Locale locale,
+ HttpServletResponse dest) throws IOException {
dest.setCharacterEncoding("UTF-8");
dest.setContentType("text/html;charset=utf-8");
UserRegistrationPage.write(dest.getWriter(), new GxpContext(locale), domain, message,
Modified: trunk/src/main/java/cc/kune/wave/server/KuneAgent.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/wave/server/KuneAgent.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -25,8 +25,7 @@
import javax.annotation.Nonnull;
-import org.waveprotocol.box.server.persistence.AccountStore;
-import org.waveprotocol.wave.model.id.TokenGenerator;
+import org.waveprotocol.box.server.robots.agent.AbstractBaseRobotAgent;
import org.waveprotocol.wave.model.id.WaveId;
import org.waveprotocol.wave.model.id.WaveletId;
import org.waveprotocol.wave.model.wave.ParticipantId;
@@ -51,10 +50,11 @@
super(injector);
}
- public KuneAgent(final String waveDomain, final AccountStore accountStore,
- final TokenGenerator tokenGenerator, final ServerFrontendAddressHolder frontendAddressHolder) {
- super(waveDomain, accountStore, tokenGenerator, frontendAddressHolder);
- }
+ // public KuneAgent(final String waveDomain, final AccountStore accountStore,
+ // final TokenGenerator tokenGenerator, final ServerFrontendAddressHolder
+ // frontendAddressHolder) {
+ // super(waveDomain, accountStore, tokenGenerator, frontendAddressHolder);
+ // }
@Override
public void addGadget(final WaveRef waveName, final String author, final String gadgetUrl) {
Modified: trunk/src/main/java/cc/kune/wave/server/WaveMain.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/WaveMain.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/main/java/cc/kune/wave/server/WaveMain.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -39,6 +39,7 @@
import org.waveprotocol.box.server.frontend.ClientFrontend;
import org.waveprotocol.box.server.frontend.ClientFrontendImpl;
import org.waveprotocol.box.server.frontend.WaveClientRpcImpl;
+import org.waveprotocol.box.server.frontend.WaveletInfo;
import org.waveprotocol.box.server.persistence.AccountStore;
import org.waveprotocol.box.server.persistence.PersistenceException;
import org.waveprotocol.box.server.persistence.PersistenceModule;
@@ -46,8 +47,6 @@
import org.waveprotocol.box.server.robots.RobotApiModule;
import org.waveprotocol.box.server.robots.RobotRegistrationServlet;
import org.waveprotocol.box.server.robots.active.ActiveApiServlet;
-import org.waveprotocol.box.server.robots.agent.passwd.PasswordAdminRobot;
-import org.waveprotocol.box.server.robots.agent.passwd.PasswordRobot;
import org.waveprotocol.box.server.robots.dataapi.DataApiOAuthServlet;
import org.waveprotocol.box.server.robots.dataapi.DataApiServlet;
import org.waveprotocol.box.server.robots.passive.RobotsGateway;
@@ -59,6 +58,7 @@
import org.waveprotocol.box.server.rpc.ServerRpcProvider;
import org.waveprotocol.box.server.rpc.SignOutServlet;
import org.waveprotocol.box.server.rpc.UserRegistrationServlet;
+import org.waveprotocol.box.server.rpc.WaveRefServlet;
import org.waveprotocol.box.server.waveserver.WaveBus;
import org.waveprotocol.box.server.waveserver.WaveServerException;
import org.waveprotocol.box.server.waveserver.WaveletProvider;
@@ -87,6 +87,13 @@
*/
public class WaveMain {
+ /**
+ * This is the name of the system property used to find the server config file.
+ */
+ private static final String PROPERTIES_FILE_KEY = "wave.server.config";
+
+ private static final Log LOG = Log.get(WaveMain.class);
+
@SuppressWarnings("serial")
@Singleton
public static class GadgetProxyServlet extends HttpServlet {
@@ -94,8 +101,8 @@
ProxyServlet.Transparent proxyServlet;
@Inject
- public GadgetProxyServlet(@Named(CoreSettings.GADGET_SERVER_HOSTNAME) final String gadgetServerHostname,
- @Named(CoreSettings.GADGET_SERVER_PORT) final int gadgetServerPort){
+ public GadgetProxyServlet(@Named(CoreSettings.GADGET_SERVER_HOSTNAME) String gadgetServerHostname,
+ @Named(CoreSettings.GADGET_SERVER_PORT) int gadgetServerPort){
LOG.info("Starting GadgetProxyServlet for " + gadgetServerHostname + ":" + gadgetServerPort);
proxyServlet = new ProxyServlet.Transparent("/gadgets", "http", gadgetServerHostname,
@@ -103,82 +110,98 @@
}
@Override
- public void init(final ServletConfig config) throws ServletException {
+ public void init(ServletConfig config) throws ServletException {
proxyServlet.init(config);
}
@Override
- public void service(final ServletRequest req, final ServletResponse res) throws ServletException, IOException {
+ public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
proxyServlet.service(req, res);
}
}
- private static final Log LOG = Log.get(WaveMain.class);
+ public static void main(String... args) {
+ try {
+ Module coreSettings = SettingsBinder.bindSettings(PROPERTIES_FILE_KEY, CoreSettings.class);
+ run(coreSettings);
+ return;
+ } catch (PersistenceException e) {
+ LOG.severe("PersistenceException when running server:", e);
+ } catch (ConfigurationException e) {
+ LOG.severe("ConfigurationException when running server:", e);
+ } catch (WaveServerException e) {
+ LOG.severe("WaveServerException when running server:", e);
+ }
+ }
- /**
- * This is the name of the system property used to find the server config file.
- */
- private static final String PROPERTIES_FILE_KEY = "wave.server.config";
+ public static void run(Module coreSettings) throws PersistenceException,
+ ConfigurationException, WaveServerException {
+ Injector settingsInjector = Guice.createInjector(coreSettings);
+ boolean enableFederation = settingsInjector.getInstance(Key.get(Boolean.class,
+ Names.named(CoreSettings.ENABLE_FEDERATION)));
- private static Module buildFederationModule(final Injector settingsInjector, final boolean enableFederation)
- throws ConfigurationException {
- Module federationModule;
if (enableFederation) {
- federationModule = settingsInjector.getInstance(XmppFederationModule.class);
- } else {
- federationModule = settingsInjector.getInstance(NoOpFederationModule.class);
+ Module federationSettings =
+ SettingsBinder.bindSettings(PROPERTIES_FILE_KEY, FederationSettings.class);
+ // This MUST happen first, or bindings will fail if federation is enabled.
+ settingsInjector = settingsInjector.createChildInjector(federationSettings);
}
- return federationModule;
- }
- private static void initializeFederation(final Injector injector) {
- final FederationTransport federationManager = injector.getInstance(FederationTransport.class);
- federationManager.startFederation();
- }
+ Module federationModule = buildFederationModule(settingsInjector, enableFederation);
+ PersistenceModule persistenceModule = settingsInjector.getInstance(PersistenceModule.class);
+ Injector injector =
+ settingsInjector.createChildInjector(new ServerModule(enableFederation),
+ new RobotApiModule(), federationModule, persistenceModule);
- private static void initializeFrontend(final Injector injector, final ServerRpcProvider server,
- final WaveBus waveBus) throws WaveServerException {
- final HashedVersionFactory hashFactory = injector.getInstance(HashedVersionFactory.class);
+ ServerRpcProvider server = injector.getInstance(ServerRpcProvider.class);
+ WaveBus waveBus = injector.getInstance(WaveBus.class);
- final WaveletProvider provider = injector.getInstance(WaveletProvider.class);
- final ClientFrontend frontend =
- ClientFrontendImpl.create(hashFactory, provider, waveBus);
+ String domain =
+ injector.getInstance(Key.get(String.class, Names.named(CoreSettings.WAVE_SERVER_DOMAIN)));
+ if (!ParticipantIdUtil.isDomainAddress(ParticipantIdUtil.makeDomainAddress(domain))) {
+ throw new WaveServerException("Invalid wave domain: " + domain);
+ }
- final ProtocolWaveClientRpc.Interface rpcImpl = WaveClientRpcImpl.create(frontend, false);
- server.registerService(ProtocolWaveClientRpc.newReflectiveService(rpcImpl));
- }
+ initializeServer(injector, domain);
+ initializeServlets(injector, server);
+ initializeRobotAgents(injector, server);
+ initializeRobots(injector, waveBus);
+ initializeFrontend(injector, server, waveBus);
+ initializeFederation(injector);
- private static void initializeRobotAgents(final Injector injector, final ServerRpcProvider server) {
- final PasswordRobot passRobot = new PasswordRobot(injector);
- final PasswordAdminRobot passAdminRobot = new PasswordAdminRobot(injector);
- injector.injectMembers(passRobot);
- server.addServlet(PasswordRobot.ROBOT_URI + "/*", passRobot);
- server.addServlet(PasswordAdminRobot.ROBOT_URI + "/*", passAdminRobot);
+ LOG.info("Starting server");
+ server.startWebSocketServer(injector);
}
- private static void initializeRobots(final Injector injector, final WaveBus waveBus) {
- final RobotsGateway robotsGateway = injector.getInstance(RobotsGateway.class);
- waveBus.subscribe(robotsGateway);
+ private static Module buildFederationModule(Injector settingsInjector, boolean enableFederation)
+ throws ConfigurationException {
+ Module federationModule;
+ if (enableFederation) {
+ federationModule = settingsInjector.getInstance(XmppFederationModule.class);
+ } else {
+ federationModule = settingsInjector.getInstance(NoOpFederationModule.class);
+ }
+ return federationModule;
}
- private static void initializeServer(final Injector injector, final String waveDomain)
+ private static void initializeServer(Injector injector, String waveDomain)
throws PersistenceException, WaveServerException {
- final AccountStore accountStore = injector.getInstance(AccountStore.class);
+ AccountStore accountStore = injector.getInstance(AccountStore.class);
accountStore.initializeAccountStore();
AccountStoreHolder.init(accountStore, waveDomain);
// Initialize the SignerInfoStore.
- final CertPathStore certPathStore = injector.getInstance(CertPathStore.class);
+ CertPathStore certPathStore = injector.getInstance(CertPathStore.class);
if (certPathStore instanceof SignerInfoStore) {
((SignerInfoStore)certPathStore).initializeSignerInfoStore();
}
// Initialize the server.
- final WaveletProvider waveServer = injector.getInstance(WaveletProvider.class);
+ WaveletProvider waveServer = injector.getInstance(WaveletProvider.class);
waveServer.initialize();
}
- private static void initializeServlets(final Injector injector, final ServerRpcProvider server) {
+ private static void initializeServlets(Injector injector, ServerRpcProvider server) {
server.addServlet("/attachment/*", injector.getInstance(AttachmentServlet.class));
server.addServlet(SessionManager.SIGN_IN_URL, injector.getInstance(AuthenticationServlet.class));
@@ -194,69 +217,46 @@
server.addServlet("/robot/rpc", injector.getInstance(ActiveApiServlet.class));
server.addServlet("/webclient/remote_logging", injector.getInstance(RemoteLoggingServiceImpl.class));
server.addServlet("/profile/*", injector.getInstance(FetchProfilesServlet.class));
+ server.addServlet("/waveref/*", injector.getInstance(WaveRefServlet.class));
- final String gadgetHostName =
+ String gadgetHostName =
injector
.getInstance(Key.get(String.class, Names.named(CoreSettings.GADGET_SERVER_HOSTNAME)));
- final int port =
+ int port =
injector.getInstance(Key.get(Integer.class, Names.named(CoreSettings.GADGET_SERVER_PORT)));
- final Map<String, String> initParams =
+ Map<String, String> initParams =
Collections.singletonMap("HostHeader", gadgetHostName + ":" + port);
server.addServlet("/gadgets/*", injector.getInstance(GadgetProxyServlet.class), initParams);
//server.addServlet("/", injector.getInstance(WaveClientServlet.class));
}
- public static void main(final String... args) {
- try {
- final Module coreSettings = SettingsBinder.bindSettings(PROPERTIES_FILE_KEY, CoreSettings.class);
- run(coreSettings);
- return;
- } catch (final PersistenceException e) {
- LOG.severe("PersistenceException when running server:", e);
- } catch (final ConfigurationException e) {
- LOG.severe("ConfigurationException when running server:", e);
- } catch (final WaveServerException e) {
- LOG.severe("WaveServerException when running server:", e);
- }
+ private static void initializeRobots(Injector injector, WaveBus waveBus) {
+ RobotsGateway robotsGateway = injector.getInstance(RobotsGateway.class);
+ waveBus.subscribe(robotsGateway);
}
- public static void run(final Module coreSettings) throws PersistenceException,
- ConfigurationException, WaveServerException {
- Injector settingsInjector = Guice.createInjector(coreSettings);
- final boolean enableFederation = settingsInjector.getInstance(Key.get(Boolean.class,
- Names.named(CoreSettings.ENABLE_FEDERATION)));
+ private static void initializeRobotAgents(Injector injector, ServerRpcProvider server) {
+ //server.addServlet(PasswordRobot.ROBOT_URI + "/*", injector.getInstance(PasswordRobot.class));
+ //server.addServlet(PasswordAdminRobot.ROBOT_URI + "/*", injector.getInstance(PasswordAdminRobot.class));
+ //server.addServlet(WelcomeRobot.ROBOT_URI + "/*", injector.getInstance(WelcomeRobot.class));
+ }
- if (enableFederation) {
- final Module federationSettings =
- SettingsBinder.bindSettings(PROPERTIES_FILE_KEY, FederationSettings.class);
- // This MUST happen first, or bindings will fail if federation is enabled.
- settingsInjector = settingsInjector.createChildInjector(federationSettings);
- }
+ private static void initializeFrontend(Injector injector, ServerRpcProvider server,
+ WaveBus waveBus) throws WaveServerException {
+ HashedVersionFactory hashFactory = injector.getInstance(HashedVersionFactory.class);
- final Module federationModule = buildFederationModule(settingsInjector, enableFederation);
- final PersistenceModule persistenceModule = settingsInjector.getInstance(PersistenceModule.class);
- final Injector injector =
- settingsInjector.createChildInjector(new ServerModule(enableFederation),
- new RobotApiModule(), federationModule, persistenceModule);
+ WaveletProvider provider = injector.getInstance(WaveletProvider.class);
+ WaveletInfo waveletInfo = WaveletInfo.create(hashFactory, provider);
+ ClientFrontend frontend =
+ ClientFrontendImpl.create(provider, waveBus, waveletInfo);
- final ServerRpcProvider server = injector.getInstance(ServerRpcProvider.class);
- final WaveBus waveBus = injector.getInstance(WaveBus.class);
+ ProtocolWaveClientRpc.Interface rpcImpl = WaveClientRpcImpl.create(frontend, false);
+ server.registerService(ProtocolWaveClientRpc.newReflectiveService(rpcImpl));
+ }
- final String domain =
- injector.getInstance(Key.get(String.class, Names.named(CoreSettings.WAVE_SERVER_DOMAIN)));
- if (!ParticipantIdUtil.isDomainAddress(ParticipantIdUtil.makeDomainAddress(domain))) {
- throw new WaveServerException("Invalid wave domain: " + domain);
- }
-
- initializeServer(injector, domain);
- initializeServlets(injector, server);
- initializeRobotAgents(injector, server);
- initializeRobots(injector, waveBus);
- initializeFrontend(injector, server, waveBus);
- initializeFederation(injector);
-
- LOG.info("Starting server");
- server.startWebSocketServer(injector);
+ private static void initializeFederation(Injector injector) {
+ FederationTransport federationManager = injector.getInstance(FederationTransport.class);
+ federationManager.startFederation();
}
}
Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTest.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -25,7 +25,7 @@
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.rpcservices.UserService;
-import cc.kune.core.server.UserSession;
+import cc.kune.core.server.UserSessionManager;
import cc.kune.core.server.properties.KuneBasicProperties;
import cc.kune.core.shared.dto.UserInfoDTO;
@@ -36,7 +36,7 @@
@Inject
KuneBasicProperties properties;
@Inject
- protected UserSession session;
+ protected UserSessionManager session;
protected String token;
@Inject
UserService userService;
Modified: trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/test/java/cc/kune/selenium/KuneSeleniumDefaults.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -21,8 +21,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.events.EventFiringWebDriver;
+import org.openqa.selenium.support.events.WebDriverEventListener;
import org.openqa.selenium.support.pagefactory.ElementLocatorFactory;
import org.testng.Assert;
import org.testng.ITestContext;
@@ -51,6 +55,96 @@
webdriver = injector.getInstance(GenericWebDriver.class);
login = injector.getInstance(LoginPageObject.class);
eventFiring = injector.getInstance(EventFiringWebDriver.class);
+ eventFiring.register(new WebDriverEventListener() {
+
+ @Override
+ public void afterChangeValueOf(final WebElement element, final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void afterClickOn(final WebElement element, final WebDriver driver) {
+ sleep(500);
+ }
+
+ @Override
+ public void afterFindBy(final By by, final WebElement element, final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void afterNavigateBack(final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void afterNavigateForward(final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void afterNavigateTo(final String url, final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void afterScript(final String script, final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void beforeChangeValueOf(final WebElement element, final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void beforeClickOn(final WebElement element, final WebDriver driver) {
+ sleep(500);
+ }
+
+ @Override
+ public void beforeFindBy(final By by, final WebElement element, final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void beforeNavigateBack(final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void beforeNavigateForward(final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void beforeNavigateTo(final String url, final WebDriver driver) {
+ // TODO Auto-generated method stub
+ sleep(500);
+ }
+
+ @Override
+ public void beforeScript(final String script, final WebDriver driver) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onException(final Throwable throwable, final WebDriver driver) {
+ // TODO Auto-generated method stub
+
+ }
+ });
final ElementLocatorFactory locator = injector.getInstance(ElementLocatorFactory.class);
PageFactory.initElements(locator, login);
}
Modified: trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/test/java/cc/kune/selenium/tools/AbstractWebDriver.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -36,7 +36,6 @@
public abstract class AbstractWebDriver implements WebDriver {
private final String baseUrl;
private final WebDriver driver;
-
private final Selenium selenium;
public AbstractWebDriver(final WebDriver driver, final String baseUrl) {
@@ -44,6 +43,8 @@
this.baseUrl = baseUrl;
selenium = new WebDriverBackedSelenium(driver, baseUrl);
selenium.setSpeed("500");
+ // driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
+
// selenium.setTimeout("5000");
}
Modified: trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java 2011-09-23 03:01:39 UTC (rev 1528)
+++ trunk/src/test/java/cc/kune/wave/server/KuneAgentTest.java 2011-09-23 17:07:21 UTC (rev 1529)
@@ -31,13 +31,12 @@
import org.waveprotocol.box.server.account.RobotAccountData;
import org.waveprotocol.box.server.persistence.AccountStore;
import org.waveprotocol.box.server.persistence.PersistenceException;
+import org.waveprotocol.box.server.robots.agent.AbstractBaseRobotAgent.ServerFrontendAddressHolder;
import org.waveprotocol.wave.model.id.TokenGenerator;
import org.waveprotocol.wave.model.wave.InvalidParticipantAddress;
import org.waveprotocol.wave.model.wave.ParticipantId;
import org.waveprotocol.wave.model.waveref.WaveRef;
-import cc.kune.wave.server.AbstractBaseRobotAgent.ServerFrontendAddressHolder;
-
import com.google.common.collect.Lists;
import com.google.wave.api.Wavelet;
@@ -67,7 +66,8 @@
Mockito.when(accountRobotData.getUrl()).thenReturn(KuneAgent.ROBOT_URI);
Mockito.when(accountRobotData.getId()).thenReturn(participantId);
Mockito.when(accountRobotData.getConsumerSecret()).thenReturn("someconsumer");
- manager = new KuneAgent("example.com", accountStore, tokenGenerator, frontendAddressHolder);
+ // manager = new KuneAgent("example.com", accountStore, tokenGenerator,
+ // frontendAddressHolder);
}
private String getSiteAdminShortName() {
More information about the kune-commits
mailing list