use of org.neo4j.kernel.IdGeneratorFactory in project neo4j-mobile-android by neo4j-contrib.
the class RelationshipTypeStore method createStore.
/**
* Creates a new relationship type store contained in <CODE>fileName</CODE>
* If filename is <CODE>null</CODE> or the file already exists an
* <CODE>IOException</CODE> is thrown.
*
* @param fileName
* File name of the new relationship type store
* @throws IOException
* If unable to create store or name null
*/
public static void createStore(String fileName, Map<?, ?> config) {
IdGeneratorFactory idGeneratorFactory = (IdGeneratorFactory) config.get(IdGeneratorFactory.class);
createEmptyStore(fileName, buildTypeDescriptorAndVersion(TYPE_DESCRIPTOR), idGeneratorFactory);
DynamicStringStore.createStore(fileName + ".names", TYPE_STORE_BLOCK_SIZE, idGeneratorFactory, IdType.RELATIONSHIP_TYPE_BLOCK);
RelationshipTypeStore store = new RelationshipTypeStore(fileName, config, IdType.RELATIONSHIP_TYPE);
store.close();
}
use of org.neo4j.kernel.IdGeneratorFactory in project neo4j-mobile-android by neo4j-contrib.
the class NodeStore method createStore.
/**
* Creates a new node store contained in <CODE>fileName</CODE> If filename
* is <CODE>null</CODE> or the file already exists an
* <CODE>IOException</CODE> is thrown.
*
* @param fileName
* File name of the new node store
* @param config
* Map of configuration parameters
*/
public static void createStore(String fileName, Map<?, ?> config) {
IdGeneratorFactory idGeneratorFactory = (IdGeneratorFactory) config.get(IdGeneratorFactory.class);
createEmptyStore(fileName, buildTypeDescriptorAndVersion(TYPE_DESCRIPTOR), idGeneratorFactory);
NodeStore store = new NodeStore(fileName, config);
NodeRecord nodeRecord = new NodeRecord(store.nextId());
nodeRecord.setInUse(true);
store.updateRecord(nodeRecord);
store.close();
}
use of org.neo4j.kernel.IdGeneratorFactory in project graphdb by neo4j-attic.
the class RelationshipTypeStore method createStore.
/**
* Creates a new relationship type store contained in <CODE>fileName</CODE>
* If filename is <CODE>null</CODE> or the file already exists an
* <CODE>IOException</CODE> is thrown.
*
* @param fileName
* File name of the new relationship type store
* @throws IOException
* If unable to create store or name null
*/
public static void createStore(String fileName, Map<?, ?> config) {
IdGeneratorFactory idGeneratorFactory = (IdGeneratorFactory) config.get(IdGeneratorFactory.class);
createEmptyStore(fileName, VERSION, idGeneratorFactory);
DynamicStringStore.createStore(fileName + ".names", TYPE_STORE_BLOCK_SIZE, idGeneratorFactory, IdType.RELATIONSHIP_TYPE_BLOCK);
RelationshipTypeStore store = new RelationshipTypeStore(fileName, config, IdType.RELATIONSHIP_TYPE);
store.close();
}
use of org.neo4j.kernel.IdGeneratorFactory in project graphdb by neo4j-attic.
the class PropertyStore method createStore.
/**
* Creates a new property store contained in <CODE>fileName</CODE> If
* filename is <CODE>null</CODE> or the file already exists an
* <CODE>IOException</CODE> is thrown.
*
* @param fileName
* File name of the new property store
* @throws IOException
* If unable to create property store or name null
*/
public static void createStore(String fileName, Map<?, ?> config) {
IdGeneratorFactory idGeneratorFactory = (IdGeneratorFactory) config.get(IdGeneratorFactory.class);
createEmptyStore(fileName, VERSION, idGeneratorFactory);
int stringStoreBlockSize = DEFAULT_DATA_BLOCK_SIZE;
int arrayStoreBlockSize = DEFAULT_DATA_BLOCK_SIZE;
try {
String stringBlockSize = (String) config.get(STRING_BLOCK_SIZE);
String arrayBlockSize = (String) config.get(ARRAY_BLOCK_SIZE);
if (stringBlockSize != null) {
int value = Integer.parseInt(stringBlockSize);
if (value > 0) {
stringStoreBlockSize = value;
}
}
if (arrayBlockSize != null) {
int value = Integer.parseInt(arrayBlockSize);
if (value > 0) {
arrayStoreBlockSize = value;
}
}
} catch (Exception e) {
e.printStackTrace();
}
DynamicStringStore.createStore(fileName + ".strings", stringStoreBlockSize, idGeneratorFactory, IdType.STRING_BLOCK);
PropertyIndexStore.createStore(fileName + ".index", idGeneratorFactory);
DynamicArrayStore.createStore(fileName + ".arrays", arrayStoreBlockSize, idGeneratorFactory);
}
use of org.neo4j.kernel.IdGeneratorFactory in project graphdb by neo4j-attic.
the class NeoStore method createStore.
/**
* Creates the neo,node,relationship,property and relationship type stores.
*
* @param fileName
* The name of store
* @throws IOException
* If unable to create stores or name null
*/
public static void createStore(String fileName, Map<?, ?> config) {
IdGeneratorFactory idGeneratorFactory = (IdGeneratorFactory) config.get(IdGeneratorFactory.class);
StoreId storeId = (StoreId) config.get(StoreId.class);
if (storeId == null)
storeId = new StoreId();
createEmptyStore(fileName, VERSION, idGeneratorFactory);
NodeStore.createStore(fileName + ".nodestore.db", config);
RelationshipStore.createStore(fileName + ".relationshipstore.db", idGeneratorFactory);
PropertyStore.createStore(fileName + ".propertystore.db", config);
RelationshipTypeStore.createStore(fileName + ".relationshiptypestore.db", config);
if (!config.containsKey("neo_store")) {
// TODO Ugly
Map<Object, Object> newConfig = new HashMap<Object, Object>(config);
newConfig.put("neo_store", fileName);
config = newConfig;
}
NeoStore neoStore = new NeoStore(config);
// created time | random long | backup version | tx id
neoStore.nextId();
neoStore.nextId();
neoStore.nextId();
neoStore.nextId();
neoStore.setCreationTime(storeId.getCreationTime());
neoStore.setRandomNumber(storeId.getRandomId());
neoStore.setVersion(0);
neoStore.setLastCommittedTx(1);
neoStore.close();
}
Aggregations