Package com.opensymphony.xwork.interceptor

Source Code of com.opensymphony.xwork.interceptor.OpenSessionContext

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");
    }


}
TOP

Related Classes of com.opensymphony.xwork.interceptor.OpenSessionContext

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.