Search in sources :

Example 26 with ModifiableConfiguration

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();
}
Also used : ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)

Example 27 with ModifiableConfiguration

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();
}
Also used : ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration) Map(java.util.Map)

Example 28 with ModifiableConfiguration

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();
}
Also used : InMemoryStoreManager(com.thinkaurelius.titan.diskstorage.keycolumnvalue.inmemory.InMemoryStoreManager) ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration) Before(org.junit.Before)

Example 29 with ModifiableConfiguration

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);
}
Also used : ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)

Example 30 with ModifiableConfiguration

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()));
    }
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration) StandardTitanTx(com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ModifiableConfiguration (com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)50 Test (org.junit.Test)13 Configuration (com.thinkaurelius.titan.diskstorage.configuration.Configuration)9 ElasticSearchIndex (com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex)9 GraphDatabaseConfiguration (com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)9 CommonsConfiguration (com.thinkaurelius.titan.diskstorage.configuration.backend.CommonsConfiguration)8 BaseConfiguration (org.apache.commons.configuration.BaseConfiguration)8 BasicConfiguration (com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration)7 File (java.io.File)3 KeyColumnValueStoreTest (com.thinkaurelius.titan.diskstorage.KeyColumnValueStoreTest)2 WriteConfiguration (com.thinkaurelius.titan.diskstorage.configuration.WriteConfiguration)2 IndexProviderTest (com.thinkaurelius.titan.diskstorage.indexing.IndexProviderTest)2 StandardBaseTransactionConfig (com.thinkaurelius.titan.diskstorage.util.StandardBaseTransactionConfig)2 IndexRemoveJob (com.thinkaurelius.titan.graphdb.olap.job.IndexRemoveJob)2 IndexRepairJob (com.thinkaurelius.titan.graphdb.olap.job.IndexRepairJob)2 CassandraHadoopScanRunner (com.thinkaurelius.titan.hadoop.scan.CassandraHadoopScanRunner)2 HBaseHadoopScanRunner (com.thinkaurelius.titan.hadoop.scan.HBaseHadoopScanRunner)2 Map (java.util.Map)2 TitanFactory (com.thinkaurelius.titan.core.TitanFactory)1 TitanGraph (com.thinkaurelius.titan.core.TitanGraph)1