Changeset 49
- Timestamp:
- 02/21/10 20:06:48 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
kahina/trunk/src/org/kahina/core/data/DbDataManager.java
r17 r49 10 10 11 11 /** 12 * A {@link DataManager} implementation using a database for storage, and 13 * {@link LightweightKahinaObjectDbDataStore}s as default data stores. 12 * A {@link DataManager} implementation using a database for storage, 13 * {@link LightweightKahinaObjectDbDataStore}s as default data stores for 14 * {@link LightweightKahinaObject}s, and {@link KahinaObjectMemDataStore}s as 15 * default data stores for other {@link KahinaObject}s. 14 16 * 15 17 * @author ke … … 36 38 37 39 @Override 38 public void registerDataType(Class<? extends KahinaObject> type, DataStore store) 40 public void registerDataType(Class<? extends KahinaObject> type, 41 DataStore store) 39 42 { 40 43 if (typeIDByType.containsKey(type)) 41 44 { 42 throw new KahinaException("A data store for type " + type + " is already registered."); 45 throw new KahinaException("A data store for type " + type 46 + " is already registered."); 43 47 } 44 48 typeIDByType.put(type, storeByTypeID.size()); … … 49 53 * Registers a new data type with a 50 54 * {@link LightweightKahinaObjectDbDataStore}. 55 * 51 56 * @param type 52 57 * Must be a subclass of {@link LightweightKahinaObject}. … … 55 60 public void registerDataType(Class<? extends KahinaObject> type) 56 61 { 57 if ( !LightweightKahinaObject.class.isAssignableFrom(type))62 if (LightweightKahinaObject.class.isAssignableFrom(type)) 58 63 { 59 throw new KahinaException("Cannot auto-create a suitable data store for " + type + "."); 64 registerDataType(type, new LightweightKahinaObjectDbDataStore(type, 65 this, db)); 66 } else 67 { 68 registerDataType(type, new KahinaObjectMemDataStore()); 60 69 } 61 registerDataType(type, new LightweightKahinaObjectDbDataStore(type, this, db));62 70 } 63 71 64 72 /** 65 73 * Returns the internal numeric ID given to a data type by this manager. 74 * 66 75 * @param type 67 76 * @return … … 74 83 /** 75 84 * Retrieves an object by the internal numeric ID given to its type by this 76 * manager, and its object ID. 85 * manager, and its object ID. 86 * 77 87 * @param typeID 78 88 * @param objectID
