KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > web > MemoryStrategyBuilder


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * MemoryStrategyBuilder.java
26  *
27  * Created on September 30, 2002, 12:24 PM
28  */

29
30 package com.sun.enterprise.web;
31
32 import java.util.logging.Logger JavaDoc;
33 import java.util.logging.Level JavaDoc;
34 import java.util.ArrayList JavaDoc;
35 import org.apache.catalina.Context;
36 import org.apache.catalina.Container;
37 import org.apache.catalina.core.StandardContext;
38 import org.apache.catalina.session.StandardManager;
39 //import com.iplanet.ias.tools.common.dd.webapp.SessionManager;
40
//import com.sun.enterprise.tools.common.dd.webapp.SessionManager;
41
import com.sun.enterprise.deployment.runtime.web.SessionManager;
42
43
44 public class MemoryStrategyBuilder extends BasePersistenceStrategyBuilder implements PersistenceStrategyBuilder{
45     
46     /** Creates a new instance of MemoryStrategyBuilder */
47     /*
48     public MemoryStrategyBuilder() {
49     }*/

50       
51     
52     public void initializePersistenceStrategy(Context ctx, SessionManager smBean) {
53         super.initializePersistenceStrategy(ctx, smBean);
54         String JavaDoc persistenceType = "memory";
55         String JavaDoc ctxPath = ctx.getPath();
56         if(ctxPath != null && !ctxPath.equals("")) {
57             Object JavaDoc[] params = { ctx.getPath(), persistenceType };
58             _logger.log(Level.FINE, "webcontainer.noPersistence", params);
59         }
60         StandardManager mgr = new StandardManager();
61         //remove this fix because we don't want unload persistence
62
//unless sessionFilename has been set explicitly
63
//following line replaces commented out code
64
/*
65         if (sessionFilename != null) {
66             mgr.setPathname(sessionFilename);
67         }
68          */

69         if (sessionFilename == null) {
70             mgr.setPathname(sessionFilename);
71         } else {
72             mgr.setPathname(prependContextPathTo(sessionFilename, ctx));
73         }
74         StandardContext sctx = (StandardContext) ctx;
75         sctx.restrictedSetPipeline(new WebPipeline(sctx));
76         
77         mgr.setMaxActiveSessions(maxSessions);
78         //START OF 6364900
79
mgr.setSessionLocker(new PESessionLocker(ctx));
80         //END OF 6364900
81
//FIXME: what is the replacement for setCheckInterval
82
//mgr.setCheckInterval(reapInterval);
83
ctx.setManager(mgr);
84         
85         //this must be after ctx.setManager(mgr);
86
if(!sctx.isSessionTimeoutOveridden()) {
87            mgr.setMaxInactiveInterval(sessionMaxInactiveInterval);
88         }
89     }
90     
91 }
92
Popular Tags