KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > objectserver > persistence > impl > InMemoryPersistor


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.persistence.impl;
6
7 import com.tc.exception.ImplementMe;
8 import com.tc.io.serializer.api.StringIndex;
9 import com.tc.objectserver.persistence.api.ClassPersistor;
10 import com.tc.objectserver.persistence.api.ClientStatePersistor;
11 import com.tc.objectserver.persistence.api.ManagedObjectPersistor;
12 import com.tc.objectserver.persistence.api.PersistenceTransactionProvider;
13 import com.tc.objectserver.persistence.api.PersistentCollectionFactory;
14 import com.tc.objectserver.persistence.api.PersistentMapStore;
15 import com.tc.objectserver.persistence.api.PersistentSequence;
16 import com.tc.objectserver.persistence.api.Persistor;
17 import com.tc.objectserver.persistence.api.TransactionPersistor;
18
19 public class InMemoryPersistor implements Persistor {
20
21   private final PersistenceTransactionProvider persistenceTransactionProvider;
22   private final ClientStatePersistor clientStatePersistor;
23   private final StringIndex stringIndex;
24   private final ClassPersistor clazzPersistor;
25   private final PersistentCollectionFactory persistentCollectionFactory;
26   private final PersistentMapStore clusterStateStore;
27
28   public InMemoryPersistor() {
29     this.persistenceTransactionProvider = new NullPersistenceTransactionProvider();
30     this.clientStatePersistor = new InMemoryClientStatePersistor();
31     this.stringIndex = new StringIndexImpl(new NullStringIndexPersistor());
32     this.clazzPersistor = new InMemoryClassPersistor();
33     this.persistentCollectionFactory = new InMemoryCollectionFactory();
34     this.clusterStateStore = new InMemoryPersistentMapStore();
35
36   }
37
38   public void close() {
39     return;
40   }
41
42   public PersistenceTransactionProvider getPersistenceTransactionProvider() {
43     return this.persistenceTransactionProvider;
44   }
45
46   public ClientStatePersistor getClientStatePersistor() {
47     return this.clientStatePersistor;
48   }
49
50   public ManagedObjectPersistor getManagedObjectPersistor() {
51     throw new ImplementMe();
52   }
53
54   public TransactionPersistor getTransactionPersistor() {
55     throw new ImplementMe();
56   }
57
58   public PersistentSequence getGlobalTransactionIDSequence() {
59     throw new ImplementMe();
60   }
61
62   public StringIndex getStringIndex() {
63     return stringIndex;
64   }
65
66   public ClassPersistor getClassPersistor() {
67     return this.clazzPersistor;
68   }
69
70   public PersistentCollectionFactory getPersistentCollectionFactory() {
71     return persistentCollectionFactory;
72   }
73
74   public PersistentMapStore getClusterStateStore() {
75     return clusterStateStore;
76   }
77
78 }
79
Popular Tags