public boolean isBootstrapping() { if ( getCause() instanceof BadRequestException ) { BadRequestException bre = (BadRequestException)getCause(); String msg = bre.getMessage(); if ( (msg.contains("Keyspace") && msg.contains( "does not exist" )) || msg.contains("unconfigured columnfamily")) { return true; } } return false; }
@Override public void open(long timeout) throws ConnectionException { throw new BadRequestException("BadRequestException"); } },
if (e.isKeyspaceDoestNotExist()) { shouldCreateKeyspace = true; } else {
@Override public void open(long timeout) throws ConnectionException { throw new BadRequestException("BadRequestException"); } },
if (e.isKeyspaceDoestNotExist()) { shouldCreateKeyspace = true; } else {
@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); }
public boolean isUnconfiguredColumnFamilyError() { return getMessage().contains(WHY_UNCONFIGURED_COLUMNFAMILY); }
@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); }
public boolean isUnconfiguredColumnFamilyError() { return getMessage().contains(WHY_UNCONFIGURED_COLUMNFAMILY); }
@Override 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); }
public boolean isKeyspaceDoestNotExist() { String message = getMessage(); return message.contains(KEYSPACE) && message.contains(DOES_NOT_EXIST); } }
@Override 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); }
public boolean isKeyspaceDoestNotExist() { String message = getMessage(); return message.contains(KEYSPACE) && message.contains(DOES_NOT_EXIST); } }
@Override 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); }
@Override 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); }
@Override public OperationResult<SchemaChangeResult> updateKeyspace(final Properties props) throws ConnectionException { if (props.containsKey("name") && !props.get("name").equals(getKeyspaceName())) { throw new RuntimeException( 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 properties to KsDef", e); } ksDef.setName(getKeyspaceName()); return internalUpdateKeyspace(ksDef); }
@Override public OperationResult<SchemaChangeResult> updateKeyspace(final Properties props) throws ConnectionException { if (props.containsKey("name") && !props.get("name").equals(getKeyspaceName())) { throw new RuntimeException( 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 properties to KsDef", e); } ksDef.setName(getKeyspaceName()); return internalUpdateKeyspace(ksDef); }
@Override public OperationResult<SchemaChangeResult> createColumnFamily(final Properties props) throws ConnectionException { if (props.containsKey("keyspace") && !props.get("keyspace").equals(getKeyspaceName())) { throw new RuntimeException( String.format("'keyspace' attribute must match keyspace name. Expected '%s' but got '%s'", getKeyspaceName(), props.get("keyspace"))); } 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); }
@Override public OperationResult<SchemaChangeResult> createColumnFamily(final Properties props) throws ConnectionException { if (props.containsKey("keyspace") && !props.get("keyspace").equals(getKeyspaceName())) { throw new RuntimeException( String.format("'keyspace' attribute must match keyspace name. Expected '%s' but got '%s'", getKeyspaceName(), props.get("keyspace"))); } 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); }
@Override public OperationResult<SchemaChangeResult> createKeyspace(final Properties props) throws ConnectionException { final KsDef def; try { 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); }