예제 #1
0
 @Override
 public String dropColumnFamily(
     final String keyspaceName, final String columnFamily, final boolean blockUntilComplete)
     throws HectorException {
   Operation<String> op =
       new Operation<String>(
           OperationType.META_WRITE,
           FailoverPolicy.ON_FAIL_TRY_ALL_AVAILABLE,
           keyspaceName,
           getCredentials()) {
         @Override
         public String execute(Cassandra.Client cassandra) throws HectorException {
           try {
             String schemaId = cassandra.system_drop_column_family(columnFamily);
             if (blockUntilComplete) {
               waitForSchemaAgreement(cassandra);
             }
             return schemaId;
           } catch (Exception e) {
             throw xtrans.translate(e);
           }
         }
       };
   connectionManager.operateWithFailover(op);
   return op.getResult();
 }
예제 #2
0
 /* (non-Javadoc)
  * @see me.prettyprint.cassandra.service.Cluster#describeThriftVersion()
  */
 @Override
 public String describeThriftVersion() throws HectorException {
   Operation<String> op =
       new Operation<String>(OperationType.META_READ, getCredentials()) {
         @Override
         public String execute(Cassandra.Client cassandra) throws HectorException {
           try {
             return cassandra.describe_version();
           } catch (Exception e) {
             throw xtrans.translate(e);
           }
         }
       };
   connectionManager.operateWithFailover(op);
   return op.getResult();
 }
예제 #3
0
 @Override
 public String describePartitioner() throws HectorException {
   Operation<String> op =
       new Operation<String>(OperationType.META_READ, getCredentials()) {
         @Override
         public String execute(Cassandra.Client cassandra) throws HectorException {
           try {
             if (log.isInfoEnabled()) {
               log.info("in execute with client {}", cassandra);
             }
             return cassandra.describe_partitioner();
           } catch (Exception e) {
             throw xtrans.translate(e);
           }
         }
       };
   connectionManager.operateWithFailover(op);
   return op.getResult();
 }
예제 #4
0
 /* (non-Javadoc)
  * @see me.prettyprint.cassandra.service.Cluster#describeKeyspace(java.lang.String)
  */
 @Override
 public KeyspaceDefinition describeKeyspace(final String keyspace) throws HectorException {
   Operation<KeyspaceDefinition> op =
       new Operation<KeyspaceDefinition>(OperationType.META_READ, getCredentials()) {
         @Override
         public KeyspaceDefinition execute(Cassandra.Client cassandra) throws HectorException {
           try {
             return new ThriftKsDef(cassandra.describe_keyspace(keyspace));
           } catch (org.apache.cassandra.thrift.NotFoundException nfe) {
             setException(xtrans.translate(nfe));
             return null;
           } catch (Exception e) {
             throw xtrans.translate(e);
           }
         }
       };
   connectionManager.operateWithFailover(op);
   return op.getResult();
 }
예제 #5
0
 @Override
 public String dropKeyspace(final String keyspace, final boolean blockUntilComplete)
     throws HectorException {
   Operation<String> op =
       new Operation<String>(OperationType.META_WRITE, getCredentials()) {
         @Override
         public String execute(Cassandra.Client cassandra) throws HectorException {
           try {
             String schemaId = cassandra.system_drop_keyspace(keyspace);
             if (blockUntilComplete) {
               waitForSchemaAgreement(cassandra);
             }
             return schemaId;
           } catch (Exception e) {
             throw xtrans.translate(e);
           }
         }
       };
   connectionManager.operateWithFailover(op);
   return op.getResult();
 }