Package com.netflix.astyanax.thrift.ddl

Examples of com.netflix.astyanax.thrift.ddl.ThriftColumnFamilyDefinitionImpl


    /**
     * Convert a Map of options to an internal thrift column family definition
     * @param options
     */
    private ThriftColumnFamilyDefinitionImpl toThriftColumnFamilyDefinition(Map<String, Object> options, ColumnFamily columnFamily) {
        ThriftColumnFamilyDefinitionImpl def = new ThriftColumnFamilyDefinitionImpl();

        Map<String, Object> internalOptions = Maps.newHashMap();
        if (options != null)
            internalOptions.putAll(options);

        internalOptions.put("keyspace", getKeyspaceName());
       
        if (columnFamily != null) {
            internalOptions.put("name", columnFamily.getName());
            if (!internalOptions.containsKey("comparator_type"))
                internalOptions.put("comparator_type", columnFamily.getColumnSerializer().getComparatorType().getTypeName());
            if (!internalOptions.containsKey("key_validation_class"))
                internalOptions.put("key_validation_class", columnFamily.getKeySerializer().getComparatorType().getTypeName());
            if (columnFamily.getDefaultValueSerializer() != null && !internalOptions.containsKey("default_validation_class"))
                internalOptions.put("default_validation_class", columnFamily.getDefaultValueSerializer().getComparatorType().getTypeName());
        }

        def.setFields(internalOptions);
        return def;
    }
View Full Code Here


                .executeWithFailover(
                        new AbstractKeyspaceOperationImpl<SchemaChangeResult>(
                                tracerFactory.newTracer(CassandraOperationType.UPDATE_COLUMN_FAMILY), getKeyspaceName()) {
                            @Override
                            public SchemaChangeResult internalExecute(Client client, ConnectionContext context) throws Exception {
                                ThriftColumnFamilyDefinitionImpl def = new ThriftColumnFamilyDefinitionImpl();
                                def.setFields(options);
                                def.setKeyspace(getKeyspaceName());
                               
                                return new SchemaChangeResponseImpl()
                                    .setSchemaId(client.system_update_column_family(def.getThriftColumnFamilyDefinition()));
                            }
                        }, RunOnce.get());
    }
View Full Code Here

        ColumnFamilyDefinition cfDef = ksDef.getColumnFamily(columnFamily);
        if (cfDef == null)
            throw new NotFoundException(String.format("Column family '%s' in keyspace '%s' not found", columnFamily, getKeyspaceName()));
       
        Properties props = new Properties();
        ThriftColumnFamilyDefinitionImpl thriftCfDef = (ThriftColumnFamilyDefinitionImpl)cfDef;
        try {
            for (Entry<Object, Object> prop : thriftCfDef.getProperties().entrySet()) {
                props.setProperty((String)prop.getKey(), (String) prop.getValue());
            }
        } catch (Exception e) {
            LOG.error("Error processing column family properties");
        }
View Full Code Here

TOP

Related Classes of com.netflix.astyanax.thrift.ddl.ThriftColumnFamilyDefinitionImpl

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.