You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2009/07/30 17:30:27 UTC

svn commit: r799331 [4/29] - in /incubator/cassandra/trunk: ./ src/java/org/apache/cassandra/concurrent/ src/java/org/apache/cassandra/config/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/dht/ src/java/org/apache/cassandra/gms/ src/j...

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java?rev=799331&r1=799330&r2=799331&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java Thu Jul 30 15:30:21 2009
@@ -1,66 +1,66 @@
-/**
- * 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.db;
-
-import org.apache.cassandra.db.RowMutationVerbHandler.RowMutationContext;
-import org.apache.cassandra.net.IVerbHandler;
-import org.apache.cassandra.net.Message;
-import org.apache.cassandra.utils.LogUtil;
-import org.apache.log4j.Logger;
-
-
-
-/**
- * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
- */
-
-public class BinaryVerbHandler implements IVerbHandler
-{
-    private static Logger logger_ = Logger.getLogger(BinaryVerbHandler.class);    
-    /* We use this so that we can reuse the same row mutation context for the mutation. */
-    private static ThreadLocal<RowMutationContext> tls_ = new InheritableThreadLocal<RowMutationContext>();
-    
-    public void doVerb(Message message)
-    { 
-        byte[] bytes = message.getMessageBody();
-        /* Obtain a Row Mutation Context from TLS */
-        RowMutationContext rowMutationCtx = tls_.get();
-        if ( rowMutationCtx == null )
-        {
-            rowMutationCtx = new RowMutationContext();
-            tls_.set(rowMutationCtx);
-        }                
-        rowMutationCtx.buffer_.reset(bytes, bytes.length);
-        
-	    try
-	    {
-            RowMutationMessage rmMsg = RowMutationMessage.serializer().deserialize(rowMutationCtx.buffer_);
-            RowMutation rm = rmMsg.getRowMutation();            	                
-            rowMutationCtx.row_.setKey(rm.key());
-            rm.applyBinary(rowMutationCtx.row_);
-	
-	    }        
-	    catch ( Exception e )
-	    {
-	        if (logger_.isDebugEnabled())
-                logger_.debug(LogUtil.throwableToString(e));            
-	    }        
-    }
-
-}
+/**
+ * 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.db;
+
+import org.apache.cassandra.db.RowMutationVerbHandler.RowMutationContext;
+import org.apache.cassandra.net.IVerbHandler;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.utils.LogUtil;
+import org.apache.log4j.Logger;
+
+
+
+/**
+ * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
+ */
+
+public class BinaryVerbHandler implements IVerbHandler
+{
+    private static Logger logger_ = Logger.getLogger(BinaryVerbHandler.class);    
+    /* We use this so that we can reuse the same row mutation context for the mutation. */
+    private static ThreadLocal<RowMutationContext> tls_ = new InheritableThreadLocal<RowMutationContext>();
+    
+    public void doVerb(Message message)
+    { 
+        byte[] bytes = message.getMessageBody();
+        /* Obtain a Row Mutation Context from TLS */
+        RowMutationContext rowMutationCtx = tls_.get();
+        if ( rowMutationCtx == null )
+        {
+            rowMutationCtx = new RowMutationContext();
+            tls_.set(rowMutationCtx);
+        }                
+        rowMutationCtx.buffer_.reset(bytes, bytes.length);
+        
+	    try
+	    {
+            RowMutationMessage rmMsg = RowMutationMessage.serializer().deserialize(rowMutationCtx.buffer_);
+            RowMutation rm = rmMsg.getRowMutation();            	                
+            rowMutationCtx.row_.setKey(rm.key());
+            rm.applyBinary(rowMutationCtx.row_);
+	
+	    }        
+	    catch ( Exception e )
+	    {
+	        if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));            
+	    }        
+    }
+
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployMessage.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployMessage.java?rev=799331&r1=799330&r2=799331&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployMessage.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployMessage.java Thu Jul 30 15:30:21 2009
@@ -1,89 +1,89 @@
-/**
- * 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.db;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
-import org.apache.cassandra.io.ICompactSerializer;
-import org.apache.cassandra.net.Message;
-import org.apache.cassandra.service.StorageService;
-
-
-public class CalloutDeployMessage
-{
-    private static ICompactSerializer<CalloutDeployMessage> serializer_;
-    
-    static
-    {
-        serializer_ = new CalloutDeployMessageSerializer();
-    }
-    
-    public static ICompactSerializer<CalloutDeployMessage> serializer()
-    {
-        return serializer_;
-    }
-    
-    public static Message getCalloutDeployMessage(CalloutDeployMessage cdMessage) throws IOException
-    {
-        ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        DataOutputStream dos = new DataOutputStream(bos);
-        serializer_.serialize(cdMessage, dos);
-        Message message = new Message(StorageService.getLocalStorageEndPoint(), "", StorageService.calloutDeployVerbHandler_, bos.toByteArray());
-        return message;
-    }
-    
-    /* Name of the callout */
-    private String callout_;
-    /* The actual procedure */
-    private String script_;
-    
-    public CalloutDeployMessage(String callout, String script)
-    {
-        callout_ = callout;
-        script_ = script;
-    }
-    
-    String getCallout()
-    {
-        return callout_;
-    }
-    
-    String getScript()
-    {
-        return script_;
-    }
-}
-
-class CalloutDeployMessageSerializer implements ICompactSerializer<CalloutDeployMessage>
-{
-    public void serialize(CalloutDeployMessage cdMessage, DataOutputStream dos) throws IOException
-    {
-        dos.writeUTF(cdMessage.getCallout());
-        dos.writeUTF(cdMessage.getScript());
-    }
-    
-    public CalloutDeployMessage deserialize(DataInputStream dis) throws IOException
-    {
-        String callout = dis.readUTF();
-        String script = dis.readUTF();
-        return new CalloutDeployMessage(callout, script);
-    }
-}
+/**
+ * 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.db;
+
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import org.apache.cassandra.io.ICompactSerializer;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.service.StorageService;
+
+
+public class CalloutDeployMessage
+{
+    private static ICompactSerializer<CalloutDeployMessage> serializer_;
+    
+    static
+    {
+        serializer_ = new CalloutDeployMessageSerializer();
+    }
+    
+    public static ICompactSerializer<CalloutDeployMessage> serializer()
+    {
+        return serializer_;
+    }
+    
+    public static Message getCalloutDeployMessage(CalloutDeployMessage cdMessage) throws IOException
+    {
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        DataOutputStream dos = new DataOutputStream(bos);
+        serializer_.serialize(cdMessage, dos);
+        Message message = new Message(StorageService.getLocalStorageEndPoint(), "", StorageService.calloutDeployVerbHandler_, bos.toByteArray());
+        return message;
+    }
+    
+    /* Name of the callout */
+    private String callout_;
+    /* The actual procedure */
+    private String script_;
+    
+    public CalloutDeployMessage(String callout, String script)
+    {
+        callout_ = callout;
+        script_ = script;
+    }
+    
+    String getCallout()
+    {
+        return callout_;
+    }
+    
+    String getScript()
+    {
+        return script_;
+    }
+}
+
+class CalloutDeployMessageSerializer implements ICompactSerializer<CalloutDeployMessage>
+{
+    public void serialize(CalloutDeployMessage cdMessage, DataOutputStream dos) throws IOException
+    {
+        dos.writeUTF(cdMessage.getCallout());
+        dos.writeUTF(cdMessage.getScript());
+    }
+    
+    public CalloutDeployMessage deserialize(DataInputStream dis) throws IOException
+    {
+        String callout = dis.readUTF();
+        String script = dis.readUTF();
+        return new CalloutDeployMessage(callout, script);
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployVerbHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployVerbHandler.java?rev=799331&r1=799330&r2=799331&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployVerbHandler.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutDeployVerbHandler.java Thu Jul 30 15:30:21 2009
@@ -1,49 +1,49 @@
-/**
- * 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.db;
-
-import java.io.IOException;
-
-import org.apache.cassandra.io.DataInputBuffer;
-import org.apache.cassandra.net.IVerbHandler;
-import org.apache.cassandra.net.Message;
-import org.apache.cassandra.utils.LogUtil;
-import org.apache.log4j.Logger;
-
-
-public class CalloutDeployVerbHandler implements IVerbHandler
-{
-    private static Logger logger_ = Logger.getLogger(CalloutDeployVerbHandler.class);
-    
-    public void doVerb(Message message)
-    {
-        byte[] bytes = message.getMessageBody();
-        DataInputBuffer bufIn = new DataInputBuffer();
-        bufIn.reset(bytes, bytes.length);
-        try
-        {
-            CalloutDeployMessage cdMessage = CalloutDeployMessage.serializer().deserialize(bufIn);
-            /* save the callout to callout cache and to disk. */
-            CalloutManager.instance().addCallout( cdMessage.getCallout(), cdMessage.getScript() );
-        }
-        catch ( IOException ex )
-        {
-            logger_.warn(LogUtil.throwableToString(ex));
-        }        
-    }
-}
+/**
+ * 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.db;
+
+import java.io.IOException;
+
+import org.apache.cassandra.io.DataInputBuffer;
+import org.apache.cassandra.net.IVerbHandler;
+import org.apache.cassandra.net.Message;
+import org.apache.cassandra.utils.LogUtil;
+import org.apache.log4j.Logger;
+
+
+public class CalloutDeployVerbHandler implements IVerbHandler
+{
+    private static Logger logger_ = Logger.getLogger(CalloutDeployVerbHandler.class);
+    
+    public void doVerb(Message message)
+    {
+        byte[] bytes = message.getMessageBody();
+        DataInputBuffer bufIn = new DataInputBuffer();
+        bufIn.reset(bytes, bytes.length);
+        try
+        {
+            CalloutDeployMessage cdMessage = CalloutDeployMessage.serializer().deserialize(bufIn);
+            /* save the callout to callout cache and to disk. */
+            CalloutManager.instance().addCallout( cdMessage.getCallout(), cdMessage.getScript() );
+        }
+        catch ( IOException ex )
+        {
+            logger_.warn(LogUtil.throwableToString(ex));
+        }        
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutManager.java?rev=799331&r1=799330&r2=799331&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutManager.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/CalloutManager.java Thu Jul 30 15:30:21 2009
@@ -1,211 +1,211 @@
-/**
- * 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.db;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.script.Bindings;
-import javax.script.Invocable;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.Compilable;
-import javax.script.CompiledScript;
-import javax.script.ScriptException;
-import javax.script.SimpleBindings;
-
-import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.procedures.GroovyScriptRunner;
-import org.apache.cassandra.utils.LogUtil;
-import org.apache.cassandra.utils.FileUtils;
-
-import org.apache.log4j.Logger;
-
-public class CalloutManager
-{
-    private final static Logger logger_ = Logger.getLogger(CalloutManager.class); 
-    private static final String extn_ = ".groovy";
-    /* Used to lock the factory for creation of CalloutManager instance */
-    private static Lock createLock_ = new ReentrantLock();
-    /* An instance of the CalloutManager  */
-    private static CalloutManager instance_;
-    
-    public static CalloutManager instance()
-    {
-        if ( instance_ == null )
-        {
-            CalloutManager.createLock_.lock();
-            try
-            {
-                if ( instance_ == null )
-                {
-                    instance_ = new CalloutManager();
-                }
-            }
-            finally
-            {
-                CalloutManager.createLock_.unlock();
-            }
-        }
-        return instance_;
-    }
-    
-    /* Map containing the name of callout as key and the callout script as value */
-    private Map<String, CompiledScript> calloutCache_ = new HashMap<String, CompiledScript>();    
-    /* The Groovy Script compiler instance */
-    private Compilable compiler_;
-    /* The Groovy script invokable instance */
-    private Invocable invokable_;
-    
-    private CalloutManager()
-    {
-        ScriptEngineManager scriptManager = new ScriptEngineManager();
-        ScriptEngine groovyEngine = scriptManager.getEngineByName("groovy");
-        compiler_ = (Compilable)groovyEngine;
-        invokable_ = (Invocable)groovyEngine;
-    }
-    
-    /**
-     * Compile the script and cache the compiled script.
-     * @param script to be compiled
-     * @throws ScriptException
-     */
-    private void compileAndCache(String scriptId, String script) throws ScriptException
-    {
-        if ( compiler_ != null )
-        {
-            CompiledScript compiledScript = compiler_.compile(script);
-            calloutCache_.put(scriptId, compiledScript);
-        }
-    }
-    
-    /**
-     * Invoked on start up to load all the stored callouts, compile
-     * and cache them.
-     * 
-     * @throws IOException
-     */
-    public void onStart() throws IOException
-    {
-    	String location = DatabaseDescriptor.getCalloutLocation();
-    	if ( location == null )
-    		return;
-    	
-        FileUtils.createDirectory(location);
-        
-        File[] files = new File(location).listFiles();
-        
-        for ( File file : files )
-        {
-            String f = file.getName();
-            /* Get the callout name from the file */
-            String callout = f.split(extn_)[0];
-            FileInputStream fis = new FileInputStream(file);
-            byte[] bytes = new byte[fis.available()];
-            fis.read(bytes);
-            fis.close();
-            /* cache the callout after compiling it */
-            try
-            {
-                compileAndCache(callout, new String(bytes));                    
-            }
-            catch ( ScriptException ex )
-            {
-                logger_.warn(LogUtil.throwableToString(ex));
-            }
-        }
-    }
-    
-    /**
-     * Store the callout in cache and write it out
-     * to disk.
-     * @param callout the name of the callout
-     * @param script actual implementation of the callout
-    */
-    public void addCallout(String callout, String script) throws IOException
-    {
-        /* cache the script */
-        /* cache the callout after compiling it */
-        try
-        {
-            compileAndCache(callout, script);                    
-        }
-        catch ( ScriptException ex )
-        {
-            logger_.warn(LogUtil.throwableToString(ex));
-        }
-        /* save the script to disk */
-        String scriptFile = DatabaseDescriptor.getCalloutLocation() + File.separator + callout + extn_;
-        File file = new File(scriptFile);
-        if ( file.exists() )
-        {
-            if (logger_.isDebugEnabled())
-              logger_.debug("Deleting the old script file ...");
-            file.delete();
-        }
-        FileOutputStream fos = new FileOutputStream(scriptFile);
-        fos.write(script.getBytes());
-        fos.close();
-    }
-    
-    /**
-     * Remove the registered callout and delete the
-     * script on the disk.
-     * @param callout to be removed
-     */
-    public void removeCallout(String callout)
-    {
-        /* remove the script from cache */
-        calloutCache_.remove(callout);
-        String scriptFile = DatabaseDescriptor.getCalloutLocation() + File.separator + callout + ".grv";
-        File file = new File(scriptFile);
-        file.delete();
-    }
-    
-    /**
-     * Execute the specified callout.
-     * @param callout to be executed.
-     * @param args arguments to be passed to the callouts.
-     */
-    public Object executeCallout(String callout, Object ... args)
-    {
-        Object result = null;
-        CompiledScript script = calloutCache_.get(callout);
-        if ( script != null )
-        {
-            try
-            {
-                Bindings binding = new SimpleBindings();
-                binding.put("args", args);
-                result = script.eval(binding);
-            }
-            catch(ScriptException ex)
-            {
-                logger_.warn(LogUtil.throwableToString(ex));
-            }
-        }
-        return result;
-    }
-}
+/**
+ * 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.db;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import javax.script.Bindings;
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.Compilable;
+import javax.script.CompiledScript;
+import javax.script.ScriptException;
+import javax.script.SimpleBindings;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.procedures.GroovyScriptRunner;
+import org.apache.cassandra.utils.LogUtil;
+import org.apache.cassandra.utils.FileUtils;
+
+import org.apache.log4j.Logger;
+
+public class CalloutManager
+{
+    private final static Logger logger_ = Logger.getLogger(CalloutManager.class); 
+    private static final String extn_ = ".groovy";
+    /* Used to lock the factory for creation of CalloutManager instance */
+    private static Lock createLock_ = new ReentrantLock();
+    /* An instance of the CalloutManager  */
+    private static CalloutManager instance_;
+    
+    public static CalloutManager instance()
+    {
+        if ( instance_ == null )
+        {
+            CalloutManager.createLock_.lock();
+            try
+            {
+                if ( instance_ == null )
+                {
+                    instance_ = new CalloutManager();
+                }
+            }
+            finally
+            {
+                CalloutManager.createLock_.unlock();
+            }
+        }
+        return instance_;
+    }
+    
+    /* Map containing the name of callout as key and the callout script as value */
+    private Map<String, CompiledScript> calloutCache_ = new HashMap<String, CompiledScript>();    
+    /* The Groovy Script compiler instance */
+    private Compilable compiler_;
+    /* The Groovy script invokable instance */
+    private Invocable invokable_;
+    
+    private CalloutManager()
+    {
+        ScriptEngineManager scriptManager = new ScriptEngineManager();
+        ScriptEngine groovyEngine = scriptManager.getEngineByName("groovy");
+        compiler_ = (Compilable)groovyEngine;
+        invokable_ = (Invocable)groovyEngine;
+    }
+    
+    /**
+     * Compile the script and cache the compiled script.
+     * @param script to be compiled
+     * @throws ScriptException
+     */
+    private void compileAndCache(String scriptId, String script) throws ScriptException
+    {
+        if ( compiler_ != null )
+        {
+            CompiledScript compiledScript = compiler_.compile(script);
+            calloutCache_.put(scriptId, compiledScript);
+        }
+    }
+    
+    /**
+     * Invoked on start up to load all the stored callouts, compile
+     * and cache them.
+     * 
+     * @throws IOException
+     */
+    public void onStart() throws IOException
+    {
+    	String location = DatabaseDescriptor.getCalloutLocation();
+    	if ( location == null )
+    		return;
+    	
+        FileUtils.createDirectory(location);
+        
+        File[] files = new File(location).listFiles();
+        
+        for ( File file : files )
+        {
+            String f = file.getName();
+            /* Get the callout name from the file */
+            String callout = f.split(extn_)[0];
+            FileInputStream fis = new FileInputStream(file);
+            byte[] bytes = new byte[fis.available()];
+            fis.read(bytes);
+            fis.close();
+            /* cache the callout after compiling it */
+            try
+            {
+                compileAndCache(callout, new String(bytes));                    
+            }
+            catch ( ScriptException ex )
+            {
+                logger_.warn(LogUtil.throwableToString(ex));
+            }
+        }
+    }
+    
+    /**
+     * Store the callout in cache and write it out
+     * to disk.
+     * @param callout the name of the callout
+     * @param script actual implementation of the callout
+    */
+    public void addCallout(String callout, String script) throws IOException
+    {
+        /* cache the script */
+        /* cache the callout after compiling it */
+        try
+        {
+            compileAndCache(callout, script);                    
+        }
+        catch ( ScriptException ex )
+        {
+            logger_.warn(LogUtil.throwableToString(ex));
+        }
+        /* save the script to disk */
+        String scriptFile = DatabaseDescriptor.getCalloutLocation() + File.separator + callout + extn_;
+        File file = new File(scriptFile);
+        if ( file.exists() )
+        {
+            if (logger_.isDebugEnabled())
+              logger_.debug("Deleting the old script file ...");
+            file.delete();
+        }
+        FileOutputStream fos = new FileOutputStream(scriptFile);
+        fos.write(script.getBytes());
+        fos.close();
+    }
+    
+    /**
+     * Remove the registered callout and delete the
+     * script on the disk.
+     * @param callout to be removed
+     */
+    public void removeCallout(String callout)
+    {
+        /* remove the script from cache */
+        calloutCache_.remove(callout);
+        String scriptFile = DatabaseDescriptor.getCalloutLocation() + File.separator + callout + ".grv";
+        File file = new File(scriptFile);
+        file.delete();
+    }
+    
+    /**
+     * Execute the specified callout.
+     * @param callout to be executed.
+     * @param args arguments to be passed to the callouts.
+     */
+    public Object executeCallout(String callout, Object ... args)
+    {
+        Object result = null;
+        CompiledScript script = calloutCache_.get(callout);
+        if ( script != null )
+        {
+            try
+            {
+                Bindings binding = new SimpleBindings();
+                binding.put("args", args);
+                result = script.eval(binding);
+            }
+            catch(ScriptException ex)
+            {
+                logger_.warn(LogUtil.throwableToString(ex));
+            }
+        }
+        return result;
+    }
+}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java?rev=799331&r1=799330&r2=799331&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java Thu Jul 30 15:30:21 2009
@@ -1,210 +1,210 @@
-/**
- * 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.db;
-
-import java.util.Collection;
-import java.nio.ByteBuffer;
-
-import org.apache.commons.lang.ArrayUtils;
-
-import org.apache.cassandra.db.marshal.AbstractType;
-
-
-/**
- * Column is immutable, which prevents all kinds of confusion in a multithreaded environment.
- * (TODO: look at making SuperColumn immutable too.  This is trickier but is probably doable
- *  with something like PCollections -- http://code.google.com
- *
- * Author : Avinash Lakshman ( alakshman@facebook.com ) & Prashant Malik ( pmalik@facebook.com )
- */
-
-public final class Column implements IColumn
-{
-    private static ColumnSerializer serializer_ = new ColumnSerializer();
-
-    static ColumnSerializer serializer()
-    {
-        return serializer_;
-    }
-
-    private final byte[] name;
-    private final byte[] value;
-    private final long timestamp;
-    private final boolean isMarkedForDelete;
-
-    Column(byte[] name)
-    {
-        this(name, ArrayUtils.EMPTY_BYTE_ARRAY);
-    }
-
-    Column(byte[] name, byte[] value)
-    {
-        this(name, value, 0);
-    }
-
-    public Column(byte[] name, byte[] value, long timestamp)
-    {
-        this(name, value, timestamp, false);
-    }
-
-    public Column(byte[] name, byte[] value, long timestamp, boolean isDeleted)
-    {
-        assert name != null;
-        assert value != null;
-        this.name = name;
-        this.value = value;
-        this.timestamp = timestamp;
-        isMarkedForDelete = isDeleted;
-    }
-
-    public byte[] name()
-    {
-        return name;
-    }
-
-    public Column getSubColumn(byte[] columnName)
-    {
-        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
-    }
-
-    public byte[] value()
-    {
-        return value;
-    }
-
-    public byte[] value(byte[] key)
-    {
-        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
-    }
-
-    public Collection<IColumn> getSubColumns()
-    {
-        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
-    }
-
-    public int getObjectCount()
-    {
-        return 1;
-    }
-
-    public long timestamp()
-    {
-        return timestamp;
-    }
-
-    public long timestamp(byte[] key)
-    {
-        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
-    }
-
-    public boolean isMarkedForDelete()
-    {
-        return isMarkedForDelete;
-    }
-
-    public long getMarkedForDeleteAt()
-    {
-        if (!isMarkedForDelete())
-        {
-            throw new IllegalStateException("column is not marked for delete");
-        }
-        return timestamp;
-    }
-
-    public int size()
-    {
-        /*
-         * Size of a column is =
-         *   size of a name (UtfPrefix + length of the string)
-         * + 1 byte to indicate if the column has been deleted
-         * + 8 bytes for timestamp
-         * + 4 bytes which basically indicates the size of the byte array
-         * + entire byte array.
-        */
-
-        /*
-           * We store the string as UTF-8 encoded, so when we calculate the length, it
-           * should be converted to UTF-8.
-           */
-        return IColumn.UtfPrefix_ + name.length + DBConstants.boolSize_ + DBConstants.tsSize_ + DBConstants.intSize_ + value.length;
-    }
-
-    /*
-     * This returns the size of the column when serialized.
-     * @see com.facebook.infrastructure.db.IColumn#serializedSize()
-    */
-    public int serializedSize()
-    {
-        return size();
-    }
-
-    public void addColumn(IColumn column)
-    {
-        throw new UnsupportedOperationException("This operation is not supported for simple columns.");
-    }
-
-    public IColumn diff(IColumn column)
-    {
-        if (timestamp() < column.timestamp())
-        {
-            return column;
-        }
-        return null;
-    }
-
-    public byte[] digest()
-    {
-        StringBuilder stringBuilder = new StringBuilder();
-        stringBuilder.append(name);
-        stringBuilder.append(":");
-        stringBuilder.append(timestamp);
-        return stringBuilder.toString().getBytes();
-    }
-
-    public int getLocalDeletionTime()
-    {
-        assert isMarkedForDelete;
-        return ByteBuffer.wrap(value).getInt();
-    }
-
-    // note that we do not call this simply compareTo since it also makes sense to compare Columns by name
-    public long comparePriority(Column o)
-    {
-        if (isMarkedForDelete)
-        {
-            // tombstone always wins ties.
-            return timestamp < o.timestamp ? -1 : 1;
-        }
-        return timestamp - o.timestamp;
-    }
-
-    public String getString(AbstractType comparator)
-    {
-        StringBuilder sb = new StringBuilder();
-        sb.append(comparator.getString(name));
-        sb.append(":");
-        sb.append(isMarkedForDelete());
-        sb.append(":");
-        sb.append(value.length);
-        sb.append("@");
-        sb.append(timestamp());
-        return sb.toString();
-    }
-}
-
+/**
+ * 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.db;
+
+import java.util.Collection;
+import java.nio.ByteBuffer;
+
+import org.apache.commons.lang.ArrayUtils;
+
+import org.apache.cassandra.db.marshal.AbstractType;
+
+
+/**
+ * Column is immutable, which prevents all kinds of confusion in a multithreaded environment.
+ * (TODO: look at making SuperColumn immutable too.  This is trickier but is probably doable
+ *  with something like PCollections -- http://code.google.com
+ *
+ * Author : Avinash Lakshman ( alakshman@facebook.com ) & Prashant Malik ( pmalik@facebook.com )
+ */
+
+public final class Column implements IColumn
+{
+    private static ColumnSerializer serializer_ = new ColumnSerializer();
+
+    static ColumnSerializer serializer()
+    {
+        return serializer_;
+    }
+
+    private final byte[] name;
+    private final byte[] value;
+    private final long timestamp;
+    private final boolean isMarkedForDelete;
+
+    Column(byte[] name)
+    {
+        this(name, ArrayUtils.EMPTY_BYTE_ARRAY);
+    }
+
+    Column(byte[] name, byte[] value)
+    {
+        this(name, value, 0);
+    }
+
+    public Column(byte[] name, byte[] value, long timestamp)
+    {
+        this(name, value, timestamp, false);
+    }
+
+    public Column(byte[] name, byte[] value, long timestamp, boolean isDeleted)
+    {
+        assert name != null;
+        assert value != null;
+        this.name = name;
+        this.value = value;
+        this.timestamp = timestamp;
+        isMarkedForDelete = isDeleted;
+    }
+
+    public byte[] name()
+    {
+        return name;
+    }
+
+    public Column getSubColumn(byte[] columnName)
+    {
+        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
+    }
+
+    public byte[] value()
+    {
+        return value;
+    }
+
+    public byte[] value(byte[] key)
+    {
+        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
+    }
+
+    public Collection<IColumn> getSubColumns()
+    {
+        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
+    }
+
+    public int getObjectCount()
+    {
+        return 1;
+    }
+
+    public long timestamp()
+    {
+        return timestamp;
+    }
+
+    public long timestamp(byte[] key)
+    {
+        throw new UnsupportedOperationException("This operation is unsupported on simple columns.");
+    }
+
+    public boolean isMarkedForDelete()
+    {
+        return isMarkedForDelete;
+    }
+
+    public long getMarkedForDeleteAt()
+    {
+        if (!isMarkedForDelete())
+        {
+            throw new IllegalStateException("column is not marked for delete");
+        }
+        return timestamp;
+    }
+
+    public int size()
+    {
+        /*
+         * Size of a column is =
+         *   size of a name (UtfPrefix + length of the string)
+         * + 1 byte to indicate if the column has been deleted
+         * + 8 bytes for timestamp
+         * + 4 bytes which basically indicates the size of the byte array
+         * + entire byte array.
+        */
+
+        /*
+           * We store the string as UTF-8 encoded, so when we calculate the length, it
+           * should be converted to UTF-8.
+           */
+        return IColumn.UtfPrefix_ + name.length + DBConstants.boolSize_ + DBConstants.tsSize_ + DBConstants.intSize_ + value.length;
+    }
+
+    /*
+     * This returns the size of the column when serialized.
+     * @see com.facebook.infrastructure.db.IColumn#serializedSize()
+    */
+    public int serializedSize()
+    {
+        return size();
+    }
+
+    public void addColumn(IColumn column)
+    {
+        throw new UnsupportedOperationException("This operation is not supported for simple columns.");
+    }
+
+    public IColumn diff(IColumn column)
+    {
+        if (timestamp() < column.timestamp())
+        {
+            return column;
+        }
+        return null;
+    }
+
+    public byte[] digest()
+    {
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.append(name);
+        stringBuilder.append(":");
+        stringBuilder.append(timestamp);
+        return stringBuilder.toString().getBytes();
+    }
+
+    public int getLocalDeletionTime()
+    {
+        assert isMarkedForDelete;
+        return ByteBuffer.wrap(value).getInt();
+    }
+
+    // note that we do not call this simply compareTo since it also makes sense to compare Columns by name
+    public long comparePriority(Column o)
+    {
+        if (isMarkedForDelete)
+        {
+            // tombstone always wins ties.
+            return timestamp < o.timestamp ? -1 : 1;
+        }
+        return timestamp - o.timestamp;
+    }
+
+    public String getString(AbstractType comparator)
+    {
+        StringBuilder sb = new StringBuilder();
+        sb.append(comparator.getString(name));
+        sb.append(":");
+        sb.append(isMarkedForDelete());
+        sb.append(":");
+        sb.append(value.length);
+        sb.append("@");
+        sb.append(timestamp());
+        return sb.toString();
+    }
+}
+

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java?rev=799331&r1=799330&r2=799331&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java Thu Jul 30 15:30:21 2009
@@ -1,523 +1,523 @@
-/**
- * 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.db;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.lang.reflect.Proxy;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.ConcurrentSkipListMap;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.log4j.Logger;
-
-import org.apache.cassandra.config.DatabaseDescriptor;
-import org.apache.cassandra.utils.FBUtilities;
-import org.apache.cassandra.io.ICompactSerializer;
-import org.apache.cassandra.db.filter.QueryPath;
-import org.apache.cassandra.db.marshal.AbstractType;
-import org.apache.cassandra.db.marshal.MarshalException;
-import org.apache.cassandra.db.marshal.LongType;
-
-/**
- * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
- */
-public final class ColumnFamily
-{
-    /* The column serializer for this Column Family. Create based on config. */
-    private static ICompactSerializer<ColumnFamily> serializer_;
-    public static final short utfPrefix_ = 2;   
-
-    private static Logger logger_ = Logger.getLogger( ColumnFamily.class );
-    private static Map<String, String> columnTypes_ = new HashMap<String, String>();
-    private String type_;
-    private String table_;
-
-    static
-    {
-        serializer_ = new ColumnFamilySerializer();
-        /* TODO: These are the various column types. Hard coded for now. */
-        columnTypes_.put("Standard", "Standard");
-        columnTypes_.put("Super", "Super");
-    }
-
-    public static ICompactSerializer<ColumnFamily> serializer()
-    {
-        return serializer_;
-    }
-
-    /*
-     * This method returns the serializer whose methods are
-     * preprocessed by a dynamic proxy.
-    */
-    public static ICompactSerializer<ColumnFamily> serializerWithIndexes()
-    {
-        return (ICompactSerializer<ColumnFamily>)Proxy.newProxyInstance( ColumnFamily.class.getClassLoader(), new Class[]{ICompactSerializer.class}, new CompactSerializerInvocationHandler<ColumnFamily>(serializer_) );
-    }
-
-    public static String getColumnType(String key)
-    {
-    	if ( key == null )
-    		return columnTypes_.get("Standard");
-    	return columnTypes_.get(key);
-    }
-
-    public static ColumnFamily create(String tableName, String cfName)
-    {
-        String columnType = DatabaseDescriptor.getColumnFamilyType(tableName, cfName);
-        AbstractType comparator = DatabaseDescriptor.getComparator(tableName, cfName);
-        AbstractType subcolumnComparator = DatabaseDescriptor.getSubComparator(tableName, cfName);
-        return new ColumnFamily(cfName, columnType, comparator, subcolumnComparator);
-    }
-
-    private String name_;
-
-    private transient ICompactSerializer<IColumn> columnSerializer_;
-    private long markedForDeleteAt = Long.MIN_VALUE;
-    private int localDeletionTime = Integer.MIN_VALUE;
-    private AtomicInteger size_ = new AtomicInteger(0);
-    private ConcurrentSkipListMap<byte[], IColumn> columns_;
-
-    public ColumnFamily(String cfName, String columnType, AbstractType comparator, AbstractType subcolumnComparator)
-    {
-        name_ = cfName;
-        type_ = columnType;
-        columnSerializer_ = columnType.equals("Standard") ? Column.serializer() : SuperColumn.serializer(subcolumnComparator);
-        columns_ = new ConcurrentSkipListMap<byte[], IColumn>(comparator);
-    }
-
-    public ColumnFamily cloneMeShallow()
-    {
-        ColumnFamily cf = new ColumnFamily(name_, type_, getComparator(), getSubComparator());
-        cf.markedForDeleteAt = markedForDeleteAt;
-        cf.localDeletionTime = localDeletionTime;
-        return cf;
-    }
-
-    private AbstractType getSubComparator()
-    {
-        return (columnSerializer_ instanceof SuperColumnSerializer) ? ((SuperColumnSerializer)columnSerializer_).getComparator() : null;
-    }
-
-    ColumnFamily cloneMe()
-    {
-        ColumnFamily cf = cloneMeShallow();
-        cf.columns_ = columns_.clone();
-    	return cf;
-    }
-
-    public String name()
-    {
-        return name_;
-    }
-
-    /*
-     *  We need to go through each column
-     *  in the column family and resolve it before adding
-    */
-    void addColumns(ColumnFamily cf)
-    {
-        for (IColumn column : cf.getSortedColumns())
-        {
-            addColumn(column);
-        }
-    }
-
-    public ICompactSerializer<IColumn> getColumnSerializer()
-    {
-    	return columnSerializer_;
-    }
-
-    int getColumnCount()
-    {
-    	int count = 0;
-        if(!isSuper())
-        {
-            count = columns_.size();
-        }
-        else
-        {
-            for(IColumn column: columns_.values())
-            {
-                count += column.getObjectCount();
-            }
-        }
-    	return count;
-    }
-
-    public boolean isSuper()
-    {
-        return type_.equals("Super");
-    }
-
-    public void addColumn(QueryPath path, byte[] value, long timestamp)
-    {
-        addColumn(path, value, timestamp, false);
-    }
-
-    /** In most places the CF must be part of a QueryPath but here it is ignored. */
-    public void addColumn(QueryPath path, byte[] value, long timestamp, boolean deleted)
-	{
-        assert path.columnName != null : path;
-		IColumn column;
-        if (path.superColumnName == null)
-        {
-            try
-            {
-                getComparator().validate(path.columnName);
-            }
-            catch (Exception e)
-            {
-                throw new MarshalException("Invalid column name in " + path.columnFamilyName + " for " + getComparator().getClass().getName());
-            }
-            column = new Column(path.columnName, value, timestamp, deleted);
-        }
-        else
-        {
-            assert isSuper();
-            try
-            {
-                getComparator().validate(path.superColumnName);
-            }
-            catch (Exception e)
-            {
-                throw new MarshalException("Invalid supercolumn name in " + path.columnFamilyName + " for " + getComparator().getClass().getName());
-            }
-            column = new SuperColumn(path.superColumnName, getSubComparator());
-            column.addColumn(new Column(path.columnName, value, timestamp, deleted)); // checks subcolumn name
-        }
-		addColumn(column);
-    }
-
-    public void clear()
-    {
-    	columns_.clear();
-    	size_.set(0);
-    }
-
-    /*
-     * If we find an old column that has the same name
-     * the ask it to resolve itself else add the new column .
-    */
-    public void addColumn(IColumn column)
-    {
-        byte[] name = column.name();
-        IColumn oldColumn = columns_.get(name);
-        if (oldColumn != null)
-        {
-            if (oldColumn instanceof SuperColumn)
-            {
-                int oldSize = oldColumn.size();
-                ((SuperColumn) oldColumn).putColumn(column);
-                size_.addAndGet(oldColumn.size() - oldSize);
-            }
-            else
-            {
-                if (((Column)oldColumn).comparePriority((Column)column) <= 0)
-                {
-                    columns_.put(name, column);
-                    size_.addAndGet(column.size());
-                }
-            }
-        }
-        else
-        {
-            size_.addAndGet(column.size());
-            columns_.put(name, column);
-        }
-    }
-
-    public IColumn getColumn(byte[] name)
-    {
-        return columns_.get(name);
-    }
-
-    public SortedSet<byte[]> getColumnNames()
-    {
-        return columns_.keySet();
-    }
-
-    public Collection<IColumn> getSortedColumns()
-    {
-        return columns_.values();
-    }
-
-    public Map<byte[], IColumn> getColumnsMap()
-    {
-        return columns_;
-    }
-
-    public void remove(byte[] columnName)
-    {
-    	columns_.remove(columnName);
-    }
-
-    public void delete(int localtime, long timestamp)
-    {
-        localDeletionTime = localtime;
-        markedForDeleteAt = timestamp;
-    }
-
-    public void delete(ColumnFamily cf2)
-    {
-        delete(Math.max(getLocalDeletionTime(), cf2.getLocalDeletionTime()),
-               Math.max(getMarkedForDeleteAt(), cf2.getMarkedForDeleteAt()));
-    }
-
-    public boolean isMarkedForDelete()
-    {
-        return markedForDeleteAt > Long.MIN_VALUE;
-    }
-
-    /*
-     * This function will calculate the difference between 2 column families.
-     * The external input is assumed to be a superset of internal.
-     */
-    ColumnFamily diff(ColumnFamily cfComposite)
-    {
-    	ColumnFamily cfDiff = new ColumnFamily(cfComposite.name(), cfComposite.type_, getComparator(), getSubComparator());
-        if (cfComposite.getMarkedForDeleteAt() > getMarkedForDeleteAt())
-        {
-            cfDiff.delete(cfComposite.getLocalDeletionTime(), cfComposite.getMarkedForDeleteAt());
-        }
-
-        // (don't need to worry about cfNew containing IColumns that are shadowed by
-        // the delete tombstone, since cfNew was generated by CF.resolve, which
-        // takes care of those for us.)
-        Map<byte[], IColumn> columns = cfComposite.getColumnsMap();
-        Set<byte[]> cNames = columns.keySet();
-        for (byte[] cName : cNames)
-        {
-            IColumn columnInternal = columns_.get(cName);
-            IColumn columnExternal = columns.get(cName);
-            if (columnInternal == null)
-            {
-                cfDiff.addColumn(columnExternal);
-            }
-            else
-            {
-                IColumn columnDiff = columnInternal.diff(columnExternal);
-                if (columnDiff != null)
-                {
-                    cfDiff.addColumn(columnDiff);
-                }
-            }
-        }
-
-        if (!cfDiff.getColumnsMap().isEmpty() || cfDiff.isMarkedForDelete())
-        	return cfDiff;
-        else
-        	return null;
-    }
-
-    public AbstractType getComparator()
-    {
-        return (AbstractType)columns_.comparator();
-    }
-
-    int size()
-    {
-        if (size_.get() == 0)
-        {
-            for (IColumn column : columns_.values())
-            {
-                size_.addAndGet(column.size());
-            }
-        }
-        return size_.get();
-    }
-
-    public int hashCode()
-    {
-        return name().hashCode();
-    }
-
-    public boolean equals(Object o)
-    {
-        if ( !(o instanceof ColumnFamily) )
-            return false;
-        ColumnFamily cf = (ColumnFamily)o;
-        return name().equals(cf.name());
-    }
-
-    public String toString()
-    {
-    	StringBuilder sb = new StringBuilder();
-        sb.append("ColumnFamily(");
-    	sb.append(name_);
-
-        if (isMarkedForDelete()) {
-            sb.append(" -delete at " + getMarkedForDeleteAt() + "-");
-        }
-
-    	sb.append(" [");
-        sb.append(getComparator().getColumnsString(getSortedColumns()));
-        sb.append("])");
-
-    	return sb.toString();
-    }
-
-    public byte[] digest()
-    {
-        byte[] xorHash = ArrayUtils.EMPTY_BYTE_ARRAY;
-        for (IColumn column : columns_.values())
-        {
-            if (xorHash.length == 0)
-            {
-                xorHash = column.digest();
-            }
-            else
-            {
-                xorHash = FBUtilities.xor(xorHash, column.digest());
-            }
-        }
-        return xorHash;
-    }
-
-    public long getMarkedForDeleteAt()
-    {
-        return markedForDeleteAt;
-    }
-
-    public int getLocalDeletionTime()
-    {
-        return localDeletionTime;
-    }
-
-    public String type()
-    {
-        return type_;
-    }
-
-    /** merge all columnFamilies into a single instance, with only the newest versions of columns preserved. */
-    static ColumnFamily resolve(List<ColumnFamily> columnFamilies)
-    {
-        int size = columnFamilies.size();
-        if (size == 0)
-            return null;
-
-        // start from nothing so that we don't include potential deleted columns from the first instance
-        ColumnFamily cf0 = columnFamilies.get(0);
-        ColumnFamily cf = cf0.cloneMeShallow();
-
-        // merge
-        for (ColumnFamily cf2 : columnFamilies)
-        {
-            assert cf.name().equals(cf2.name());
-            cf.addColumns(cf2);
-            cf.delete(cf2);
-        }
-        return cf;
-    }
-
-    public static class ColumnFamilySerializer implements ICompactSerializer<ColumnFamily>
-    {
-        /*
-         * We are going to create indexes, and write out that information as well. The format
-         * of the data serialized is as follows.
-         *
-         * 1) Without indexes:
-         *  // written by the data
-         * 	<boolean false (index is not present)>
-         * 	<column family id>
-         * 	<is marked for delete>
-         * 	<total number of columns>
-         * 	<columns data>
-
-         * 	<boolean true (index is present)>
-         *
-         *  This part is written by the column indexer
-         * 	<size of index in bytes>
-         * 	<list of column names and their offsets relative to the first column>
-         *
-         *  <size of the cf in bytes>
-         * 	<column family id>
-         * 	<is marked for delete>
-         * 	<total number of columns>
-         * 	<columns data>
-        */
-        public void serialize(ColumnFamily columnFamily, DataOutputStream dos) throws IOException
-        {
-            // TODO whenever we change this we need to change the code in SequenceFile to match in two places.
-            // This SUCKS and is inefficient to boot.  let's fix this ASAP. 
-            Collection<IColumn> columns = columnFamily.getSortedColumns();
-
-            dos.writeUTF(columnFamily.name());
-            dos.writeUTF(columnFamily.type_);
-            dos.writeUTF(columnFamily.getComparator().getClass().getCanonicalName());
-            AbstractType subcolumnComparator = columnFamily.getSubComparator();
-            dos.writeUTF(subcolumnComparator == null ? "" : subcolumnComparator.getClass().getCanonicalName());
-            dos.writeInt(columnFamily.localDeletionTime);
-            dos.writeLong(columnFamily.markedForDeleteAt);
-
-            dos.writeInt(columns.size());
-            for ( IColumn column : columns )
-            {
-                columnFamily.getColumnSerializer().serialize(column, dos);
-            }
-        }
-
-        public ColumnFamily deserialize(DataInputStream dis) throws IOException
-        {
-            ColumnFamily cf = new ColumnFamily(dis.readUTF(),
-                                               dis.readUTF(),
-                                               readComparator(dis),
-                                               readComparator(dis));
-            cf.delete(dis.readInt(), dis.readLong());
-            int size = dis.readInt();
-            IColumn column;
-            for (int i = 0; i < size; ++i)
-            {
-                column = cf.getColumnSerializer().deserialize(dis);
-                cf.addColumn(column);
-            }
-            return cf;
-        }
-
-        private AbstractType readComparator(DataInputStream dis) throws IOException
-        {
-            String className = dis.readUTF();
-            if (className.equals(""))
-            {
-                return null;
-            }
-
-            try
-            {
-                return (AbstractType)Class.forName(className).getConstructor().newInstance();
-            }
-            catch (ClassNotFoundException e)
-            {
-                throw new RuntimeException("Unable to load comparator class '" + className + "'.  probably this means you have obsolete sstables lying around", e);
-            }
-            catch (Exception e)
-            {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-}
-
+/**
+ * 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.db;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Proxy;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.ConcurrentSkipListMap;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.log4j.Logger;
+
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.io.ICompactSerializer;
+import org.apache.cassandra.db.filter.QueryPath;
+import org.apache.cassandra.db.marshal.AbstractType;
+import org.apache.cassandra.db.marshal.MarshalException;
+import org.apache.cassandra.db.marshal.LongType;
+
+/**
+ * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
+ */
+public final class ColumnFamily
+{
+    /* The column serializer for this Column Family. Create based on config. */
+    private static ICompactSerializer<ColumnFamily> serializer_;
+    public static final short utfPrefix_ = 2;   
+
+    private static Logger logger_ = Logger.getLogger( ColumnFamily.class );
+    private static Map<String, String> columnTypes_ = new HashMap<String, String>();
+    private String type_;
+    private String table_;
+
+    static
+    {
+        serializer_ = new ColumnFamilySerializer();
+        /* TODO: These are the various column types. Hard coded for now. */
+        columnTypes_.put("Standard", "Standard");
+        columnTypes_.put("Super", "Super");
+    }
+
+    public static ICompactSerializer<ColumnFamily> serializer()
+    {
+        return serializer_;
+    }
+
+    /*
+     * This method returns the serializer whose methods are
+     * preprocessed by a dynamic proxy.
+    */
+    public static ICompactSerializer<ColumnFamily> serializerWithIndexes()
+    {
+        return (ICompactSerializer<ColumnFamily>)Proxy.newProxyInstance( ColumnFamily.class.getClassLoader(), new Class[]{ICompactSerializer.class}, new CompactSerializerInvocationHandler<ColumnFamily>(serializer_) );
+    }
+
+    public static String getColumnType(String key)
+    {
+    	if ( key == null )
+    		return columnTypes_.get("Standard");
+    	return columnTypes_.get(key);
+    }
+
+    public static ColumnFamily create(String tableName, String cfName)
+    {
+        String columnType = DatabaseDescriptor.getColumnFamilyType(tableName, cfName);
+        AbstractType comparator = DatabaseDescriptor.getComparator(tableName, cfName);
+        AbstractType subcolumnComparator = DatabaseDescriptor.getSubComparator(tableName, cfName);
+        return new ColumnFamily(cfName, columnType, comparator, subcolumnComparator);
+    }
+
+    private String name_;
+
+    private transient ICompactSerializer<IColumn> columnSerializer_;
+    private long markedForDeleteAt = Long.MIN_VALUE;
+    private int localDeletionTime = Integer.MIN_VALUE;
+    private AtomicInteger size_ = new AtomicInteger(0);
+    private ConcurrentSkipListMap<byte[], IColumn> columns_;
+
+    public ColumnFamily(String cfName, String columnType, AbstractType comparator, AbstractType subcolumnComparator)
+    {
+        name_ = cfName;
+        type_ = columnType;
+        columnSerializer_ = columnType.equals("Standard") ? Column.serializer() : SuperColumn.serializer(subcolumnComparator);
+        columns_ = new ConcurrentSkipListMap<byte[], IColumn>(comparator);
+    }
+
+    public ColumnFamily cloneMeShallow()
+    {
+        ColumnFamily cf = new ColumnFamily(name_, type_, getComparator(), getSubComparator());
+        cf.markedForDeleteAt = markedForDeleteAt;
+        cf.localDeletionTime = localDeletionTime;
+        return cf;
+    }
+
+    private AbstractType getSubComparator()
+    {
+        return (columnSerializer_ instanceof SuperColumnSerializer) ? ((SuperColumnSerializer)columnSerializer_).getComparator() : null;
+    }
+
+    ColumnFamily cloneMe()
+    {
+        ColumnFamily cf = cloneMeShallow();
+        cf.columns_ = columns_.clone();
+    	return cf;
+    }
+
+    public String name()
+    {
+        return name_;
+    }
+
+    /*
+     *  We need to go through each column
+     *  in the column family and resolve it before adding
+    */
+    void addColumns(ColumnFamily cf)
+    {
+        for (IColumn column : cf.getSortedColumns())
+        {
+            addColumn(column);
+        }
+    }
+
+    public ICompactSerializer<IColumn> getColumnSerializer()
+    {
+    	return columnSerializer_;
+    }
+
+    int getColumnCount()
+    {
+    	int count = 0;
+        if(!isSuper())
+        {
+            count = columns_.size();
+        }
+        else
+        {
+            for(IColumn column: columns_.values())
+            {
+                count += column.getObjectCount();
+            }
+        }
+    	return count;
+    }
+
+    public boolean isSuper()
+    {
+        return type_.equals("Super");
+    }
+
+    public void addColumn(QueryPath path, byte[] value, long timestamp)
+    {
+        addColumn(path, value, timestamp, false);
+    }
+
+    /** In most places the CF must be part of a QueryPath but here it is ignored. */
+    public void addColumn(QueryPath path, byte[] value, long timestamp, boolean deleted)
+	{
+        assert path.columnName != null : path;
+		IColumn column;
+        if (path.superColumnName == null)
+        {
+            try
+            {
+                getComparator().validate(path.columnName);
+            }
+            catch (Exception e)
+            {
+                throw new MarshalException("Invalid column name in " + path.columnFamilyName + " for " + getComparator().getClass().getName());
+            }
+            column = new Column(path.columnName, value, timestamp, deleted);
+        }
+        else
+        {
+            assert isSuper();
+            try
+            {
+                getComparator().validate(path.superColumnName);
+            }
+            catch (Exception e)
+            {
+                throw new MarshalException("Invalid supercolumn name in " + path.columnFamilyName + " for " + getComparator().getClass().getName());
+            }
+            column = new SuperColumn(path.superColumnName, getSubComparator());
+            column.addColumn(new Column(path.columnName, value, timestamp, deleted)); // checks subcolumn name
+        }
+		addColumn(column);
+    }
+
+    public void clear()
+    {
+    	columns_.clear();
+    	size_.set(0);
+    }
+
+    /*
+     * If we find an old column that has the same name
+     * the ask it to resolve itself else add the new column .
+    */
+    public void addColumn(IColumn column)
+    {
+        byte[] name = column.name();
+        IColumn oldColumn = columns_.get(name);
+        if (oldColumn != null)
+        {
+            if (oldColumn instanceof SuperColumn)
+            {
+                int oldSize = oldColumn.size();
+                ((SuperColumn) oldColumn).putColumn(column);
+                size_.addAndGet(oldColumn.size() - oldSize);
+            }
+            else
+            {
+                if (((Column)oldColumn).comparePriority((Column)column) <= 0)
+                {
+                    columns_.put(name, column);
+                    size_.addAndGet(column.size());
+                }
+            }
+        }
+        else
+        {
+            size_.addAndGet(column.size());
+            columns_.put(name, column);
+        }
+    }
+
+    public IColumn getColumn(byte[] name)
+    {
+        return columns_.get(name);
+    }
+
+    public SortedSet<byte[]> getColumnNames()
+    {
+        return columns_.keySet();
+    }
+
+    public Collection<IColumn> getSortedColumns()
+    {
+        return columns_.values();
+    }
+
+    public Map<byte[], IColumn> getColumnsMap()
+    {
+        return columns_;
+    }
+
+    public void remove(byte[] columnName)
+    {
+    	columns_.remove(columnName);
+    }
+
+    public void delete(int localtime, long timestamp)
+    {
+        localDeletionTime = localtime;
+        markedForDeleteAt = timestamp;
+    }
+
+    public void delete(ColumnFamily cf2)
+    {
+        delete(Math.max(getLocalDeletionTime(), cf2.getLocalDeletionTime()),
+               Math.max(getMarkedForDeleteAt(), cf2.getMarkedForDeleteAt()));
+    }
+
+    public boolean isMarkedForDelete()
+    {
+        return markedForDeleteAt > Long.MIN_VALUE;
+    }
+
+    /*
+     * This function will calculate the difference between 2 column families.
+     * The external input is assumed to be a superset of internal.
+     */
+    ColumnFamily diff(ColumnFamily cfComposite)
+    {
+    	ColumnFamily cfDiff = new ColumnFamily(cfComposite.name(), cfComposite.type_, getComparator(), getSubComparator());
+        if (cfComposite.getMarkedForDeleteAt() > getMarkedForDeleteAt())
+        {
+            cfDiff.delete(cfComposite.getLocalDeletionTime(), cfComposite.getMarkedForDeleteAt());
+        }
+
+        // (don't need to worry about cfNew containing IColumns that are shadowed by
+        // the delete tombstone, since cfNew was generated by CF.resolve, which
+        // takes care of those for us.)
+        Map<byte[], IColumn> columns = cfComposite.getColumnsMap();
+        Set<byte[]> cNames = columns.keySet();
+        for (byte[] cName : cNames)
+        {
+            IColumn columnInternal = columns_.get(cName);
+            IColumn columnExternal = columns.get(cName);
+            if (columnInternal == null)
+            {
+                cfDiff.addColumn(columnExternal);
+            }
+            else
+            {
+                IColumn columnDiff = columnInternal.diff(columnExternal);
+                if (columnDiff != null)
+                {
+                    cfDiff.addColumn(columnDiff);
+                }
+            }
+        }
+
+        if (!cfDiff.getColumnsMap().isEmpty() || cfDiff.isMarkedForDelete())
+        	return cfDiff;
+        else
+        	return null;
+    }
+
+    public AbstractType getComparator()
+    {
+        return (AbstractType)columns_.comparator();
+    }
+
+    int size()
+    {
+        if (size_.get() == 0)
+        {
+            for (IColumn column : columns_.values())
+            {
+                size_.addAndGet(column.size());
+            }
+        }
+        return size_.get();
+    }
+
+    public int hashCode()
+    {
+        return name().hashCode();
+    }
+
+    public boolean equals(Object o)
+    {
+        if ( !(o instanceof ColumnFamily) )
+            return false;
+        ColumnFamily cf = (ColumnFamily)o;
+        return name().equals(cf.name());
+    }
+
+    public String toString()
+    {
+    	StringBuilder sb = new StringBuilder();
+        sb.append("ColumnFamily(");
+    	sb.append(name_);
+
+        if (isMarkedForDelete()) {
+            sb.append(" -delete at " + getMarkedForDeleteAt() + "-");
+        }
+
+    	sb.append(" [");
+        sb.append(getComparator().getColumnsString(getSortedColumns()));
+        sb.append("])");
+
+    	return sb.toString();
+    }
+
+    public byte[] digest()
+    {
+        byte[] xorHash = ArrayUtils.EMPTY_BYTE_ARRAY;
+        for (IColumn column : columns_.values())
+        {
+            if (xorHash.length == 0)
+            {
+                xorHash = column.digest();
+            }
+            else
+            {
+                xorHash = FBUtilities.xor(xorHash, column.digest());
+            }
+        }
+        return xorHash;
+    }
+
+    public long getMarkedForDeleteAt()
+    {
+        return markedForDeleteAt;
+    }
+
+    public int getLocalDeletionTime()
+    {
+        return localDeletionTime;
+    }
+
+    public String type()
+    {
+        return type_;
+    }
+
+    /** merge all columnFamilies into a single instance, with only the newest versions of columns preserved. */
+    static ColumnFamily resolve(List<ColumnFamily> columnFamilies)
+    {
+        int size = columnFamilies.size();
+        if (size == 0)
+            return null;
+
+        // start from nothing so that we don't include potential deleted columns from the first instance
+        ColumnFamily cf0 = columnFamilies.get(0);
+        ColumnFamily cf = cf0.cloneMeShallow();
+
+        // merge
+        for (ColumnFamily cf2 : columnFamilies)
+        {
+            assert cf.name().equals(cf2.name());
+            cf.addColumns(cf2);
+            cf.delete(cf2);
+        }
+        return cf;
+    }
+
+    public static class ColumnFamilySerializer implements ICompactSerializer<ColumnFamily>
+    {
+        /*
+         * We are going to create indexes, and write out that information as well. The format
+         * of the data serialized is as follows.
+         *
+         * 1) Without indexes:
+         *  // written by the data
+         * 	<boolean false (index is not present)>
+         * 	<column family id>
+         * 	<is marked for delete>
+         * 	<total number of columns>
+         * 	<columns data>
+
+         * 	<boolean true (index is present)>
+         *
+         *  This part is written by the column indexer
+         * 	<size of index in bytes>
+         * 	<list of column names and their offsets relative to the first column>
+         *
+         *  <size of the cf in bytes>
+         * 	<column family id>
+         * 	<is marked for delete>
+         * 	<total number of columns>
+         * 	<columns data>
+        */
+        public void serialize(ColumnFamily columnFamily, DataOutputStream dos) throws IOException
+        {
+            // TODO whenever we change this we need to change the code in SequenceFile to match in two places.
+            // This SUCKS and is inefficient to boot.  let's fix this ASAP. 
+            Collection<IColumn> columns = columnFamily.getSortedColumns();
+
+            dos.writeUTF(columnFamily.name());
+            dos.writeUTF(columnFamily.type_);
+            dos.writeUTF(columnFamily.getComparator().getClass().getCanonicalName());
+            AbstractType subcolumnComparator = columnFamily.getSubComparator();
+            dos.writeUTF(subcolumnComparator == null ? "" : subcolumnComparator.getClass().getCanonicalName());
+            dos.writeInt(columnFamily.localDeletionTime);
+            dos.writeLong(columnFamily.markedForDeleteAt);
+
+            dos.writeInt(columns.size());
+            for ( IColumn column : columns )
+            {
+                columnFamily.getColumnSerializer().serialize(column, dos);
+            }
+        }
+
+        public ColumnFamily deserialize(DataInputStream dis) throws IOException
+        {
+            ColumnFamily cf = new ColumnFamily(dis.readUTF(),
+                                               dis.readUTF(),
+                                               readComparator(dis),
+                                               readComparator(dis));
+            cf.delete(dis.readInt(), dis.readLong());
+            int size = dis.readInt();
+            IColumn column;
+            for (int i = 0; i < size; ++i)
+            {
+                column = cf.getColumnSerializer().deserialize(dis);
+                cf.addColumn(column);
+            }
+            return cf;
+        }
+
+        private AbstractType readComparator(DataInputStream dis) throws IOException
+        {
+            String className = dis.readUTF();
+            if (className.equals(""))
+            {
+                return null;
+            }
+
+            try
+            {
+                return (AbstractType)Class.forName(className).getConstructor().newInstance();
+            }
+            catch (ClassNotFoundException e)
+            {
+                throw new RuntimeException("Unable to load comparator class '" + className + "'.  probably this means you have obsolete sstables lying around", e);
+            }
+            catch (Exception e)
+            {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+}
+

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyNotDefinedException.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyNotDefinedException.java?rev=799331&r1=799330&r2=799331&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyNotDefinedException.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyNotDefinedException.java Thu Jul 30 15:30:21 2009
@@ -1,34 +1,34 @@
-/**
- * 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.db;
-
-import org.apache.cassandra.service.InvalidRequestException;
-
-
-/**
- * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
- */
-
-public class ColumnFamilyNotDefinedException extends InvalidRequestException
-{
-    public ColumnFamilyNotDefinedException(String message)
-    {
-        super(message);
-    }
-}
+/**
+ * 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.db;
+
+import org.apache.cassandra.service.InvalidRequestException;
+
+
+/**
+ * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com )
+ */
+
+public class ColumnFamilyNotDefinedException extends InvalidRequestException
+{
+    public ColumnFamilyNotDefinedException(String message)
+    {
+        super(message);
+    }
+}