Java 类org.apache.cassandra.thrift.ITransportFactory 实例源码

项目:cassandra-kmean    文件:SettingsTransport.java   
public SettingsTransport(TOptions options)
{
    this.options = options;
    this.fqFactoryClass = options.factory.value();
    try
    {
        Class<?> clazz = Class.forName(fqFactoryClass);
        if (!ITransportFactory.class.isAssignableFrom(clazz))
            throw new IllegalArgumentException(clazz + " is not a valid transport factory");
        // check we can instantiate it
        clazz.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException("Invalid transport factory class: " + options.factory.value(), e);
    }
}
项目:cassandra-kmean    文件:SettingsTransport.java   
private void configureTransportFactory(ITransportFactory transportFactory, TOptions options)
{
    Map<String, String> factoryOptions = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        factoryOptions.put(SSLTransportFactory.CIPHER_SUITES, options.ciphers.value());
    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            factoryOptions.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(factoryOptions);
}
项目:cassandra-kmean    文件:SettingsTransport.java   
public synchronized ITransportFactory getFactory()
{
    if (factory == null)
    {
        try
        {
            this.factory = (ITransportFactory) Class.forName(fqFactoryClass).newInstance();
            configureTransportFactory(this.factory, this.options);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
    return factory;
}
项目:scylla-tools-java    文件:SettingsTransport.java   
public SettingsTransport(TOptions options)
{
    this.options = options;
    this.fqFactoryClass = options.factory.value();
    try
    {
        Class<?> clazz = Class.forName(fqFactoryClass);
        if (!ITransportFactory.class.isAssignableFrom(clazz))
            throw new IllegalArgumentException(clazz + " is not a valid transport factory");
        // check we can instantiate it
        clazz.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException("Invalid transport factory class: " + options.factory.value(), e);
    }
}
项目:scylla-tools-java    文件:SettingsTransport.java   
private void configureTransportFactory(ITransportFactory transportFactory, TOptions options)
{
    Map<String, String> factoryOptions = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE))
        factoryOptions.put(SSLTransportFactory.KEYSTORE, options.keyStore.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD))
        factoryOptions.put(SSLTransportFactory.KEYSTORE_PASSWORD, options.keyStorePw.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        factoryOptions.put(SSLTransportFactory.CIPHER_SUITES, options.ciphers.value());
    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            factoryOptions.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(factoryOptions);
}
项目:scylla-tools-java    文件:SettingsTransport.java   
public synchronized ITransportFactory getFactory()
{
    if (factory == null)
    {
        try
        {
            this.factory = (ITransportFactory) Class.forName(fqFactoryClass).newInstance();
            configureTransportFactory(this.factory, this.options);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
    return factory;
}
项目:GraphTrek    文件:SettingsTransport.java   
public SettingsTransport(TOptions options)
{
    this.options = options;
    this.fqFactoryClass = options.factory.value();
    try
    {
        Class<?> clazz = Class.forName(fqFactoryClass);
        if (!ITransportFactory.class.isAssignableFrom(clazz))
            throw new IllegalArgumentException(clazz + " is not a valid transport factory");
        // check we can instantiate it
        clazz.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException("Invalid transport factory class: " + options.factory.value(), e);
    }
}
项目:GraphTrek    文件:SettingsTransport.java   
private void configureTransportFactory(ITransportFactory transportFactory, TOptions options)
{
    Map<String, String> factoryOptions = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        factoryOptions.put(SSLTransportFactory.CIPHER_SUITES, options.ciphers.value());
    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            factoryOptions.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(factoryOptions);
}
项目:GraphTrek    文件:SettingsTransport.java   
public synchronized ITransportFactory getFactory()
{
    if (factory == null)
    {
        try
        {
            this.factory = (ITransportFactory) Class.forName(fqFactoryClass).newInstance();
            configureTransportFactory(this.factory, this.options);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
    return factory;
}
项目:stratio-cassandra    文件:SettingsTransport.java   
public SettingsTransport(TOptions options)
{
    this.options = options;
    this.fqFactoryClass = options.factory.value();
    try
    {
        Class<?> clazz = Class.forName(fqFactoryClass);
        if (!ITransportFactory.class.isAssignableFrom(clazz))
            throw new IllegalArgumentException(clazz + " is not a valid transport factory");
        // check we can instantiate it
        clazz.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException("Invalid transport factory class: " + options.factory.value(), e);
    }
}
项目:stratio-cassandra    文件:SettingsTransport.java   
private void configureTransportFactory(ITransportFactory transportFactory, TOptions options)
{
    Map<String, String> factoryOptions = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        factoryOptions.put(SSLTransportFactory.CIPHER_SUITES, options.ciphers.value());
    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            factoryOptions.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(factoryOptions);
}
项目:stratio-cassandra    文件:SettingsTransport.java   
public synchronized ITransportFactory getFactory()
{
    if (factory == null)
    {
        try
        {
            this.factory = (ITransportFactory) Class.forName(fqFactoryClass).newInstance();
            configureTransportFactory(this.factory, this.options);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
    return factory;
}
项目:cassandra-trunk    文件:SettingsTransport.java   
public SettingsTransport(TOptions options)
{
    this.options = options;
    this.fqFactoryClass = options.factory.value();
    try
    {
        Class<?> clazz = Class.forName(fqFactoryClass);
        if (!ITransportFactory.class.isAssignableFrom(clazz))
            throw new IllegalArgumentException(clazz + " is not a valid transport factory");
        // check we can instantiate it
        clazz.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException("Invalid transport factory class: " + options.factory.value(), e);
    }
}
项目:cassandra-trunk    文件:SettingsTransport.java   
private void configureTransportFactory(ITransportFactory transportFactory, TOptions options)
{
    Map<String, String> factoryOptions = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE, options.trustStore.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        factoryOptions.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, options.trustStorePw.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        factoryOptions.put(SSLTransportFactory.PROTOCOL, options.protocol.value());
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        factoryOptions.put(SSLTransportFactory.CIPHER_SUITES, options.ciphers.value());
    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            factoryOptions.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(factoryOptions);
}
项目:cassandra-trunk    文件:SettingsTransport.java   
public synchronized ITransportFactory getFactory()
{
    if (factory == null)
    {
        try
        {
            this.factory = (ITransportFactory) Class.forName(fqFactoryClass).newInstance();
            configureTransportFactory(this.factory, this.options);
        }
        catch (Exception e)
        {
            throw new RuntimeException(e);
        }
    }
    return factory;
}
项目:cassandra-kmean    文件:CliOptions.java   
private static ITransportFactory validateAndSetTransportFactory(String transportFactory)
{
    try
    {
        Class<?> factory = Class.forName(transportFactory);
        if (!ITransportFactory.class.isAssignableFrom(factory))
            throw new IllegalArgumentException(String.format("transport factory '%s' " +
                                                             "not derived from ITransportFactory", transportFactory));
        return (ITransportFactory) factory.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException(String.format("Cannot create a transport factory '%s'.", transportFactory), e);
    }
}
项目:cassandra-kmean    文件:CliOptions.java   
private static void configureTransportFactory(ITransportFactory transportFactory, EncryptionOptions encOptions)
{
    Map<String, String> options = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        options.put(SSLTransportFactory.TRUSTSTORE, encOptions.truststore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        options.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, encOptions.truststore_password);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        options.put(SSLTransportFactory.PROTOCOL, encOptions.protocol);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        options.put(SSLTransportFactory.CIPHER_SUITES, Joiner.on(',').join(encOptions.cipher_suites));

    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE, encOptions.keystore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE_PASSWORD, encOptions.keystore_password);

    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            options.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(options);
}
项目:ACaZoo    文件:CliOptions.java   
private static ITransportFactory validateAndSetTransportFactory(String transportFactory)
{
    try
    {
        Class<?> factory = Class.forName(transportFactory);
        if (!ITransportFactory.class.isAssignableFrom(factory))
            throw new IllegalArgumentException(String.format("transport factory '%s' " +
                                                             "not derived from ITransportFactory", transportFactory));
        return (ITransportFactory) factory.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException(String.format("Cannot create a transport factory '%s'.", transportFactory), e);
    }
}
项目:presto    文件:CassandraThriftConnectionFactory.java   
private ITransportFactory getClientTransportFactory(String factoryClassName)
{
    try {
        ITransportFactory factory = (ITransportFactory) Class.forName(factoryClassName).newInstance();
        Map<String, String> options = getOptions(factory.supportedOptions());
        factory.setOptions(options);
        return factory;
    }
    catch (Exception e) {
        throw new RuntimeException("Failed to instantiate transport factory:" + factoryClassName, e);
    }
}
项目:GraphTrek    文件:CliOptions.java   
private static ITransportFactory validateAndSetTransportFactory(String transportFactory)
{
    try
    {
        Class<?> factory = Class.forName(transportFactory);
        if (!ITransportFactory.class.isAssignableFrom(factory))
            throw new IllegalArgumentException(String.format("transport factory '%s' " +
                                                             "not derived from ITransportFactory", transportFactory));
        return (ITransportFactory) factory.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException(String.format("Cannot create a transport factory '%s'.", transportFactory), e);
    }
}
项目:GraphTrek    文件:CliOptions.java   
private static void configureTransportFactory(ITransportFactory transportFactory, EncryptionOptions encOptions)
{
    Map<String, String> options = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        options.put(SSLTransportFactory.TRUSTSTORE, encOptions.truststore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        options.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, encOptions.truststore_password);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        options.put(SSLTransportFactory.PROTOCOL, encOptions.protocol);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        options.put(SSLTransportFactory.CIPHER_SUITES, Joiner.on(',').join(encOptions.cipher_suites));

    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE, encOptions.keystore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE_PASSWORD, encOptions.keystore_password);

    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            options.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(options);
}
项目:stratio-cassandra    文件:CliOptions.java   
private static ITransportFactory validateAndSetTransportFactory(String transportFactory)
{
    try
    {
        Class<?> factory = Class.forName(transportFactory);
        if (!ITransportFactory.class.isAssignableFrom(factory))
            throw new IllegalArgumentException(String.format("transport factory '%s' " +
                                                             "not derived from ITransportFactory", transportFactory));
        return (ITransportFactory) factory.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException(String.format("Cannot create a transport factory '%s'.", transportFactory), e);
    }
}
项目:stratio-cassandra    文件:CliOptions.java   
private static void configureTransportFactory(ITransportFactory transportFactory, EncryptionOptions encOptions)
{
    Map<String, String> options = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        options.put(SSLTransportFactory.TRUSTSTORE, encOptions.truststore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        options.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, encOptions.truststore_password);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        options.put(SSLTransportFactory.PROTOCOL, encOptions.protocol);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        options.put(SSLTransportFactory.CIPHER_SUITES, Joiner.on(',').join(encOptions.cipher_suites));

    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE, encOptions.keystore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE_PASSWORD, encOptions.keystore_password);

    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            options.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(options);
}
项目:cassandra-cqlMod    文件:CliOptions.java   
private static ITransportFactory validateAndSetTransportFactory(String transportFactory)
{
    try
    {
        Class<?> factory = Class.forName(transportFactory);
        if (!ITransportFactory.class.isAssignableFrom(factory))
            throw new IllegalArgumentException(String.format("transport factory '%s' " +
                                                             "not derived from ITransportFactory", transportFactory));
        return (ITransportFactory) factory.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException(String.format("Cannot create a transport factory '%s'.", transportFactory), e);
    }
}
项目:cassandra-trunk    文件:CliOptions.java   
private static ITransportFactory validateAndSetTransportFactory(String transportFactory)
{
    try
    {
        Class<?> factory = Class.forName(transportFactory);
        if (!ITransportFactory.class.isAssignableFrom(factory))
            throw new IllegalArgumentException(String.format("transport factory '%s' " +
                                                             "not derived from ITransportFactory", transportFactory));
        return (ITransportFactory) factory.newInstance();
    }
    catch (Exception e)
    {
        throw new IllegalArgumentException(String.format("Cannot create a transport factory '%s'.", transportFactory), e);
    }
}
项目:cassandra-trunk    文件:CliOptions.java   
private static void configureTransportFactory(ITransportFactory transportFactory, EncryptionOptions encOptions)
{
    Map<String, String> options = new HashMap<>();
    // If the supplied factory supports the same set of options as our SSL impl, set those
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE))
        options.put(SSLTransportFactory.TRUSTSTORE, encOptions.truststore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.TRUSTSTORE_PASSWORD))
        options.put(SSLTransportFactory.TRUSTSTORE_PASSWORD, encOptions.truststore_password);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.PROTOCOL))
        options.put(SSLTransportFactory.PROTOCOL, encOptions.protocol);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.CIPHER_SUITES))
        options.put(SSLTransportFactory.CIPHER_SUITES, Joiner.on(',').join(encOptions.cipher_suites));

    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE, encOptions.keystore);
    if (transportFactory.supportedOptions().contains(SSLTransportFactory.KEYSTORE_PASSWORD)
            && encOptions.require_client_auth)
        options.put(SSLTransportFactory.KEYSTORE_PASSWORD, encOptions.keystore_password);

    // Now check if any of the factory's supported options are set as system properties
    for (String optionKey : transportFactory.supportedOptions())
        if (System.getProperty(optionKey) != null)
            options.put(optionKey, System.getProperty(optionKey));

    transportFactory.setOptions(options);
}
项目:hive-cassandra    文件:ConfigHelper.java   
public static ITransportFactory getClientTransportFactory(Configuration conf) {
    String factoryClassName = conf.get(
            ITransportFactory.PROPERTY_KEY,
            TFramedTransportFactory.class.getName());
    ITransportFactory factory = getClientTransportFactory(factoryClassName);
    Map<String, String> options = getOptions(conf, factory.supportedOptions());
    factory.setOptions(options);
    return factory;
}
项目:hive-cassandra    文件:ConfigHelper.java   
private static ITransportFactory getClientTransportFactory(String factoryClassName) {
    try {
        return (ITransportFactory) Class.forName(factoryClassName).newInstance();
    } catch (Exception e) {
        throw new RuntimeException("Failed to instantiate transport factory:" + factoryClassName, e);
    }
}