KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > api > ObjectManager


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
3  * notice. All rights reserved.
4  */

5 package com.tc.objectserver.api;
6
7 import com.tc.net.protocol.tcm.ChannelID;
8 import com.tc.object.ObjectID;
9 import com.tc.objectserver.context.ObjectManagerResultsContext;
10 import com.tc.objectserver.core.api.GarbageCollector;
11 import com.tc.objectserver.core.api.ManagedObject;
12 import com.tc.objectserver.persistence.api.PersistenceTransaction;
13 import com.tc.text.PrettyPrintable;
14 import com.tc.util.SyncObjectIdSet;
15
16 import java.util.Collection JavaDoc;
17 import java.util.Iterator JavaDoc;
18 import java.util.List JavaDoc;
19 import java.util.Map JavaDoc;
20 import java.util.Set JavaDoc;
21
22 /**
23  * manages all access to objects on the server. This will be single threaded and only accessed via it's event handler.
24  *
25  * @author steve
26  */

27 public interface ObjectManager extends ManagedObjectProvider, PrettyPrintable {
28
29   public void stop();
30
31   /**
32    * release object so that if anyone needs it they can have it
33    *
34    * @param object
35    */

36   public void release(PersistenceTransaction tx, ManagedObject object);
37
38   /**
39    * release all objects
40    */

41   public void releaseAll(Collection JavaDoc objects);
42
43   /**
44    * release for objects that can not have changed while checked out
45    */

46   public void releaseReadOnly(ManagedObject object);
47
48   /**
49    * Release all objects in the given collection.
50    *
51    * @param collection
52    */

53   public void releaseAll(PersistenceTransaction tx, Collection JavaDoc collection);
54
55   /**
56    * Looks up the objects associated with the Object Lookups from the clients. What it does is if all the objects are
57    * available it calls setResult() o ObjectManagerResultsContext. If not then it calls makesPending on
58    * ObjectManagerResultsContext and hangs on to the request until it can be fullfilled.
59    *
60    * @param channelID - channelID of the client that is interested in lookup
61    * @param maxCount - max number of objects reachable from the requested objects that should be looked up
62    * @param context - ResultContext that gets notifications.
63    * @return true if all the objects are successfully looked up.
64    */

65   public boolean lookupObjectsAndSubObjectsFor(ChannelID channelID, ObjectManagerResultsContext responseContext,
66                                                int maxCount);
67
68   /**
69    * Looks up the objects associated with the transaction. What it does is if all the objects are available to be
70    * updated it calls setResult() on ObjectManagerResultsContext. If not then it calls makesPending on
71    * ObjectManagerResultsContext and hangs on to the request until it can be fullfilled.
72    *
73    * @param channelID - channelID of the client that is interested in lookup
74    * @param context - ResultContext that gets notifications.
75    * @return true if all the objects are successfully looked up.
76    */

77   public boolean lookupObjectsForCreateIfNecessary(ChannelID channelID, ObjectManagerResultsContext context);
78
79   /**
80    * The list of rootnames
81    *
82    * @return
83    */

84   public Iterator JavaDoc getRoots();
85   
86   public Map JavaDoc getRootNamesToIDsMap();
87
88   public void createRoot(String JavaDoc name, ObjectID id);
89
90   public ObjectID lookupRootID(String JavaDoc name);
91
92   public void setGarbageCollector(GarbageCollector gc);
93
94   /**
95    * Called by GC thread (in object manager)
96    */

97   public void waitUntilReadyToGC();
98
99   /**
100    * Called by GC thread (in object manager)
101    *
102    * @param toDelete
103    */

104   public void notifyGCComplete(Set toDelete);
105
106   public void setStatsListener(ObjectManagerStatsListener listener);
107
108   public void start();
109
110   public void dump();
111
112   public int getCheckedOutCount();
113
114   public Set getRootIDs();
115
116   public SyncObjectIdSet getAllObjectIDs();
117
118   public void addFaultedObject(ObjectID oid, ManagedObject mo, boolean removeOnRelease);
119
120   // XXX::TODO:: This will change
121
public void flushAndEvict(List JavaDoc objects2Flush);
122
123 }
124
Popular Tags