KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > core > ObjectContainer


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Core License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: ObjectContainer.java,v 1.7 2003/04/06 13:57:33 mediumnet Exp $
8

9 package org.ozoneDB.core;
10
11 import org.ozoneDB.*;
12 import org.ozoneDB.core.dr.Lockable;
13
14
15 /**
16  * Together with the {@link StoreManager} interface this is part of the
17  * StoreManager back-end API.<p>
18  *
19  * An ObjectContainer wraps a target (database) object and decorates it with
20  * functionality needed by the database system, such as the corresponding object
21  * ID. Also, the ObjectContainer is the delegate for the methods defined by
22  * {@link OzoneCompatible}.
23  *
24  *
25  * @author <a HREF="http://www.softwarebuero.de/">SMB</a>
26  * @author <A HREF="http://www.medium.net/">Medium.net</A>
27  * @version $Revision: 1.7 $Date: 2003/04/06 13:57:33 $
28  */

29 public interface ObjectContainer extends Lockable {
30
31     public final static String JavaDoc PROXYNAME_POSTFIX = "_Proxy";
32     public final static String JavaDoc IMPLNAME_POSTFIX = "_Impl";
33
34     // possible return values of the state() method
35
public final static int STATE_CLEAN = 0;
36     public final static int STATE_READ = 1;
37     public final static int STATE_MODIFIED = 2;
38     public final static int STATE_CREATED = 4;
39     public final static int STATE_DELETED = 8;
40
41     /**
42      * Return the current state of the container. Possible return values are the
43      * STATE constants defined in this class. A container can only be in one of
44      * these states at one time. The state of a container can only be raised
45      * during one transaction. So, if a container is created (STATE_CREATED)
46      * during a transaction, the state can become STATE_DELETED only.
47      *
48      *
49      * @return The state of the container.
50      */

51     public int state();
52
53
54     /**
55      * Returns the time when the container was last commited with lock level
56      * greater than Lock.LEVEL_READ. The value returned by this method should
57      * only be compared against return values of this method.
58      */

59     public long modTime();
60
61
62     public Lock lock();
63
64
65     public void touch();
66
67
68     public void setName( String JavaDoc _name );
69
70
71     public String JavaDoc name();
72
73
74     public void setTarget( OzoneCompatible _target );
75
76
77     public OzoneCompatible target();
78
79
80     public Class JavaDoc targetClass();
81
82
83     public void createTarget( Env env, Class JavaDoc cl, String JavaDoc sig, Object JavaDoc[] args ) throws Exception JavaDoc;
84
85
86     public Object JavaDoc invokeTarget( Env env, String JavaDoc methodName, String JavaDoc sig, Object JavaDoc[] args ) throws Exception JavaDoc;
87
88
89     public Object JavaDoc invokeTarget( Env env, int methodIndex, Object JavaDoc[] args ) throws Exception JavaDoc;
90
91
92     public void deleteTarget();
93
94
95     public void nameTarget( String JavaDoc _name );
96
97
98     public OzoneCompatible targetClone() throws Exception JavaDoc;
99
100
101     /**
102      * @return True if obj and receiver point to the same target object.
103      */

104     public boolean equals( Object JavaDoc obj );
105
106
107     /**
108      * Return a proxy for the receiver.
109      * @return Proxy for this object.
110      */

111     public OzoneProxy ozoneProxy();
112
113
114     public ObjectID id();
115
116
117     public OzoneInterface database();
118
119
120     public Permissions permissions();
121
122
123     /**
124         Pins this ObjectContainer.
125         Every caller of this method must pair this call with a call to {@link #unpin}.
126         An ObjectContainer remains in main memory at least as long as it is pinned.
127     */

128     public void pin();
129
130     /**
131         Unpins this ObjectContainer.
132         This method must be called exactly once for every call to {@link #pin}.
133     */

134     public void unpin();
135
136     /**
137         Returns wether this ObjectContainer is pinned.
138     */

139     public boolean isPinned();
140
141     /**
142         Ensures that the garbageCollectionLevel is at least the given currentGarbageCollectionLevel.
143         The return value is meaningful if the supplied newGarbageCollectionLevel is the currentGarbageCollectionLevel
144
145         @return
146             <=0 if this object still has to be processed.
147                 This is the case if it belongs to the surelyReachable set but not to the processedReachable set
148             > otherwise
149
150             <0 if this object has been updated
151             =0 if this object has not been updated, it is surelyReachable
152             >0 if this object has not been updated, it is processedReachable
153     */

154     public int ensureGarbageCollectionLevel(int newGarbageCollectionLevel);
155
156     /**
157         Returns the garbageCollectionLevel this ObjectContainer has reached due to (not) calling {@link #ensureGarbageCollectionLevel}.
158     */

159     public int getGarbageCollectionLevel();
160
161     public boolean shouldOnActivateBeCalled();
162
163     public void invokeOnActivate();
164
165     public void invokeOnPassivate();
166
167     boolean shouldOnPassivateBeCalled();
168     
169     public void requireWriteLocking();
170
171     void setShouldCallOnPassivate(boolean shouldOnPassivateBeCalled);
172
173     void setShouldCallOnActivate(boolean shouldOnActivateBeCalled);
174
175 }
176
177 // :indentSize=4:tabSize=4:noTabs=true:
178
Popular Tags