KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > base > sfsb > initialization > AbstractPersistenceStrategyBuilder


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 package com.sun.ejb.base.sfsb.initialization;
25
26 import java.lang.reflect.Method JavaDoc;
27
28 import java.net.InetAddress JavaDoc;
29
30 import java.util.logging.Logger JavaDoc;
31 import java.util.logging.Level JavaDoc;
32
33 import com.sun.ejb.spi.sfsb.initialization.PersistenceStrategyBuilder;
34 import com.sun.ejb.spi.sfsb.initialization.SFSBContainerInitialization;
35 import com.sun.ejb.spi.sfsb.util.CheckpointPolicy;
36
37 import com.sun.ejb.base.sfsb.util.CheckpointPolicyImpl;
38 import com.sun.ejb.base.sfsb.util.ScrambledKeyGenerator;
39 import com.sun.ejb.base.sfsb.util.SimpleKeyGenerator;
40
41 import com.sun.enterprise.deployment.EjbDescriptor;
42 import com.sun.enterprise.util.Utility;
43
44 import com.sun.logging.LogDomains;
45
46 import com.sun.ejb.base.container.util.CacheProperties;
47
48 /**
49  * (Abstract)Base class for all the PersistenceStrategyBuilders.
50  * Any code that is common to both HADB and File StoreManagers
51  * can be put here.
52  *
53  * @author Mahesh Kannan
54  */

55 public abstract class AbstractPersistenceStrategyBuilder
56     implements PersistenceStrategyBuilder
57 {
58     protected static Logger JavaDoc _logger =
59     LogDomains.getLogger(LogDomains.EJB_LOGGER);
60
61     protected SFSBContainerInitialization container;
62     protected EjbDescriptor descriptor;
63     private int removalGracePeriodInSeconds = 0;
64
65     public AbstractPersistenceStrategyBuilder() {
66     }
67     
68     public void initializePersistenceStrategy(
69     SFSBContainerInitialization container, EjbDescriptor descriptor)
70     {
71     this.container = container;
72     this.descriptor = descriptor;
73
74     CacheProperties cacheProps = new CacheProperties(descriptor);
75     int removalTimeout = cacheProps.getRemovalTimeoutInSeconds();
76     if (removalTimeout > 0) {
77         this.removalGracePeriodInSeconds = removalTimeout / 2;
78     }
79     container.setRemovalGracePeriodInSeconds(removalGracePeriodInSeconds);
80     }
81
82     protected int getRemovalGracePeriodInSeconds() {
83     return this.removalGracePeriodInSeconds;
84     }
85
86 }
87
Popular Tags