01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tc.objectserver.persistence.impl;
05:
06: import com.tc.exception.TCRuntimeException;
07: import com.tc.memorydatastore.client.MemoryDataStoreClient;
08: import com.tc.object.ObjectID;
09: import com.tc.objectserver.persistence.api.PersistentCollectionFactory;
10:
11: import java.util.Map;
12:
13: public class MemoryStoreCollectionFactory implements
14: PersistentCollectionFactory {
15: private MemoryDataStoreClient db;
16: private MemoryStoreCollectionsPersistor persistor;
17:
18: public Map createPersistentMap(ObjectID id) {
19: if (db == null || persistor == null) {
20: throw new TCRuntimeException("Must set db and persistor");
21: }
22: return new MemoryStorePersistableMap(id, persistor, db);
23: }
24:
25: public void setPersistor(MemoryStoreCollectionsPersistor persistor) {
26: this .persistor = persistor;
27: }
28:
29: public void setMemoryDataStore(MemoryDataStoreClient db) {
30: this.db = db;
31: }
32:
33: }
|