cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/2] git commit: revert #4609 / 59a6a5d82dc088dac8f1d98bc48a6426d75dc1a2
Date Tue, 09 Oct 2012 14:37:57 GMT
Updated Branches:
  refs/heads/cassandra-1.1 0d1249372 -> 488f83466


revert #4609 / 59a6a5d82dc088dac8f1d98bc48a6426d75dc1a2


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/488f8346
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/488f8346
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/488f8346

Branch: refs/heads/cassandra-1.1
Commit: 488f83466c6e30b5f432ebe496d6db0c8986634c
Parents: f0fcc4c
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Tue Oct 9 09:37:23 2012 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Tue Oct 9 09:37:23 2012 -0500

----------------------------------------------------------------------
 CHANGES.txt                                        |    1 -
 src/java/org/apache/cassandra/cli/CliMain.java     |   14 +++++-
 src/java/org/apache/cassandra/cli/CliOptions.java  |   28 -------------
 .../org/apache/cassandra/cli/CliSessionState.java  |    8 +---
 .../cli/transport/FramedTransportFactory.java      |   30 --------------
 .../cli/transport/SimpleTransportFactory.java      |   32 ---------------
 6 files changed, 13 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/488f8346/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 06e87ac..018646e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -19,7 +19,6 @@
  * add authentication support to sstableloader (CASSANDRA-4712)
  * Fix CQL3 'is reversed' logic (CASSANDRA-4716, 4759)
  * (CQL3) Don't return ReversedType in result set metadata (CASSANDRA-4717)
- * Pluggable Thrift transport factories for CLI (CASSANDRA-4609)
  * Backport adding AlterKeyspace statement (CASSANDRA-4611)
  * (CQL3) Correcty accept upper-case data types (CASSANDRA-4770)
 Merged from 1.0:

http://git-wip-us.apache.org/repos/asf/cassandra/blob/488f8346/src/java/org/apache/cassandra/cli/CliMain.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliMain.java b/src/java/org/apache/cassandra/cli/CliMain.java
index 9baf676..2d900ba 100644
--- a/src/java/org/apache/cassandra/cli/CliMain.java
+++ b/src/java/org/apache/cassandra/cli/CliMain.java
@@ -31,6 +31,7 @@ import org.apache.cassandra.auth.IAuthenticator;
 import org.apache.cassandra.thrift.*;
 import org.apache.thrift.TException;
 import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.transport.TFramedTransport;
 import org.apache.thrift.transport.TSocket;
 import org.apache.thrift.transport.TTransport;
 
@@ -61,14 +62,21 @@ public class CliMain
         if (transport != null)
             transport.close();
 
