/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.cassandra.triggers;

import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.cassandra.db.ColumnFamily;
import org.apache.cassandra.db.RowMutation;
import org.apache.cassandra.io.util.FileUtils;

public class InvertedIndex implements ITrigger {
    private static final Logger logger = LoggerFactory.getLogger(InvertedIndex.class);
    private Properties properties = loadProperties();

    public Collection<RowMutation> augment(ByteBuffer key, ColumnFamily update) {
        List<RowMutation> mutations = new ArrayList<RowMutation>();
        for (ByteBuffer name : update.getColumnNames()) {
            RowMutation mutation = new RowMutation(properties.getProperty("keyspace"), update.getColumn(name).value());
            mutation.add(properties.getProperty("columnfamily"), name, key, System.currentTimeMillis());
            mutations.add(mutation);
        }
        return mutations;
    }

    private static Properties loadProperties() {
        Properties properties = new Properties();
        InputStream stream = InvertedIndex.class.getClassLoader().getResourceAsStream("InvertedIndex.properties");
        try {
            properties.load(stream);
        } catch (Exception e) {
            throw new RuntimeException(e);
        } finally {
            FileUtils.closeQuietly(stream);
        }
        logger.info("loaded property file, InvertedIndex.properties");
        return properties;
    }
}

@@ -1064,16 +1064,55 @@
 ctory;%0A%0A
+import org.apache.cassandra.db.Column;%0A
 import o
@@ -1148,16 +1148,16 @@
 Family;%0A
-
 import o
@@ -1286,17 +1286,17 @@
 ITrigger
- 
+%0A
 %7B%0A    pr
@@ -1510,16 +1510,20 @@
  update)
+%0A   
  %7B%0A     
@@ -1569,27 +1569,16 @@
 rayList%3C
-RowMutation
 %3E();%0A   
@@ -1591,50 +1591,37 @@
 or (
-ByteBuffer name : update.getColumnNames())
+Column cell : update)%0A       
  %7B%0A 
@@ -1710,30 +1710,12 @@
 %22), 
-update.getColumn(name)
+cell
 .val
@@ -1790,12 +1790,19 @@
 %22), 
+cell.
 name
+()
 , ke
@@ -1959,16 +1959,20 @@
 erties()
+%0A   
  %7B%0A     
@@ -2191,16 +2191,24 @@
        %7D
+%0A       
  catch (
@@ -2219,16 +2219,24 @@
 ption e)
+%0A       
  %7B%0A     
@@ -2286,16 +2286,32 @@
    %7D
- finally
+%0A        finally%0A       
  %7B%0A 

Fix the trigger example