Package com.netflix.astyanax.connectionpool.exceptions

Examples of com.netflix.astyanax.connectionpool.exceptions.BadRequestException


   
    keyspace = context.getClient();

    //for some reason, the keyspace is not always created fast enough so sleep 3 seconds and try again
    KeyspaceDefinition keySpaceMeta = null;
    BadRequestException holdExc = null;
    for(int i = 0; i < 3; i++) {
      try {
        keySpaceMeta = keyspace.describeKeyspace();
      } catch(BadRequestException e) {
        if(e.getMessage().contains(keyspaceName)) {
View Full Code Here


            if (columns.hasNext()) {
                cp.setColumn(columns.next());
            }
            if (columns.hasNext()) {
                throw new BadRequestException("Path depth of " + path.length() + " not supported for column family \'"
                        + columnFamily.getName() + "\'");
            }
        }
        return cp;
    }
View Full Code Here

    }
   
    @Override
    public OperationResult<SchemaChangeResult> createKeyspace(final Properties props) throws ConnectionException {
        if (props.containsKey("name") && !props.get("name").equals(getKeyspaceName())) {
            throw new BadRequestException(
                    String.format("'name' attribute must match keyspace name. Expected '%s' but got '%s'",
                                  getKeyspaceName(), props.get("name")));
        }
       
        final KsDef ksDef;
        try {
            ksDef = ThriftUtils.getThriftObjectFromProperties(KsDef.class, props);
        } catch (Exception e) {
            throw new BadRequestException("Unable to convert props to keyspace definition");
        }
       
        return internalCreateKeyspace(ksDef);
    }
View Full Code Here

       
        final KsDef ksDef;
        try {
            ksDef = ThriftUtils.getThriftObjectFromProperties(KsDef.class, props);
        } catch (Exception e) {
            throw new BadRequestException("Unable to convert properties to KsDef", e);
        }
        ksDef.setName(getKeyspaceName());
       
        return internalUpdateKeyspace(ksDef);
    }
View Full Code Here

       
        CfDef cfDef;
        try {
            cfDef = ThriftUtils.getThriftObjectFromProperties(CfDef.class, props);
        } catch (Exception e) {
            throw new BadRequestException("Unable to convert properties to CfDef", e);
        }
        cfDef.setKeyspace(getKeyspaceName());
        return internalCreateColumnFamily(cfDef);
    }
View Full Code Here

    public OperationResult<SchemaChangeResult> createColumnFamily(final Properties props) throws ConnectionException {
        final CfDef def;
        try {
            def = ThriftUtils.getThriftObjectFromProperties(CfDef.class, props);
        } catch (Exception e) {
            throw new BadRequestException("Error converting properties to CfDef", e);
        }
       
        return internalCreateColumnFamily(def);
    }
View Full Code Here

    public OperationResult<SchemaChangeResult> updateColumnFamily(final Properties props) throws ConnectionException {
        final CfDef def;
        try {
            def = ThriftUtils.getThriftObjectFromProperties(CfDef.class, props);
        } catch (Exception e) {
            throw new BadRequestException("Error converting properties to CfDef", e);
        }
       
        return internalColumnFamily(def);
    }
View Full Code Here

            def = ThriftUtils.getThriftObjectFromProperties(KsDef.class, props);
            if (def.getCf_defs() == null) {
                def.setCf_defs(Lists.<CfDef>newArrayList());
            }
        } catch (Exception e) {
            throw new BadRequestException("Error converting properties to KsDef", e);
        }
       
        return internalCreateKeyspace(def);
    }
View Full Code Here

    public OperationResult<SchemaChangeResult> updateKeyspace(final Map<String, Object> options) throws ConnectionException  {
        final ThriftKeyspaceDefinitionImpl def = new ThriftKeyspaceDefinitionImpl();
        try {
            def.setFields(options);
        } catch (Exception e) {
            throw new BadRequestException("Error converting properties to KsDef", e);
        }
       
        return internalUpdateKeyspace(def.getThriftKeyspaceDefinition());
    }
View Full Code Here

            def = ThriftUtils.getThriftObjectFromProperties(KsDef.class, props);
            if (def.getCf_defs() == null) {
                def.setCf_defs(Lists.<CfDef>newArrayList());
            }
        } catch (Exception e) {
            throw new BadRequestException("Error converting properties to KsDef", e);
        }
        return internalUpdateKeyspace(def);
    }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.connectionpool.exceptions.BadRequestException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.