package com.opensymphony.xwork.interceptor;
import java.util.Map;
import com.opensymphony.xwork.util.OgnlValueStack;
public class OpenSessionContext {
static ThreadLocal openSessionContextLocal = new ThreadLocal();
Map mapContext;
public OpenSessionContext(Map mapContext) {
this.mapContext = mapContext;
}
public static OpenSessionContext getContext() {
OpenSessionContext openSessionContext = (OpenSessionContext) openSessionContextLocal.get();
if (openSessionContext == null) {
OgnlValueStack vs = new OgnlValueStack();
openSessionContext = new OpenSessionContext(vs.getContext());
openSessionContextLocal.set(openSessionContext);
}
return openSessionContext;
}
public Object get(Object key) {
return mapContext.get(key);
}
public void set(Object key, Object value) {
mapContext.put(key, value);
}
public void setOpenSessionAlreadyIntercepted(String interceptedName) {
set("OpenSessionIntercepted", interceptedName);
}
public String getOpenSessionAlreadyIntercepted() {
return (String) get("OpenSessionIntercepted");
}
}