Package com.hmsonline.cassandra.index

Examples of com.hmsonline.cassandra.index.Configuration


        long currentTime = System.currentTimeMillis();
        long timeSinceRefresh = currentTime - ConfigurationDao.lastFetchTime;

        if (config == null || config.isEmpty() || timeSinceRefresh > REFRESH_INTERVAL) {
            logger.debug("Refreshing indexing configuration.");
            Configuration configuration = loadConfiguration();
            config = configuration;
        }
        ConfigurationDao.lastFetchTime = currentTime;       
    }
View Full Code Here


        ConfigurationDao.lastFetchTime = currentTime;       
    }

    private Configuration loadConfiguration() {
        try {
            Configuration config = new Configuration();

            RangeSlicesQuery<String, String, String> rangeSlicesQuery = HFactory 
                    .createRangeSlicesQuery(this.getKeyspace(), StringSerializer.get()
                            StringSerializer.get(), StringSerializer.get())
            rangeSlicesQuery.setColumnFamily(COLUMN_FAMILY)
            rangeSlicesQuery.setKeys("", "")
            rangeSlicesQuery.setRange("", "", false, 2000); // MAX_COLUMNS 
            rangeSlicesQuery.setRowCount(2000); // MAX_ROWS 
            QueryResult<OrderedRows<String, String, String>> result = rangeSlicesQuery.execute()
            OrderedRows<String, String, String> orderedRows = result.get()
            for (Row<String, String, String> r : orderedRows) { 
                ColumnSlice<String, String> slice = r.getColumnSlice()
                String indexName = r.getKey();
                Map<String, String> indexProperties = new HashMap<String, String>();
                for (HColumn<String, String> column : slice.getColumns()) { 
                    if(logger.isDebugEnabled()) {
                        logger.debug("got " + COLUMN_FAMILY + "['" + r.getKey() 
                                        + "']" + "['" + column.getName() + "'] = '" 
                                        + column.getValue() + "';");
                    }
                    indexProperties.put(column.getName(), column.getValue());
               
                config.addIndex(indexName, indexProperties);
           
            return config;
        } catch (Exception ex) {
            throw new RuntimeException("Failed to load indexing configuration: " + KEYSPACE + ":" + COLUMN_FAMILY, ex);
        }
View Full Code Here

TOP

Related Classes of com.hmsonline.cassandra.index.Configuration

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.