KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > ejb > containers > ReadOnlyBeanInfo


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 package com.sun.ejb.containers;
24
25 import java.util.Date JavaDoc;
26
27 /**
28  * Per-primary key information stored for read-only beans.
29  *
30  * @author Kenneth Saks
31  */

32
33 final class ReadOnlyBeanInfo
34 {
35
36     Object JavaDoc primaryKey;
37
38     // Used to track staleness versus the bean-level refresh.
39
int beanLevelSequenceNum;
40
41     // Set to true when a programmatic refresh takes place.
42
boolean refreshNeeded;
43     
44     // Sequence number associated with a point in time when refresh occurred.
45
// Each context for this pk also has a sequence number value. If they
46
// differ it means the context needs an ejbLoad.
47
int pkLevelSequenceNum;
48
49     // last time when refresh was programattically requested for this PK.
50
long lastRefreshRequestedAt;
51     
52     // time at which refresh actually occurred.
53
long lastRefreshedAt;
54     
55     Object JavaDoc cachedEjbLocalObject; //Cached only for findByPK
56

57     Object JavaDoc cachedEjbObject; //Cached only for findByPK
58

59     public String JavaDoc toString() {
60         
61         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
62         buffer.append("Read Only Bean Info for " + primaryKey + "\n");
63         buffer.append("Refresh needed = " + refreshNeeded + "\n");
64         buffer.append("Bean level sequence num = " + beanLevelSequenceNum
65                       + "\n");
66         buffer.append("PK level sequence num = " + pkLevelSequenceNum + "\n");
67         if( lastRefreshRequestedAt > 0 ) {
68             buffer.append("Last refresh requested at " +
69                           new Date JavaDoc(lastRefreshRequestedAt)
70                           + "\n");
71         } else {
72             buffer.append("Refresh has never been requested\n");
73         }
74         if( lastRefreshedAt > 0 ) {
75             buffer.append("Last refreshed at " +
76                           new Date JavaDoc(lastRefreshedAt) + "\n");
77         } else {
78             buffer.append("Never refreshed\n");
79         }
80         
81         return buffer.toString();
82     }
83     
84 }
85
Popular Tags