Updated Branches: refs/heads/trunk 841f19c7a -> f593717ac
Fix for IDE alert on SSLTransportFactory patch by Vijay; reviewed by Jason Brown for CASSANDRA-4239 Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f593717a Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f593717a Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f593717a Branch: refs/heads/trunk Commit: f593717ace884befa16e6753942c3f734c88f379 Parents: 841f19c Author: Vijay Parthasarathy <[email protected]> Authored: Thu Oct 25 22:35:24 2012 -0700 Committer: Vijay Parthasarathy <[email protected]> Committed: Thu Oct 25 22:35:24 2012 -0700 ---------------------------------------------------------------------- .../cli/transport/SSLTransportFactory.java | 47 --------------- .../cassandra/stress/SSLTransportFactory.java | 45 ++++++++++++++ .../src/org/apache/cassandra/stress/Session.java | 2 +- 3 files changed, 46 insertions(+), 48 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/f593717a/tools/stress/src/org/apache/cassandra/cli/transport/SSLTransportFactory.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/cli/transport/SSLTransportFactory.java b/tools/stress/src/org/apache/cassandra/cli/transport/SSLTransportFactory.java deleted file mode 100644 index 6cc1554..0000000 --- a/tools/stress/src/org/apache/cassandra/cli/transport/SSLTransportFactory.java +++ /dev/null @@ -1,47 +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.cassandra.cli.transport.FramedTransportFactory; -import org.apache.cassandra.stress.Session; -import org.apache.cassandra.stress.Stress; -import org.apache.thrift.transport.TSSLTransportFactory; -import org.apache.thrift.transport.TSSLTransportFactory.TSSLTransportParameters; -import org.apache.thrift.transport.TTransport; -import org.apache.thrift.transport.TTransportException; -import org.apache.thrift.transport.TTransportFactory; - -public class SSLTransportFactory extends TTransportFactory -{ - public TTransport getTransport(TTransport trans) - { - final Session session = Stress.session; - try - { - String hostName = session.nodes[Stress.randomizer.nextInt(session.nodes.length)]; - TSSLTransportParameters params = new TSSLTransportParameters(session.encOptions.protocol, session.encOptions.cipher_suites); - params.setTrustStore(session.encOptions.truststore, session.encOptions.truststore_password); - trans = TSSLTransportFactory.getClientSocket(hostName, session.port, 0, params); - return new FramedTransportFactory().getTransport(trans); - } - catch (TTransportException e) - { - throw new RuntimeException("Failed to create a client SSL connection.", e); - } - } -} http://git-wip-us.apache.org/repos/asf/cassandra/blob/f593717a/tools/stress/src/org/apache/cassandra/stress/SSLTransportFactory.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/SSLTransportFactory.java b/tools/stress/src/org/apache/cassandra/stress/SSLTransportFactory.java new file mode 100644 index 0000000..8fd4006 --- /dev/null +++ b/tools/stress/src/org/apache/cassandra/stress/SSLTransportFactory.java @@ -0,0 +1,45 @@ +/** + * 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.stress; + +import org.apache.cassandra.cli.transport.FramedTransportFactory; +import org.apache.thrift.transport.TSSLTransportFactory; +import org.apache.thrift.transport.TSSLTransportFactory.TSSLTransportParameters; +import org.apache.thrift.transport.TTransport; +import org.apache.thrift.transport.TTransportException; +import org.apache.thrift.transport.TTransportFactory; + +public class SSLTransportFactory extends TTransportFactory +{ + public TTransport getTransport(TTransport trans) + { + final Session session = Stress.session; + try + { + String hostName = session.nodes[Stress.randomizer.nextInt(session.nodes.length)]; + TSSLTransportParameters params = new TSSLTransportParameters(session.encOptions.protocol, session.encOptions.cipher_suites); + params.setTrustStore(session.encOptions.truststore, session.encOptions.truststore_password); + trans = TSSLTransportFactory.getClientSocket(hostName, session.port, 0, params); + return new FramedTransportFactory().getTransport(trans); + } + catch (TTransportException e) + { + throw new RuntimeException("Failed to create a client SSL connection.", e); + } + } +} http://git-wip-us.apache.org/repos/asf/cassandra/blob/f593717a/tools/stress/src/org/apache/cassandra/stress/Session.java ---------------------------------------------------------------------- diff --git a/tools/stress/src/org/apache/cassandra/stress/Session.java b/tools/stress/src/org/apache/cassandra/stress/Session.java index dc585ba..8b6914c 100644 --- a/tools/stress/src/org/apache/cassandra/stress/Session.java +++ b/tools/stress/src/org/apache/cassandra/stress/Session.java @@ -104,7 +104,7 @@ public class Session implements Serializable availableOptions.addOption("Q", "query-names", true, "Comma-separated list of column names to retrieve from each row."); availableOptions.addOption("Z", "compaction-strategy", true, "CompactionStrategy to use."); availableOptions.addOption("U", "comparator", true, "Column Comparator to use. Currently supported types are: TimeUUIDType, AsciiType, UTF8Type."); - availableOptions.addOption("tf", "transport-factory", true, "Fully qualified class name for creating a thrift connection"); + availableOptions.addOption("tf", "transport-factory", true, "Fully-qualified TTransportFactory class name for creating a connection. Note: For Thrift over SSL, use org.apache.cassandra.stress.SSLTransportFactory."); availableOptions.addOption("ts", SSL_TRUSTSTORE, true, "SSL: full path to truststore"); availableOptions.addOption("tspw", SSL_TRUSTSTORE_PW, true, "SSL: full path to truststore"); availableOptions.addOption("prtcl", SSL_PROTOCOL, true, "SSL: connections protocol to use (default: TLS)");
