KickJava   Java API By Example, From Geeks To Geeks.

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


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  * FileStrategyBuilder.java
26  *
27  * Created on September 30, 2002, 1:42 PM
28  */

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

51     
52     public void initializePersistenceStrategy(Context ctx, SessionManager smBean) {
53         super.initializePersistenceStrategy(ctx, smBean);
54         
55         Object JavaDoc[] params = { ctx.getPath() };
56         _logger.log(Level.INFO, "webcontainer.filePersistence", params);
57         PersistentManager mgr = new PersistentManager();
58         mgr.setMaxActiveSessions(maxSessions);
59         //FIXME: what is the replacement for setCheckInterval
60
//mgr.setCheckInterval(reapInterval);
61
mgr.setMaxIdleBackup(0); // FIXME: Make configurable
62

63         FileStore store = new FileStore();
64         //store.setCheckInterval(storeReapInterval);
65
store.setDirectory(directory);
66         mgr.setStore(store);
67         
68         //for intra-vm session locking
69
StandardContext sctx = (StandardContext) ctx;
70         sctx.restrictedSetPipeline(new PESessionLockingStandardPipeline(sctx));
71         
72         //special code for Java Server Faces
73
if(ctx.findParameter(JSF_HA_ENABLED) == null) {
74             ctx.addParameter(JSF_HA_ENABLED, "true");
75         }
76         //START OF 6364900
77
mgr.setSessionLocker(new PESessionLocker(ctx));
78         //END OF 6364900
79
ctx.setManager(mgr);
80         
81         //this must be after ctx.setManager(mgr);
82
//StandardContext sctx = (StandardContext) ctx;
83
if(!sctx.isSessionTimeoutOveridden()) {
84            mgr.setMaxInactiveInterval(sessionMaxInactiveInterval);
85         }
86     }
87     
88 }
89
Popular Tags