Skip to content

Commit

Permalink
FIXED - #1: Update to tapestry 5.4
Browse files Browse the repository at this point in the history
- continue clean up
- address deprecated usage
- fix all warnings
- remove commented out code
  • Loading branch information
kaosko committed Jan 21, 2016
1 parent cbb14f3 commit 58c4005
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ protected enum Keys {
private ConversationalPersistentFieldStrategy pagePersistentFieldStrategy;

private HttpServletRequest servletRequest;

private Map<String, List<ConversationAware>> conversationAwareListeners = Collections.synchronizedMap(new HashMap<String, List<ConversationAware>>());

public ConversationManagerImpl(Request request, HttpServletRequest servletRequest, Cookies cookies, Map<Class,ConversationAware> listeners) {
@SuppressWarnings("rawtypes")
public ConversationManagerImpl(Request request, HttpServletRequest servletRequest, Cookies cookies,
Map<Class, ConversationAware> listeners) {
this.request = request;
this.cookies = cookies;
this.servletRequest = servletRequest;
for (Entry<Class,ConversationAware> entry : listeners.entrySet() ) {
for (Entry<Class, ConversationAware> entry : listeners.entrySet()) {
String pageName = entry.getKey().getSimpleName();
addConversationListener(pageName, entry.getValue());
}
Expand Down Expand Up @@ -107,8 +109,8 @@ public String createConversation(String pageName, Integer maxIdleSeconds, Intege

public String createConversation(String id, String pageName, Integer maxIdleSeconds, Integer maxConversationLengthSeconds, boolean useCookie) {
pageName = pageName == null ? "" : pageName;
// Don't use path in a cookie, it's actually relatively difficult to find out from here
if (useCookie) cookies.writeCookieValue(pageName.toLowerCase() + Keys._conversationId.toString(), String.valueOf(id));
if (useCookie)
cookies.getBuilder(pageName.toLowerCase() + Keys._conversationId.toString(), String.valueOf(id)).write();
Conversation conversation = new Conversation(servletRequest.getSession(true).getId(), id, pageName, maxIdleSeconds, maxConversationLengthSeconds, useCookie);
endIdleConversations();
getConversations().put(id, conversation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,90 +76,4 @@ define([], function(){
};

return ConversationModerator;
});

//var ConversationModerator = Class.create();
//
//function notImplemented(notImplemented) {
// alert("Not yet implemented " + notImplemented);
//}
//
//ConversationModerator.prototype = {
// initialize: function(baseURI, defaultURIparameters, keepAlive, endOnClose, idleCheckSeconds, warnBeforeSeconds,
// warnBeforeHandler, endedHandler) {
// this.baseURI = baseURI;
// this.defaultURIparameters = defaultURIparameters;
// this.keepAlive = keepAlive;
// this.endOnClose = endOnClose;
// this.idleCheckSeconds = idleCheckSeconds;
// this.warnBeforeSeconds = warnBeforeSeconds;
// this.warnBeforeHandler = warnBeforeHandler;
// this.endedHandler = endedHandler;
// this.idleCheckId = null;
//
// if (idleCheckSeconds != null && idleCheckSeconds > 0) this.checkIdleNext(idleCheckSeconds);
// },
//
// checkIdle: function() {
// new Ajax.Request(this.baseURI + "checkidle" + this.defaultURIparameters + this.keepAlive + '&warn=' + this.warnBeforeSeconds
// +'&timestamp='+(new Date()).getTime(), {
// method: 'get',
// evalJSON:true,
// onSuccess: this.handleIdleCheckResult.bind(this)
// });
// },
//
// end: function() {
// if (!this.endOnClose) return;
// new Ajax.Request(this.baseURI + "end" + this.defaultURIparameters + false, {
// method: 'get'
// });
// },
//
// refresh: function() {
// new Ajax.Request(this.baseURI + "refresh" + this.defaultURIparameters + 'true', {
// method: 'get'
// });
// },
//
// checkIdleNext: function(nextCheck) {
// if (typeof(nextCheck) == 'undefined' || nextCheck <= 0) return;
// if (this.idleCheckId != null) clearTimeout(this.idleCheckId);
// this.idleCheckId = setTimeout(this.checkIdle.bind(this), nextCheck * 1000);
// },
//
// callHandler : function(handlerName, arg) {
// // handlerName should be a string identifier of form "obj.property.function"
// var pos = handlerName.lastIndexOf('.');
// var context = null;
// if (pos > 0 ) context = eval(handlerName.substring(0,pos));
// if (handlerName.substr(handlerName.length-2,2) == '()' ) handlerName = handlerName.substring(0,handlerName.length - 2);
// var operation = eval(handlerName);
// // FIXME should log something if operation doesn't exist
// if (typeof(operation) == 'function') {
// if (context == null) operation(arg);
// else operation.bind(context)(arg);
// }
// },
//
// warnOfEnd : function(inSeconds) {
// if (this.warnBeforeHandler != null) {
// this.callHandler(this.warnBeforeHandler, inSeconds);
// }
// else alert('The page will become idle soon...');
// },
//
// handleIdleCheckResult: function(transport) {
// var nextCheck = transport.responseJSON.nextCheck;
// if (isNaN(nextCheck)) nextCheck = -1;
// if (nextCheck <= 0 ) {
// if (this.endedHandler != null) this.callHandler(this.endedHandler);
// return;
// }
// var warnFor = transport.responseJSON.warn;
// if (!isNaN(warnFor)) if (warnFor > 0) this.warnOfEnd(warnFor);
//
// this.checkIdleNext(nextCheck);
// }
//
//}
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class SessionConversation {
@Property
private String comment;

@SuppressWarnings("unused")
@Property
private Integer secondsLeft;

Expand All @@ -38,9 +37,9 @@ public void setupRender() {
}
secondsLeft = conversationManager.getSecondsBeforeActiveConversationBecomesIdle();
}

public void onAction() {
conversationManager.endConversation(conversationId);
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.tynamo.conversations.test.services;

import org.apache.tapestry5.ioc.ServiceBinder;
import org.apache.tapestry5.ioc.annotations.SubModule;
import org.apache.tapestry5.ioc.annotations.ImportModule;
import org.tynamo.conversations.services.ConversationModule;

@SubModule(ConversationModule.class)
@ImportModule(ConversationModule.class)
public class AppModule {
public static void bind(ServiceBinder binder) {
}
Expand Down

0 comments on commit 58c4005

Please sign in to comment.