/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param storageFile * The storage file to use. */ public RandomAccessObjectStore(ObjectSerializationFactory serializationFactory, File storageFile) { this.serializationFactory = serializationFactory; this.storageFile = storageFile; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; }
/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param tempFilePrefix * The prefix of the temporary file. */ public RandomAccessObjectStore(ObjectSerializationFactory serializationFactory, String tempFilePrefix) { this.serializationFactory = serializationFactory; this.tempFilePrefix = tempFilePrefix; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; }
/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param tempFilePrefix * The prefix of the temporary file. */ public RandomAccessObjectStore(ObjectSerializationFactory serializationFactory, String tempFilePrefix) { this.serializationFactory = serializationFactory; this.tempFilePrefix = tempFilePrefix; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; }
/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param storageFile * The storage file to use. */ public RandomAccessObjectStore(ObjectSerializationFactory serializationFactory, File storageFile) { this.serializationFactory = serializationFactory; this.storageFile = storageFile; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; }
/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param storageFilePrefix * The prefix of the storage file. * @param useCompression * If true, the storage file will be compressed. */ public SimpleObjectStore( ObjectSerializationFactory serializationFactory, String storageFilePrefix, boolean useCompression) { this.serializationFactory = serializationFactory; this.storageFilePrefix = storageFilePrefix; this.useCompression = useCompression; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; }
/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param storageFilePrefix * The prefix of the storage file. * @param useCompression * If true, the storage file will be compressed. */ public SimpleObjectStore( ObjectSerializationFactory serializationFactory, String storageFilePrefix, boolean useCompression) { this.serializationFactory = serializationFactory; this.storageFilePrefix = storageFilePrefix; this.useCompression = useCompression; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; }
/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param storageFilePrefix * The prefix of the storage file. * @param useCompression * If true, the storage file will be compressed. */ public SegmentedObjectStore( ObjectSerializationFactory serializationFactory, String storageFilePrefix, boolean useCompression) { this.serializationFactory = serializationFactory; this.storageFilePrefix = storageFilePrefix; this.useCompression = useCompression; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; fileSize = 0; chunkActive = false; }
/** * Creates a new instance. * * @param serializationFactory * The factory defining the object serialisation implementation. * @param storageFilePrefix * The prefix of the storage file. * @param useCompression * If true, the storage file will be compressed. */ public SegmentedObjectStore( ObjectSerializationFactory serializationFactory, String storageFilePrefix, boolean useCompression) { this.serializationFactory = serializationFactory; this.storageFilePrefix = storageFilePrefix; this.useCompression = useCompression; storeClassRegister = new DynamicStoreClassRegister(); stage = StorageStage.NotStarted; fileSize = 0; chunkActive = false; }
/** * Ensure the instance is correctly written to and read from the store. */ @Test public final void testGetInstanceFromStore() { ByteArrayOutputStream out = new ByteArrayOutputStream(); StoreWriter sw = new DataOutputStoreWriter(new DataOutputStream(out)); StoreClassRegister scr = new DynamicStoreClassRegister(); OsmUser user1 = new OsmUser(12, "aUser"); OsmUser user3 = new OsmUser(13, "aUser2"); OsmUser user5 = new OsmUser(14, ""); user1.store(sw, scr); user3.store(sw, scr); user5.store(sw, scr); StoreReader sr = new DataInputStoreReader(new DataInputStream(new ByteArrayInputStream(out.toByteArray()))); OsmUser user2 = new OsmUser(sr, scr); OsmUser user4 = new OsmUser(sr, scr); OsmUser user6 = new OsmUser(sr, scr); assertEquals("Object not equal after retrieval from store", user1, user2); assertEquals("Object not equal after retrieval from store", user3, user4); assertEquals("Object not equal after retrieval from store", user5, user6); } }