KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jalisto > se > impl > server > oid > OidInfo


1 /*
2  * Jalisto - JAva LIght STOrage
3  * Copyright (C) 2000-2005 Xcalia http://www.xcalia.com
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18  *
19  * Xcalia
20  * 71, rue Desnouettes
21  * 75014 Paris - France
22  * http://www.xcalia.com
23  */

24 package org.objectweb.jalisto.se.impl.server.oid;
25
26 import org.objectweb.jalisto.se.impl.LogicalOid;
27 import org.objectweb.jalisto.se.exception.IdentityException;
28 import org.objectweb.jalisto.se.impl.server.PhysicalOid;
29 import org.objectweb.jalisto.se.api.internal.OidActionCaller;
30
31 import java.io.Serializable JavaDoc;
32
33 public class OidInfo implements Serializable JavaDoc {
34
35     public OidInfo(LogicalOid floid, PhysicalOid fpoid) {
36         this.floid = floid;
37         this.fpoid = fpoid;
38         this.update = 0;
39         this.created = false;
40     }
41
42     public OidInfo(LogicalOid floid, PhysicalOid fpoid, short update) {
43         this.floid = floid;
44         this.fpoid = fpoid;
45         this.update = update;
46     }
47
48     public boolean isDeleting() {
49         return (fpoid == null);
50     }
51
52     public LogicalOid getFloid() {
53         return floid;
54     }
55
56     public void setFpoid(PhysicalOid fpoid) {
57         this.fpoid = fpoid;
58     }
59
60     public PhysicalOid getFpoid() {
61         return fpoid;
62     }
63
64     public void setUpdate(short update) {
65         this.update = update;
66     }
67
68     public short getUpdate() {
69         return update;
70     }
71
72     public boolean isCreated() {
73         return created;
74     }
75
76     public void markAsCreated() {
77         if (created) {
78             throw new IdentityException("the given oid " + floid + " already has created datas");
79         }
80         created = true;
81     }
82
83     public OidActionCaller getActionCaller() {
84         return actionCaller;
85     }
86
87     public void setActionCaller(OidActionCaller actionCaller) {
88         this.actionCaller = actionCaller;
89     }
90
91     public OidInfo getClone() {
92         OidInfo clone = new OidInfo(floid.getClone(), fpoid.getClone());
93         clone.setUpdate(update);
94         return clone;
95     }
96
97     public String JavaDoc toString() {
98         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
99         sb.append("oidi").append(actionCaller).append("(").append(floid).append(',').append(fpoid).append(',').append(
100                 update).append(")");
101         return sb.toString();
102     }
103
104
105     private LogicalOid floid;
106     private PhysicalOid fpoid;
107     private short update;
108     private boolean created;
109     private transient OidActionCaller actionCaller = OidActionCaller.READ_CALLER;
110
111     static final long serialVersionUID = -7589377044064761459L;
112 }
113
Popular Tags