Example usage for com.google.common.collect ImmutableMap.Builder toString

List of usage examples for com.google.common.collect ImmutableMap.Builder toString

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableMap.Builder toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:org.apache.usergrid.persistence.core.migration.schema.MigrationManagerImpl.java

/**
 * Check if they keyspace exists.  If it doesn't create it
 *//*w ww. j  a  v  a2 s .  c  o  m*/
private void testAndCreateKeyspace() throws ConnectionException {

    KeyspaceDefinition keyspaceDefinition = null;

    try {
        keyspaceDefinition = keyspace.describeKeyspace();

    } catch (NotFoundException nfe) {
        //if we execute this immediately after a drop keyspace in 1.2.x, Cassandra is returning the NFE instead of a BadRequestException
        //swallow and log, then continue to create the keyspaces.
        logger.info("Received a NotFoundException when attempting to describe keyspace.  It does not exist");
    } catch (Exception e) {
        AstayanxUtils.isKeyspaceMissing("Unable to connect to cassandra", e);
    }

    if (keyspaceDefinition != null) {
        return;
    }

    ImmutableMap.Builder<String, Object> strategyOptions = getKeySpaceProps();

    ImmutableMap<String, Object> options = ImmutableMap.<String, Object>builder()
            .put("strategy_class", fig.getStrategyClass()).put("strategy_options", strategyOptions.build())
            .build();

    keyspace.createKeyspace(options);

    strategyOptions.toString();

    logger.info("Created keyspace {} with options {}", keyspace.getKeyspaceName(), options.toString());

    waitForMigration();
}

From source file:org.apache.usergrid.locking.cassandra.AstyanaxLockManagerImpl.java

private void createLocksKeyspace() throws ConnectionException {

    ImmutableMap.Builder<String, Object> strategyOptions = getKeySpaceProps();

    ImmutableMap<String, Object> options = ImmutableMap.<String, Object>builder()
            .put("strategy_class", cassandraFig.getLocksKeyspaceStrategy())
            .put("strategy_options", strategyOptions.build()).build();

    keyspace.createKeyspaceIfNotExists(options);

    strategyOptions.toString();

    logger.info("Keyspace {} created or already exists with options {}", keyspace.getKeyspaceName(),
            options.toString());/*from   w  w w . ja  v a  2s. co m*/
}