use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class CassandraInputFormatIT method getConfiguration.
@Override
public WriteConfiguration getConfiguration() {
String className = getClass().getSimpleName();
ModifiableConfiguration mc = CassandraStorageSetup.getEmbeddedConfiguration(className);
return mc.getConfiguration();
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class InMemoryTitanIoTest method clopen.
@Override
public void clopen(Object... settings) {
if (settings != null && settings.length > 0) {
if (graph != null && graph.isOpen()) {
Preconditions.checkArgument(!graph.vertices().hasNext() && !graph.edges().hasNext(), "Graph cannot be re-initialized for InMemory since that would delete all data");
graph.close();
}
Map<TitanGraphBaseTest.TestConfigOption, Object> options = validateConfigOptions(settings);
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, "inmemory");
for (Map.Entry<TitanGraphBaseTest.TestConfigOption, Object> option : options.entrySet()) {
config.set(option.getKey().option, option.getValue(), option.getKey().umbrella);
}
open(config.getConfiguration());
}
newTx();
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class QueryTest method setup.
@Before
public void setup() {
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, InMemoryStoreManager.class.getCanonicalName());
graph = TitanFactory.open(config);
tx = graph.newTransaction();
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class SerializerGraphConfiguration method initialize.
@Before
public void initialize() {
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, "inmemory");
config.set(GraphDatabaseConfiguration.CUSTOM_ATTRIBUTE_CLASS, TClass1.class.getName(), "attribute1");
config.set(GraphDatabaseConfiguration.CUSTOM_SERIALIZER_CLASS, TClass1Serializer.class.getName(), "attribute1");
config.set(GraphDatabaseConfiguration.CUSTOM_ATTRIBUTE_CLASS, TEnum.class.getName(), "attribute4");
config.set(GraphDatabaseConfiguration.CUSTOM_SERIALIZER_CLASS, TEnumSerializer.class.getName(), "attribute4");
graph = (StandardTitanGraph) TitanFactory.open(config);
}
use of com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration in project titan by thinkaurelius.
the class StandardTitanGraph method closeInternal.
private synchronized void closeInternal() {
if (!isOpen)
return;
Map<TitanTransaction, RuntimeException> txCloseExceptions = new HashMap<>();
try {
//Unregister instance
String uniqueid = null;
try {
uniqueid = config.getUniqueGraphId();
ModifiableConfiguration globalConfig = GraphDatabaseConfiguration.getGlobalSystemConfig(backend);
globalConfig.remove(REGISTRATION_TIME, uniqueid);
} catch (Exception e) {
log.warn("Unable to remove graph instance uniqueid {}", uniqueid, e);
}
/* Assuming a couple of properties about openTransactions:
* 1. no concurrent modifications during graph shutdown
* 2. all contained txs are open
*/
for (StandardTitanTx otx : openTransactions) {
try {
otx.close();
} catch (RuntimeException e) {
// Catch and store these exceptions, but proceed wit the loop
// Any remaining txs on the iterator should get a chance to close before we throw up
log.warn("Unable to close transaction {}", otx, e);
txCloseExceptions.put(otx, e);
}
}
super.close();
IOUtils.closeQuietly(idAssigner);
IOUtils.closeQuietly(backend);
IOUtils.closeQuietly(queryCache);
IOUtils.closeQuietly(serializer);
} finally {
isOpen = false;
}
// Throw an exception if at least one transaction failed to close
if (1 == txCloseExceptions.size()) {
// TP3's test suite requires that this be of type ISE
throw new IllegalStateException("Unable to close transaction", Iterables.getOnlyElement(txCloseExceptions.values()));
} else if (1 < txCloseExceptions.size()) {
throw new IllegalStateException(String.format("Unable to close %s transactions (see warnings in log output for details)", txCloseExceptions.size()));
}
}
Aggregations