@@ -0,0 +1,3765 @@
+/*%0A * Licensed to the Apache Software Foundation (ASF) under one%0A * or more contributor license agreements.  See the NOTICE file%0A * distributed with this work for additional information%0A * regarding copyright ownership.  The ASF licenses this file%0A * to you under the Apache License, Version 2.0 (the%0A * %22License%22); you may not use this file except in compliance%0A * with the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.apache.cassandra.thrift;%0A%0Aimport com.google.common.collect.Sets;%0Aimport org.apache.cassandra.cli.transport.FramedTransportFactory;%0Aimport org.apache.thrift.transport.TSSLTransportFactory;%0Aimport org.apache.thrift.transport.TTransport;%0Aimport org.apache.thrift.transport.TTransportException;%0A%0Aimport java.util.Map;%0Aimport java.util.Set;%0A%0Apublic class SSLTransportFactory implements ITransportFactory%0A%7B%0A    public static final String TRUSTSTORE = %22enc.truststore%22;%0A    public static final String TRUSTSTORE_PASSWORD = %22enc.truststore.password%22;%0A    public static final String KEYSTORE = %22enc.keystore%22;%0A    public static final String KEYSTORE_PASSWORD = %22enc.keystore.password%22;%0A    public static final String PROTOCOL = %22enc.protocol%22;%0A    public static final String CIPHER_SUITES = %22enc.cipher.suites%22;%0A    public static final int SOCKET_TIMEOUT = 0;%0A%0A    private static final Set%3CString%3E SUPPORTED_OPTIONS = Sets.newHashSet(TRUSTSTORE,%0A                                                                         TRUSTSTORE_PASSWORD,%0A                                                                         KEYSTORE,%0A                                                                         KEYSTORE_PASSWORD,%0A                                                                         PROTOCOL,%0A                                                                         CIPHER_SUITES);%0A%0A    private String truststore;%0A    private String truststorePassword;%0A    private String keystore;%0A    private String keystorePassword;%0A    private String protocol;%0A    private String%5B%5D cipherSuites;%0A%0A    @Override%0A    public TTransport openTransport(String host, int port) throws Exception%0A    %7B%0A        TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters(protocol, cipherSuites);%0A        params.setTrustStore(truststore, truststorePassword);%0A        if (null != keystore)%0A            params.setKeyStore(keystore, keystorePassword);%0A        TTransport trans = TSSLTransportFactory.getClientSocket(host, port, SOCKET_TIMEOUT, params);%0A        return new FramedTransportFactory().getTransport(trans);%0A    %7D%0A%0A    @Override%0A    public void setOptions(Map%3CString, String%3E options)%0A    %7B%0A        if (options.containsKey(TRUSTSTORE))%0A            truststore = options.get(TRUSTSTORE);%0A        if (options.containsKey(TRUSTSTORE_PASSWORD))%0A            truststorePassword = options.get(TRUSTSTORE_PASSWORD);%0A        if (options.containsKey(KEYSTORE))%0A            keystore = options.get(KEYSTORE);%0A        if (options.containsKey(KEYSTORE_PASSWORD))%0A            keystorePassword = options.get(KEYSTORE_PASSWORD);%0A        if (options.containsKey(PROTOCOL))%0A            protocol = options.get(PROTOCOL);%0A        if (options.containsKey(CIPHER_SUITES))%0A            cipherSuites = options.get(CIPHER_SUITES).split(%22,%22);%0A    %7D%0A%0A    @Override%0A    public Set%3CString%3E supportedOptions()%0A    %7B%0A        return SUPPORTED_OPTIONS;%0A    %7D%0A%7D%0A

add SSLTransportFactory.java