[kune-commits] r830 - in trunk: . script
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/client/state
src/main/java/org/ourproject/kune/platf/client/ui
src/main/java/org/ourproject/kune/platf/server/auth
src/main/java/org/ourproject/kune/rack
src/main/java/org/ourproject/kune/rack/filters
src/main/java/org/ourproject/kune/rack/filters/gwts
src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel
vjrj
vjrj at ourproject.org
Tue Aug 5 19:43:51 CEST 2008
Author: vjrj
Date: 2008-08-05 19:43:43 +0200 (Tue, 05 Aug 2008)
New Revision: 830
Added:
trunk/TROUBLESHOOT
trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java
Modified:
trunk/DEV-GUIDE
trunk/INSTALL
trunk/script/deploy_gwt.sh
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
Log:
new TROUBLESHOOT file, and INSTALL instructions improved
Complete - task 21: Session timeout problems (cookies issue?)
Modified: trunk/DEV-GUIDE
===================================================================
--- trunk/DEV-GUIDE 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/DEV-GUIDE 2008-08-05 17:43:43 UTC (rev 830)
@@ -3,8 +3,24 @@
Development Environment
--------------------------------------------------------------------------------
-See INSTALL for dev specific instructions
+Install kune (see INSTALL file).
+
+mvn eclipse:eclipse generates .project and download necessary code jars.
+
+GWT Hosted Mode:
+
+We have a "Run configuration" (Run > Open Run Dialog) in eclipse with Project: "org.ourproject.kune" with Main class: "com.google.gwt.dev.GWTShell", with this program arguments (or similar): "-noserver -out gwt-out /kune/?locale=en&log_level=INFO -port 8080" and in the "Classpath User Entries":
+ - gwt-dev-[linux|mac|windows].jar
+ - java - /org.ourproject.kune/src/main
+ - org.ourproject.kune (default classpath)
+
+before run hosted mode compile once with:
+ mvn gwt:compile
+and deploy with:
+ script/deploy_gwt.sh
+and then we run jetty (with "mvn jetty:run" also you can run server in debug mode, see TROUBLESHOOT).
+
Code
--------------------------------------------------------------------------------
We use some eclipse code preferences for kune project:
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/INSTALL 2008-08-05 17:43:43 UTC (rev 830)
@@ -4,19 +4,17 @@
For development:
- Install java-jdk (>= 1.5), maven2, mysql (>= 5.0) and for example eclipse
-- Install gwt 1.4.60 and follow Appendix A for maven+gwt configuration
+- Install gwt 1.5rc1 and follow Appendix A for maven+gwt configuration
- Compile with maven:
# (in the trunk directory)
mvn compile
mvn gwt:compile
- Copy the target to src directory (only for test):
- mkdir -p src/main/webapp/gwt/org.ourproject.kune.app.Kune
- unison -batch -auto -ui text target/org.ourproject.kune-0.0.2/org.ourproject.kune.app.Kune/ src/main/webapp/gwt/org.ourproject.kune.app.Kune
+ bin/deploy_gwt.sh
(if you're using windows as dev plaftorm... you will have to write your own script ;). the idea is to
- copy everything from src/main/webapp/gwt/org.ourproject.kune.app.Kune to
- src/main/webapp/gwt/org.ourproject.kune.app.Kune)
+ copy everything from target/kune-0.0.VERSIONHERE/org.ourproject.kune.app.Kune to src/main/webapp/gwt/org.ourproject.kune.app.Kune)
- Make two databases in your mysql:
@@ -35,24 +33,19 @@
sudo chown yourUser:yourUser /var/lib/lucene/kune_dev/indexes
sudo chown yourUser:yourUser /var/lib/lucene/kune_test/indexes
- (in case you are using windows as dev platform you only have to create a couple of folders
- anywhere you like and then specify them in persistence.xml, as follows:
- <property name="hibernate.search.default.indexBase" value="C:\kune\kune-index"/>
+ In case you are using windows as dev platform you only have to create a couple of folders anywhere you like and then specify them in persistence.xml, as follows:
+ <property name="hibernate.search.default.indexBase" value="C:\kune\kune-index"/>
do the same with every persistence unit defined inside.
- )
-- Install and run a openfire jabber server (see Appendix B for proper configuration of openfire)
+- Install and run a openfire jabber server (see Appendix B for proper configuration of openfire) or ejabberd.
- Run jetty:
mvn jetty:run -Ddatabase.migrator.should.run=false # without liquibase db migraton (liquibase.should.run=false in new version)
once started (and initialized the db), you can stop a run jetty with de db migrator to insert initial data and migrate:
mvn jetty:run
-- And conect to http://yourIP:8080/kune
+- And connect to http://yourIP:8080/kune
-- For development with eclipse:
- mvn eclipse:eclipse
-
Appendix A: Configuration of maven
--------------------------------------------------------------------------------
Example of .m2/settings.xml:
@@ -144,4 +137,3 @@
--------------------------------------------------------------------------------
mvn package -Dmaven.test.skip=true -o
-
Added: trunk/TROUBLESHOOT
===================================================================
--- trunk/TROUBLESHOOT 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/TROUBLESHOOT 2008-08-05 17:43:43 UTC (rev 830)
@@ -0,0 +1,5 @@
+Server: debug with jetty in eclipse:
+http://docs.codehaus.org/display/JETTY/Debugging+with+the+Maven+Jetty+Plugin+inside+Eclipse
+
+Client code: you can debug with gwt hosted mode in eclipse (see DEV-GUIDE for hosted mode instructions).
+
Modified: trunk/script/deploy_gwt.sh
===================================================================
--- trunk/script/deploy_gwt.sh 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/script/deploy_gwt.sh 2008-08-05 17:43:43 UTC (rev 830)
@@ -1,4 +1,7 @@
#!/bin/bash
+
+mkdir -p src/main/webapp/gwt/org.ourproject.kune.app.Kune
+
find target/kune-0.0.4/org.ourproject.kune.app.Kune/ -name .DS_Store -exec rm {} \;
script/css-compact-and-tidy.css
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -18,9 +18,9 @@
import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
import org.ourproject.kune.platf.client.state.ContentProvider;
-import org.ourproject.kune.platf.client.state.ContentProviderImpl;
+import org.ourproject.kune.platf.client.state.ContentProviderDefault;
import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.SessionImpl;
+import org.ourproject.kune.platf.client.state.SessionDefault;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.state.StateManagerDefault;
import org.ourproject.kune.platf.client.tool.ToolSelector;
@@ -157,7 +157,7 @@
register(SingletonScope.class, new Factory<Session>(Session.class) {
public Session create() {
- return new SessionImpl(Cookies.getCookie(Site.USERHASH), $p(UserServiceAsync.class));
+ return new SessionDefault(Cookies.getCookie(Site.USERHASH), $p(UserServiceAsync.class));
}
}, new Factory<I18nServiceAsync>(I18nServiceAsync.class) {
public I18nServiceAsync create() {
@@ -230,7 +230,7 @@
}
}, new Factory<ContentProvider>(ContentProvider.class) {
public ContentProvider create() {
- return new ContentProviderImpl($(ContentServiceAsync.class));
+ return new ContentProviderDefault($(ContentServiceAsync.class));
}
}, new Factory<StateManager>(StateManager.class) {
public StateManager create() {
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java (from rev 827, trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java 2008-08-05 01:27:25 UTC (rev 827)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -0,0 +1,60 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.ourproject.kune.platf.client.state;
+
+import java.util.HashMap;
+
+import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.workspace.client.sitebar.Site;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+public class ContentProviderDefault implements ContentProvider {
+
+ private final ContentServiceAsync server;
+ private final HashMap<StateToken, StateDTO> cache;
+
+ public ContentProviderDefault(final ContentServiceAsync server) {
+ this.server = server;
+ this.cache = new HashMap<StateToken, StateDTO>();
+ }
+
+ public void cache(final StateToken encodeState, final StateDTO content) {
+ cache.put(encodeState, content);
+ }
+
+ public void getContent(final String user, final StateToken newState, final AsyncCallback<StateDTO> callback) {
+ Site.showProgressLoading();
+ final StateDTO catched = getCached(newState);
+ if (catched != null) {
+ callback.onSuccess(catched);
+ } else {
+ server.getContent(user, newState.getGroup(), newState, callback);
+ }
+ }
+
+ private StateDTO getCached(final StateToken newState) {
+ return cache.remove(newState);
+ }
+
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -1,60 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package org.ourproject.kune.platf.client.state;
-
-import java.util.HashMap;
-
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.workspace.client.sitebar.Site;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-public class ContentProviderImpl implements ContentProvider {
-
- private final ContentServiceAsync server;
- private final HashMap<StateToken, StateDTO> cache;
-
- public ContentProviderImpl(final ContentServiceAsync server) {
- this.server = server;
- this.cache = new HashMap<StateToken, StateDTO>();
- }
-
- public void cache(final StateToken encodeState, final StateDTO content) {
- cache.put(encodeState, content);
- }
-
- public void getContent(final String user, final StateToken newState, final AsyncCallback<StateDTO> callback) {
- Site.showProgressLoading();
- final StateDTO catched = getCached(newState);
- if (catched != null) {
- callback.onSuccess(catched);
- } else {
- server.getContent(user, newState.getGroup(), newState, callback);
- }
- }
-
- private StateDTO getCached(final StateToken newState) {
- return cache.remove(newState);
- }
-
-}
Copied: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java (from rev 827, trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java 2008-08-05 01:27:25 UTC (rev 827)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -0,0 +1,196 @@
+/*
+ *
+ * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.ourproject.kune.platf.client.state;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
+import org.ourproject.kune.platf.client.dto.I18nLanguageSimpleDTO;
+import org.ourproject.kune.platf.client.dto.InitDataDTO;
+import org.ourproject.kune.platf.client.dto.LicenseDTO;
+import org.ourproject.kune.platf.client.dto.StateDTO;
+import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.workspace.client.sitebar.rpc.UserServiceAsync;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Signal;
+import com.calclab.suco.client.signal.Signal0;
+import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
+
+public class SessionDefault implements Session {
+ private String userHash;
+ private InitDataDTO initData;
+ private UserInfoDTO currentUserInfo;
+ private Object[][] languagesArray;
+ private Object[][] countriesArray;
+ private Object[][] timezonesArray;
+ private StateDTO currentState;
+ private I18nLanguageDTO currentLanguage;
+ private final Signal<InitDataDTO> onInitDataReceived;
+ private final Signal<UserInfoDTO> onUserSignIn;
+ private final Signal0 onUserSignOut;
+ private final Provider<UserServiceAsync> userServiceProvider;
+
+ public SessionDefault(final String userHash, final Provider<UserServiceAsync> userServiceProvider) {
+ this.userHash = userHash;
+ this.userServiceProvider = userServiceProvider;
+ languagesArray = null;
+ this.onInitDataReceived = new Signal<InitDataDTO>("initDataReceived");
+ this.onUserSignIn = new Signal<UserInfoDTO>("onUserSignIn");
+ this.onUserSignOut = new Signal0("onUserSignOut");
+ }
+
+ public void check(final AsyncCallbackSimple<?> callback) {
+ Log.debug("Checking session (userhash: " + getUserHash() + ")");
+ userServiceProvider.get().onlyCheckSession(getUserHash(), callback);
+ }
+
+ public List<I18nCountryDTO> getCountries() {
+ return initData.getCountries();
+ }
+
+ public Object[][] getCountriesArray() {
+ if (countriesArray == null) {
+ countriesArray = mapCountries();
+ }
+ return countriesArray;
+ }
+
+ public I18nLanguageDTO getCurrentLanguage() {
+ return currentLanguage;
+ }
+
+ public StateDTO getCurrentState() {
+ return currentState;
+ }
+
+ public UserInfoDTO getCurrentUserInfo() {
+ return currentUserInfo;
+ }
+
+ public List<I18nLanguageSimpleDTO> getLanguages() {
+ return initData.getLanguages();
+ }
+
+ public Object[][] getLanguagesArray() {
+ if (languagesArray == null) {
+ languagesArray = mapLangs();
+ }
+ return languagesArray;
+ }
+
+ public List<LicenseDTO> getLicenses() {
+ return initData.getLicenses();
+ }
+
+ public Object[][] getTimezones() {
+ if (timezonesArray == null) {
+ mapTimezones();
+ }
+ return timezonesArray;
+ }
+
+ public String getUserHash() {
+ return userHash;
+ }
+
+ public boolean isLogged() {
+ return userHash != null;
+ }
+
+ public void onInitDataReceived(final Slot<InitDataDTO> slot) {
+ onInitDataReceived.add(slot);
+ }
+
+ public void onUserSignIn(final Slot<UserInfoDTO> slot) {
+ onUserSignIn.add(slot);
+ }
+
+ public void onUserSignOut(final Slot0 slot) {
+ onUserSignOut.add(slot);
+ }
+
+ public void setCurrent(final StateDTO currentState) {
+ this.currentState = currentState;
+ }
+
+ public void setCurrentLanguage(final I18nLanguageDTO currentLanguage) {
+ this.currentLanguage = currentLanguage;
+ }
+
+ public void setCurrentState(final StateDTO currentState) {
+ this.currentState = currentState;
+ }
+
+ public void setCurrentUserInfo(final UserInfoDTO currentUserInfo) {
+ this.currentUserInfo = currentUserInfo;
+ if (currentUserInfo != null) {
+ onUserSignIn.fire(currentUserInfo);
+ } else {
+ onUserSignOut.fire();
+ }
+ }
+
+ public void setInitData(final InitDataDTO initData) {
+ this.initData = initData;
+ onInitDataReceived.fire(initData);
+ }
+
+ public void setUserHash(final String userHash) {
+ this.userHash = userHash;
+ }
+
+ private Object[][] mapCountries() {
+ final Object[][] objs = new Object[initData.getCountries().size()][1];
+ int i = 0;
+ for (final Iterator<I18nCountryDTO> iterator = initData.getCountries().iterator(); iterator.hasNext();) {
+ final I18nCountryDTO country = iterator.next();
+ final Object[] obj = new Object[] { country.getCode(), country.getEnglishName() };
+ objs[i++] = obj;
+ }
+ return objs;
+ }
+
+ private Object[][] mapLangs() {
+ final Object[][] objs = new Object[initData.getLanguages().size()][1];
+ int i = 0;
+ for (final Iterator<I18nLanguageSimpleDTO> iterator = initData.getLanguages().iterator(); iterator.hasNext();) {
+ final I18nLanguageSimpleDTO language = iterator.next();
+ final Object[] obj = new Object[] { language.getCode(), language.getEnglishName() };
+ objs[i++] = obj;
+ }
+ return objs;
+ }
+
+ private void mapTimezones() {
+ timezonesArray = new Object[initData.getTimezones().length][1];
+ for (int i = 0; i < getTimezones().length; i++) {
+ final Object[] obj = new Object[] { initData.getTimezones()[i] };
+ timezonesArray[i] = obj;
+ }
+ }
+
+}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -1,196 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-package org.ourproject.kune.platf.client.state;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.I18nLanguageSimpleDTO;
-import org.ourproject.kune.platf.client.dto.InitDataDTO;
-import org.ourproject.kune.platf.client.dto.LicenseDTO;
-import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.dto.UserInfoDTO;
-import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.workspace.client.sitebar.rpc.UserServiceAsync;
-
-import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.suco.client.container.Provider;
-import com.calclab.suco.client.signal.Signal;
-import com.calclab.suco.client.signal.Signal0;
-import com.calclab.suco.client.signal.Slot;
-import com.calclab.suco.client.signal.Slot0;
-
-public class SessionImpl implements Session {
- private String userHash;
- private InitDataDTO initData;
- private UserInfoDTO currentUserInfo;
- private Object[][] languagesArray;
- private Object[][] countriesArray;
- private Object[][] timezonesArray;
- private StateDTO currentState;
- private I18nLanguageDTO currentLanguage;
- private final Signal<InitDataDTO> onInitDataReceived;
- private final Signal<UserInfoDTO> onUserSignIn;
- private final Signal0 onUserSignOut;
- private final Provider<UserServiceAsync> userServiceProvider;
-
- public SessionImpl(final String userHash, final Provider<UserServiceAsync> userServiceProvider) {
- this.userHash = userHash;
- this.userServiceProvider = userServiceProvider;
- languagesArray = null;
- this.onInitDataReceived = new Signal<InitDataDTO>("initDataReceived");
- this.onUserSignIn = new Signal<UserInfoDTO>("onUserSignIn");
- this.onUserSignOut = new Signal0("onUserSignOut");
- }
-
- public void check(final AsyncCallbackSimple<?> callback) {
- Log.debug("Checking session (userhash: " + getUserHash() + ")");
- userServiceProvider.get().onlyCheckSession(getUserHash(), callback);
- }
-
- public List<I18nCountryDTO> getCountries() {
- return initData.getCountries();
- }
-
- public Object[][] getCountriesArray() {
- if (countriesArray == null) {
- countriesArray = mapCountries();
- }
- return countriesArray;
- }
-
- public I18nLanguageDTO getCurrentLanguage() {
- return currentLanguage;
- }
-
- public StateDTO getCurrentState() {
- return currentState;
- }
-
- public UserInfoDTO getCurrentUserInfo() {
- return currentUserInfo;
- }
-
- public List<I18nLanguageSimpleDTO> getLanguages() {
- return initData.getLanguages();
- }
-
- public Object[][] getLanguagesArray() {
- if (languagesArray == null) {
- languagesArray = mapLangs();
- }
- return languagesArray;
- }
-
- public List<LicenseDTO> getLicenses() {
- return initData.getLicenses();
- }
-
- public Object[][] getTimezones() {
- if (timezonesArray == null) {
- mapTimezones();
- }
- return timezonesArray;
- }
-
- public String getUserHash() {
- return userHash;
- }
-
- public boolean isLogged() {
- return userHash != null;
- }
-
- public void onInitDataReceived(final Slot<InitDataDTO> slot) {
- onInitDataReceived.add(slot);
- }
-
- public void onUserSignIn(final Slot<UserInfoDTO> slot) {
- onUserSignIn.add(slot);
- }
-
- public void onUserSignOut(final Slot0 slot) {
- onUserSignOut.add(slot);
- }
-
- public void setCurrent(final StateDTO currentState) {
- this.currentState = currentState;
- }
-
- public void setCurrentLanguage(final I18nLanguageDTO currentLanguage) {
- this.currentLanguage = currentLanguage;
- }
-
- public void setCurrentState(final StateDTO currentState) {
- this.currentState = currentState;
- }
-
- public void setCurrentUserInfo(final UserInfoDTO currentUserInfo) {
- this.currentUserInfo = currentUserInfo;
- if (currentUserInfo != null) {
- onUserSignIn.fire(currentUserInfo);
- } else {
- onUserSignOut.fire();
- }
- }
-
- public void setInitData(final InitDataDTO initData) {
- this.initData = initData;
- onInitDataReceived.fire(initData);
- }
-
- public void setUserHash(final String userHash) {
- this.userHash = userHash;
- }
-
- private Object[][] mapCountries() {
- final Object[][] objs = new Object[initData.getCountries().size()][1];
- int i = 0;
- for (final Iterator<I18nCountryDTO> iterator = initData.getCountries().iterator(); iterator.hasNext();) {
- final I18nCountryDTO country = iterator.next();
- final Object[] obj = new Object[] { country.getCode(), country.getEnglishName() };
- objs[i++] = obj;
- }
- return objs;
- }
-
- private Object[][] mapLangs() {
- final Object[][] objs = new Object[initData.getLanguages().size()][1];
- int i = 0;
- for (final Iterator<I18nLanguageSimpleDTO> iterator = initData.getLanguages().iterator(); iterator.hasNext();) {
- final I18nLanguageSimpleDTO language = iterator.next();
- final Object[] obj = new Object[] { language.getCode(), language.getEnglishName() };
- objs[i++] = obj;
- }
- return objs;
- }
-
- private void mapTimezones() {
- timezonesArray = new Object[initData.getTimezones().length][1];
- for (int i = 0; i < getTimezones().length; i++) {
- final Object[] obj = new Object[] { initData.getTimezones()[i] };
- timezonesArray[i] = obj;
- }
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -68,9 +68,8 @@
if (panel.isRendered()) {
panel.syncSize();
panel.doLayout();
- doLayoutIfNeeded();
}
- // doLayoutIfNeeded();
+ doLayoutIfNeeded();
}
public void addStyle(final String style) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -23,6 +23,8 @@
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.platf.client.errors.SessionExpiredException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.server.UserSession;
@@ -32,6 +34,8 @@
public class AuthenticatedMethodInterceptor implements MethodInterceptor {
+ public static final Log log = LogFactory.getLog(AuthenticatedMethodInterceptor.class);
+
@Inject
Provider<UserSession> userSessionProvider;
@@ -42,33 +46,40 @@
Provider<SessionService> sessionServiceProvider;
public Object invoke(final MethodInvocation invocation) throws Throwable {
- Object[] arguments = invocation.getArguments();
- String userHash = (String) arguments[0];
+ final Object[] arguments = invocation.getArguments();
+ // Some browsers getCookie returns "null" as String instead of null
+ final String userHash = arguments[0] == null || arguments[0].equals("null") ? null : (String) arguments[0];
- UserSession userSession = userSessionProvider.get();
- SessionService sessionService = sessionServiceProvider.get();
+ log.info("Method: " + invocation.getMethod().getName());
+ log.info("Userhash received: " + userHash);
+ log.info("--------------------------------------------------------------------------------");
+ final UserSession userSession = userSessionProvider.get();
+ final SessionService sessionService = sessionServiceProvider.get();
- Authenticated authAnnotation = invocation.getStaticPart().getAnnotation(Authenticated.class);
- boolean mandatory = authAnnotation.mandatory();
+ final Authenticated authAnnotation = invocation.getStaticPart().getAnnotation(Authenticated.class);
+ final boolean mandatory = authAnnotation.mandatory();
- if (userHash == null && mandatory) {
- sessionService.getNewSession();
- throw new UserMustBeLoggedException();
- } else if (userSession.isUserNotLoggedIn() && mandatory) {
- sessionService.getNewSession();
- throw new SessionExpiredException();
- } else if (userSession.isUserNotLoggedIn() && userHash == null) {
- // Ok, do nothing
- } else if (userSession.isUserNotLoggedIn() && userHash != null) {
- sessionService.getNewSession();
- throw new SessionExpiredException();
- } else if (!userSession.getHash().equals(userHash)) {
- userSession.logout();
- sessionService.getNewSession();
- throw new SessionExpiredException();
- }
- Object result = invocation.proceed();
- return result;
+ if (userHash == null && mandatory) {
+ sessionService.getNewSession();
+ throw new UserMustBeLoggedException();
+ } else if (userSession.isUserNotLoggedIn() && mandatory) {
+ sessionService.getNewSession();
+ log.info("Session expired (not logged in server and mandatory)");
+ throw new SessionExpiredException();
+ } else if (userSession.isUserNotLoggedIn() && userHash == null) {
+ // Ok, do nothing
+ } else if (userSession.isUserNotLoggedIn() && userHash != null) {
+ sessionService.getNewSession();
+ log.info("Session expired (not logged in server)");
+ throw new SessionExpiredException();
+ } else if (!userSession.getHash().equals(userHash)) {
+ userSession.logout();
+ sessionService.getNewSession();
+ log.info("Session expired (userHash different in server)");
+ throw new SessionExpiredException();
+ }
+ final Object result = invocation.proceed();
+ return result;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -63,7 +63,7 @@
private void execute(final Filter filter, final ServletRequest request, final ServletResponse response)
throws IOException, ServletException {
- log.debug("RACK FILTER: " + filter.getClass().getSimpleName());
+ // log.debug("RACK FILTER: " + filter.getClass().getSimpleName());
filter.doFilter(request, response, this);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -39,12 +39,12 @@
}
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
- throws IOException, ServletException {
- long start = System.currentTimeMillis();
- log.debug("REQUEST: " + RackHelper.getURI(request));
- chain.doFilter(request, response);
- long finish = System.currentTimeMillis();
- log.debug("TOTAL TIME: " + (finish - start) + " miliseconds");
+ throws IOException, ServletException {
+ // final long start = System.currentTimeMillis();
+ log.debug("REQUEST: " + RackHelper.getURI(request));
+ chain.doFilter(request, response);
+ // final long finish = System.currentTimeMillis();
+ // log.debug("TOTAL TIME: " + (finish - start) + " miliseconds");
}
public void init(final FilterConfig filterConfig) throws ServletException {
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -43,22 +43,23 @@
private final DelegatedRemoteServlet servlet;
public GWTServiceFilter(final Class<? extends RemoteService> serviceClass) {
- this.serviceClass = serviceClass;
- this.servlet = new DelegatedRemoteServlet();
+ this.serviceClass = serviceClass;
+ this.servlet = new DelegatedRemoteServlet();
}
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
+ throws IOException, ServletException {
+ log.info("--------------------------------------------------------------------------------");
+ log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
+ final RemoteService service = getInstance(serviceClass);
+ servlet.setService(service);
+ servlet.doPost((HttpServletRequest) request, (HttpServletResponse) response);
+ }
+
@Override
public void init(final FilterConfig filterConfig) throws ServletException {
- super.init(filterConfig);
- servlet.setServletContext(filterConfig.getServletContext());
+ super.init(filterConfig);
+ servlet.setServletContext(filterConfig.getServletContext());
}
- public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
- throws IOException, ServletException {
- log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
- RemoteService service = getInstance(serviceClass);
- servlet.setService(service);
- servlet.doPost((HttpServletRequest) request, (HttpServletResponse) response);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-05 01:32:52 UTC (rev 829)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java 2008-08-05 17:43:43 UTC (rev 830)
@@ -36,6 +36,9 @@
public void addInTools(final Widget widget) {
entityTools.add(widget);
+ if (entityTools.isRendered()) {
+ entityTools.doLayout(false);
+ }
mainPanel.doLayoutIfNeeded();
}
More information about the kune-commits
mailing list