-        transport = sessionState.transportFactory.getTransport(socket);
+        if (sessionState.framed)
+        {
+            transport = new TFramedTransport(socket);
+        }
+        else
+        {
+            transport = socket;
+        }
+
         TBinaryProtocol binaryProtocol = new TBinaryProtocol(transport, true, true);
         Cassandra.Client cassandraClient = new Cassandra.Client(binaryProtocol);
 
         try
         {
-            if (!transport.isOpen())
-                transport.open();
+            transport.open();
         }
         catch (Exception e)
         {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/488f8346/src/java/org/apache/cassandra/cli/CliOptions.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliOptions.java b/src/java/org/apache/cassandra/cli/CliOptions.java
index 982daf5..c582728 100644
--- a/src/java/org/apache/cassandra/cli/CliOptions.java
+++ b/src/java/org/apache/cassandra/cli/CliOptions.java
@@ -17,9 +17,7 @@
  */
 package org.apache.cassandra.cli;
 
-import org.apache.cassandra.cli.transport.SimpleTransportFactory;
 import org.apache.commons.cli.*;
-import org.apache.thrift.transport.TTransportFactory;
 
 /**
  *
@@ -37,7 +35,6 @@ public class CliOptions
     private static final String HOST_OPTION = "host";
     private static final String PORT_OPTION = "port";
     private static final String UNFRAME_OPTION = "unframed";
-    private static final String TRANSPORT_FACTORY = "transport-factory";
     private static final String DEBUG_OPTION = "debug";
     private static final String USERNAME_OPTION = "username";
     private static final String PASSWORD_OPTION = "password";
@@ -67,7 +64,6 @@ public class CliOptions
         options.addOption("f",  FILE_OPTION,     "FILENAME", "load statements from the specific
file");
         options.addOption(null, JMX_PORT_OPTION, "JMX-PORT", "JMX service port");
         options.addOption(null, SCHEMA_MIGRATION_WAIT_TIME,  "TIME", "Schema migration wait
time (secs.), default is 10 secs");
-        options.addOption("tf", TRANSPORT_FACTORY, "TRANSPORT-FACTORY", "Fully-qualified
TTransportFactory class name for creating a connection to cassandra");
 
         // options without argument
         options.addOption("B",  BATCH_OPTION,   "enabled batch mode (suppress output; errors
are fatal)");
@@ -102,16 +98,9 @@ public class CliOptions
             // Look to see if frame has been specified
             if (cmd.hasOption(UNFRAME_OPTION))
             {
-                if (cmd.hasOption(TRANSPORT_FACTORY))
-                    throw new IllegalArgumentException("--unframed and --transport-factory
options should not be fixed.");
-
                 css.framed = false;
-                css.transportFactory = new SimpleTransportFactory();
             }
 
-            if (cmd.hasOption(TRANSPORT_FACTORY))
-                css.transportFactory = validateAndSetTransportFactory(cmd.getOptionValue(TRANSPORT_FACTORY));
-
             // Look to see if frame has been specified
             if (cmd.hasOption(DEBUG_OPTION))
             {
@@ -233,21 +222,4 @@ public class CliOptions
         }
     }
 
-    private static TTransportFactory validateAndSetTransportFactory(String transportFactory)
-    {
-        try
-        {
-            Class factory = Class.forName(transportFactory);
-
-            if(!TTransportFactory.class.isAssignableFrom(factory))
-                throw new IllegalArgumentException(String.format("transport factory '%s'
" +
-                                                                 "not derived from TTransportFactory",
transportFactory));
-
-            return (TTransportFactory) factory.newInstance();
-        }
-        catch (Exception e)
-        {
-            throw new IllegalArgumentException(String.format("Cannot create a transport factory
'%s'.", transportFactory), e);
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/488f8346/src/java/org/apache/cassandra/cli/CliSessionState.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/CliSessionState.java b/src/java/org/apache/cassandra/cli/CliSessionState.java
index 0284239..9f956fd 100644
--- a/src/java/org/apache/cassandra/cli/CliSessionState.java
+++ b/src/java/org/apache/cassandra/cli/CliSessionState.java
@@ -18,13 +18,11 @@
 
 package org.apache.cassandra.cli;
 
+import org.apache.cassandra.tools.NodeProbe;
+
 import java.io.InputStream;
 import java.io.PrintStream;
 
-import org.apache.cassandra.cli.transport.FramedTransportFactory;
-import org.apache.cassandra.tools.NodeProbe;
-import org.apache.thrift.transport.TTransportFactory;
-
 /**
  * Used to hold the state for the CLI.
  */
@@ -43,8 +41,6 @@ public class CliSessionState
     public int     jmxPort = 7199;// JMX service port
     public boolean verbose = false; // verbose output
     public int     schema_mwt = 10 * 1000;    // Schema migration wait time (secs.)
-    public TTransportFactory transportFactory = new FramedTransportFactory();
-
     /*
      * Streams to read/write from
      */

http://git-wip-us.apache.org/repos/asf/cassandra/blob/488f8346/src/java/org/apache/cassandra/cli/transport/FramedTransportFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/transport/FramedTransportFactory.java b/src/java/org/apache/cassandra/cli/transport/FramedTransportFactory.java
deleted file mode 100644
index ffe7b00..0000000
--- a/src/java/org/apache/cassandra/cli/transport/FramedTransportFactory.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.cli.transport;
-
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportFactory;
-
-public class FramedTransportFactory extends TTransportFactory
-{
-    public TTransport getTransport(TTransport base)
-    {
-        return new TFramedTransport(base);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/488f8346/src/java/org/apache/cassandra/cli/transport/SimpleTransportFactory.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/cli/transport/SimpleTransportFactory.java b/src/java/org/apache/cassandra/cli/transport/SimpleTransportFactory.java
deleted file mode 100644
index 8b46646..0000000
--- a/src/java/org/apache/cassandra/cli/transport/SimpleTransportFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.cli.transport;
-
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportFactory;
-
-/**
- * Almost a noop factory, getTransport() method returns back the argument
- */
-public class SimpleTransportFactory extends TTransportFactory
-{
-    public TTransport getTransport(TTransport transport)
-    {
-        return transport;
-    }
-}


Mime
View raw message