You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/11/13 23:40:41 UTC
svn commit: r1409001 -
/isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java
Author: danhaywood
Date: Tue Nov 13 22:40:40 2012
New Revision: 1409001
URL: http://svn.apache.org/viewvc?rev=1409001&view=rev
Log:
ISIS-232: more on generalizing IsisContextForWicket
now falls back to using thread local if no wicket session
(this to support a background scheduler service)
Modified:
isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java
Modified: isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java
URL: http://svn.apache.org/viewvc/isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java?rev=1409001&r1=1409000&r2=1409001&view=diff
==============================================================================
--- isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java (original)
+++ isis/trunk/framework/viewer/wicket/wicket-viewer/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java Tue Nov 13 22:40:40 2012
@@ -155,9 +155,18 @@ public class IsisContextForWicket extend
LOG.debug(String.format("wicketSession: %s CLOSE %d -> %d %s %s %s", wicketSessionId, before, after, logMsg, (authSession != null? authSession.getUserName(): "[null]"), (isisSession != null? isisSession.getId(): "[null]")));
}
}
-
}
}
+
+ @Override
+ public boolean equals(SessionKey sessionKey, SessionKey other) {
+ return sessionKey.wicketSession == other.wicketSession;
+ }
+
+ @Override
+ public int hashCode(SessionKey sessionKey) {
+ return sessionKey.wicketSession.hashCode();
+ }
},
THREAD {
@Override
@@ -202,6 +211,16 @@ public class IsisContextForWicket extend
}
}
}
+
+ @Override
+ public boolean equals(SessionKey sessionKey, SessionKey other) {
+ return sessionKey.thread == other.thread;
+ }
+
+ @Override
+ public int hashCode(SessionKey sessionKey) {
+ return sessionKey.thread.hashCode();
+ }
};
public abstract String getId(SessionKey sessionKey);
@@ -209,6 +228,9 @@ public class IsisContextForWicket extend
public abstract IsisSession beginInteraction(final SessionKey sessionKey, final AuthenticationSession authSession, final IsisSessionFactory sessionFactory, final Map<SessionKey, IsisSession> sessionMap);
public abstract void endInteraction(SessionKey sessionKey, final Map<SessionKey, IsisSession> sessionMap);
+
+ public abstract boolean equals(SessionKey sessionKey, SessionKey other);
+ public abstract int hashCode(SessionKey sessionKey);
}
private static class SessionKey {
@@ -236,6 +258,28 @@ public class IsisContextForWicket extend
type.endInteraction(this, sessionMap);
}
}
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SessionKey other = (SessionKey) obj;
+ if (type != other.type)
+ return false;
+ return type.equals(this, other);
+ }
+ @Override
+ public int hashCode() {
+ return type.hashCode(this);
+ }
+ @Override
+ public String toString() {
+ return "SessionKey[" + type + "]:id=" + getId();
+ }
+
}
@@ -276,7 +320,8 @@ public class IsisContextForWicket extend
if (bootstrapSession != null) {
return bootstrapSession;
}
- return sessionMap.get(SessionKey.get());
+ SessionKey sessionKey = SessionKey.get();
+ return sessionMap.get(sessionKey);
}
@Override