KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.ejb.EnterpriseBean JavaDoc;
26
27 /**
28  * Implementation of EJBContext for ReadOnlyBeans. Contains extra
29  * attributes that allows selective ejbLoad()
30  *
31  * @author Mahesh Kannan
32  */

33
34 public final class ReadOnlyContextImpl
35     extends EntityContextImpl
36 {
37     private int pkLevelSequenceNum;
38     private long lastRefreshedAt;
39     private boolean removed = false;
40
41     // only non-null when associated with a primary-key
42
private ReadOnlyBeanInfo robInfo;
43     
44     ReadOnlyContextImpl(EnterpriseBean JavaDoc ejb, BaseContainer container) {
45         super(ejb, container);
46     }
47
48     public int getPKLevelSequenceNum() {
49         return pkLevelSequenceNum;
50     }
51
52     public void incrementPKLevelSequenceNum() {
53         pkLevelSequenceNum++;
54     }
55
56     public void setPKLevelSequenceNum(int num) {
57         pkLevelSequenceNum = num;
58     }
59
60     public long getLastRefreshedAt() {
61         return lastRefreshedAt;
62     }
63     
64     public void setLastRefreshedAt(long time) {
65         lastRefreshedAt = time;
66     }
67     
68     public boolean isRemoved() {
69         return removed;
70     }
71     
72     public void setRemoved(boolean value) {
73         removed = value;
74     }
75     
76     public void setReadOnlyBeanInfo(ReadOnlyBeanInfo info) {
77         robInfo = info;
78
79         // Whenever read-only bean info is set or nulled out, initialize
80
// its derived fields.
81
pkLevelSequenceNum = -1;
82         lastRefreshedAt = 0;
83     }
84
85     public ReadOnlyBeanInfo getReadOnlyBeanInfo() {
86         return robInfo;
87     }
88 }
89
Popular Tags