当前位置: 首页>>代码示例>>Java>>正文


Java ConnectorClusterConfig类代码示例

本文整理汇总了Java中com.stratio.crossdata.common.connector.ConnectorClusterConfig的典型用法代码示例。如果您正苦于以下问题:Java ConnectorClusterConfig类的具体用法?Java ConnectorClusterConfig怎么用?Java ConnectorClusterConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConnectorClusterConfig类属于com.stratio.crossdata.common.connector包,在下文中一共展示了ConnectorClusterConfig类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: connect

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
@Override public void connect(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
    try {
        synchronized (LOCK) {
            if (!managers.containsKey(config.getName())) {
                String host = "127.0.0.1";
                if (config.getClusterOptions() != null && config.getClusterOptions().containsKey("host")) {
                    host = config.getClusterOptions().get("host");
                }
                String login = "xdbot";
                if (config.getConnectorOptions() != null && config.getConnectorOptions().containsKey("name")) {
                    login = config.getConnectorOptions().get("name");
                }
                LOG.info("host: " + host + " login: " + login);
                IRCManager manager = new IRCManager(host, login);
                try {
                    manager.connect();
                    managers.put(config.getName(), manager);
                } catch (Exception e) {
                    throw new ConnectionException(e);
                }
            }
        }
    }catch (Exception ex){
        ex.printStackTrace();
    }
}
 
开发者ID:aagea,项目名称:crossdata-connector-irc,代码行数:27,代码来源:IRCConnector.java

示例2: connect

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Connect with the config expecified associate to a clusterName {ConnectionHandler}
 * {@link com.stratio.connector.deep.connection.DeepConnectionHandler.createNativeConnection}.
 * 
 * @param credentials
 * @param config
 *            {@link com.stratio.crossdata.common.connector.ConnectorClusterConfig}
 */
@Override
public void connect(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {

	String extractorImplClassName = deepConfigurationBuilder.getImplementationClass(config.getDataStoreName().getName());

	config.getClusterOptions().put(DeepConnectorConstants.EXTRACTOR_IMPL_CLASS, extractorImplClassName);

       if (extractorImplClassName != null && extractorImplClassName.equals(ExtractorConstants.HDFS)) {
		config.getClusterOptions().put(
				ExtractorConstants.FS_FILE_PATH,
                   deepConfigurationBuilder.getHDFSFilePath());
	}

	connectionHandler.createConnection(credentials, config);

}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:25,代码来源:DeepConnector.java

示例3: prepareConfiguration

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Create the configuration object to config the connector cluster information
 *
 * @return Cluster configuration object
 */
public static ConnectorClusterConfig prepareConfiguration() {

    Map<String, String> options = new HashMap<>();
    options.put(ExtractorConstants.HOST, HOST);
    options.put(ExtractorConstants.HOSTS, HOST);
    options.put(ExtractorConstants.PORTS, PORT);
    options.put(ExtractorConstants.INNERCLASS, HDFS);

    options.put(ExtractorConstants.FS_FILE_SEPARATOR, ",");
    options.put(ExtractorConstants.FS_FILE_PATH, "/");

    // options.put(ExtractorConstants.FS_SCHEMA,"[id:java.lang.String,author:java.lang.String," +
    // "title:java.lang.String,year:java.lang.Integer,length:java.lang.Integer,single:java.lang.String]");
    options.put(ExtractorConstants.TYPE, ExtractorConstants.HDFS_TYPE);
    options.put(ExtractorConstants.TABLE, "songs");
    options.put(ExtractorConstants.CATALOG, "test");
    options.put(ExtractorConstants.HDFS_FILE_EXTENSION, ".csv");
    Map<String, String> connectorOptions = new HashMap<>();
    connectorOptions.put(DeepConnectorConstants.PROPERTY_DEFAULT_LIMIT,
                    String.valueOf(DeepConnectorConstants.DEFAULT_RESULT_SIZE));
    ConnectorClusterConfig configuration = new ConnectorClusterConfig(CLUSTERNAME_CONSTANT, connectorOptions,
                    options);
    configuration.setDataStoreName(new DataStoreName("hdfs"));
    return configuration;
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:31,代码来源:HDFSConnectionConfigurationBuilder.java

示例4: prepareConfiguration

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Create the configuration object to config the connector cluster information
 *
 * @return Cluster configuration object
 */
public static ConnectorClusterConfig prepareConfiguration() {

    Map<String, String> options = new HashMap<>();
    options.put(ExtractorConstants.HOST, HOST);
    options.put(ExtractorConstants.PORT, PORT);
    options.put(ExtractorConstants.PORT, PORT);
    options.put(ExtractorConstants.INNERCLASS, ES_CELL_CLASS);
    Map<String, String> connectorOptions = new HashMap<>();
    connectorOptions.put(DeepConnectorConstants.PROPERTY_DEFAULT_LIMIT,
                    String.valueOf(DeepConnectorConstants.DEFAULT_RESULT_SIZE));
    ConnectorClusterConfig configuration = new ConnectorClusterConfig(CLUSTERNAME_CONSTANT, connectorOptions,
                    options);
    configuration.setDataStoreName(new DataStoreName("elasticsearch"));
    return configuration;
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:21,代码来源:ESConnectionConfigurationBuilder.java

示例5: prepareConfiguration

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Create the configuration object to config the connector cluster information
 * 
 * @return Cluster configuration object
 */
public static ConnectorClusterConfig prepareConfiguration() {

    Map<String, String> options = new HashMap<>();
    options.put(ExtractorConstants.HOST, HOST);
    options.put(ExtractorConstants.PORT, CQLPORT);
    options.put(ExtractorConstants.RPCPORT, RPCPORT);
    options.put(ExtractorConstants.INNERCLASS, CASSANDRA_CELL_CLASS);
    Map<String, String> connectorOptions = new HashMap<>();
    connectorOptions.put(DeepConnectorConstants.PROPERTY_DEFAULT_LIMIT,
                    String.valueOf(DeepConnectorConstants.DEFAULT_RESULT_SIZE));
    ConnectorClusterConfig configuration = new ConnectorClusterConfig(CLUSTERNAME_CONSTANT, connectorOptions,
                    options);
    configuration.setDataStoreName(new DataStoreName("cassandra"));
    return configuration;
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:21,代码来源:CassandraConnectionConfigurationBuilder.java

示例6: testConnect

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Establish the connection with DeepSparkContext in order to be able to retrieve metadata from the system columns
 * with the connection config.
 * 
 * @param
 * @return Whether the connection has been established or not.
 */

@Test
public void testConnect() throws Exception {

    ICredentials iCredentials = mock(ICredentials.class);
    ClusterName clusterName = new ClusterName(CLUSTER_NAME);
    Map<String, String> options = new HashMap<>();
    ConnectorClusterConfig config = new ConnectorClusterConfig(clusterName, options, options);
    config.setDataStoreName(new DataStoreName(DATASTORE_NAME));

    DeepConnectionHandler connectionHandler = mock(DeepConnectionHandler.class);
    Whitebox.setInternalState(deepConnector, "connectionHandler", connectionHandler);

    deepConnector.connect(iCredentials, config);

    verify(connectionHandler, times(1)).createConnection(iCredentials, config);
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:25,代码来源:DeepContextConnectorTest.java

示例7: testClose

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
@Test
public void testClose() throws ConnectionException, ExecutionException {

    ICredentials iCredentials = mock(ICredentials.class);
    ClusterName clusterName = new ClusterName(CLUSTER_NAME);

    Map<String, String> options = new HashMap<>();
    ConnectorClusterConfig config = new ConnectorClusterConfig(clusterName, options, options);
    config.setDataStoreName(new DataStoreName(DATASTORE_NAME));
    DeepConnectionHandler connectionHandler = mock(DeepConnectionHandler.class);
    Whitebox.setInternalState(deepConnector, "connectionHandler", connectionHandler);

    deepConnector.connect(iCredentials, config);

    connectionHandler.closeConnection(clusterName.getName());

    DeepConnection conn = (DeepConnection) connectionHandler.getConnection(clusterName.getName());
    assertNull(conn);

}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:21,代码来源:DeepContextConnectorTest.java

示例8: DeepConnection

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Constructor using credentials and cluster config.
 *
 * @param credentials
 *            the credentials.
 * @param config
 *            The cluster configuration.
 */
public DeepConnection(ICredentials credentials, ConnectorClusterConfig config)
		throws ConnectionException {

	if (credentials != null) {
		// TODO check the credentials
	}

	Map<String, String> clusterOptions = config.getClusterOptions();
	Map<String, String> connectorOptions = config.getConnectorOptions();
	// Creating a configuration for the Extractor and initialize it
	ExtractorConfig<Cells> extractorconfig = new ExtractorConfig<>(Cells.class);
	String extractorImplClassName = clusterOptions.get(DeepConnectorConstants.EXTRACTOR_IMPL_CLASS);

	if (extractorImplClassName == null) {
		throw new ConnectionException("Unknown data source, please add it to the configuration.");
	}
	Map<String,Serializable> values = returnConfig(clusterOptions);
	values.put(DeepConnectorConstants.PROPERTY_DEFAULT_LIMIT,connectorOptions.get(DeepConnectorConstants
			.PROPERTY_DEFAULT_LIMIT));
	extractorconfig.setValues(values);

	extractorconfig.setExtractorImplClassName(extractorImplClassName);

	this.extractorConfig = extractorconfig;

	this.isConnect = true;
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:36,代码来源:DeepConnection.java

示例9: prepareConfiguration

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Create the configuration object to config the connector cluster information
 * 
 * @return Cluster configuration object
 */
public static ConnectorClusterConfig prepareConfiguration() {

    Map<String, String> options = new HashMap<>();
    options.put(ExtractorConstants.HOST, HOST);
    options.put(ExtractorConstants.PORT, PORT);
    options.put(ExtractorConstants.INNERCLASS, MONGO_CELL_CLASS);
    Map<String, String> connectorOptions = new HashMap<>();
    connectorOptions.put(DeepConnectorConstants.PROPERTY_DEFAULT_LIMIT,
                    String.valueOf(DeepConnectorConstants.DEFAULT_RESULT_SIZE));
    ConnectorClusterConfig configuration = new ConnectorClusterConfig(CLUSTERNAME_CONSTANT, connectorOptions,
                    options);
    configuration.setDataStoreName(new DataStoreName("mongo"));
    return configuration;
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:20,代码来源:MongoConnectionConfigurationBuilder.java

示例10: testCreateConnection

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Method: createConnection(String clusterName, Connection connection)
 */
@Test
public void testCreateConnection() throws Exception {

    ICredentials credentials = mock(ICredentials.class);
    Map<String, String> options = new HashMap<>();
    options.put(ExtractorConstants.HOST, "127.0.0.1");
    options.put(ExtractorConstants.HOSTS, "127.0.0.1 , 127.0.0.2");
    options.put(ExtractorConstants.PORT, "PORT");
    options.put(DeepConnectorConstants.EXTRACTOR_IMPL_CLASS, "PORT");

    ConnectorClusterConfig config = new ConnectorClusterConfig(new ClusterName(CLUSTER_NAME), options, options);
    config.setDataStoreName(new DataStoreName("cassandra"));

    DeepConnection connection = mock(DeepConnection.class);
    whenNew(DeepConnection.class).withArguments(credentials, config).thenReturn(connection);

    connectionHandler.createConnection(credentials, config);

    Map<String, DeepConnection> mapConnection = (Map<String, DeepConnection>) Whitebox.getInternalState(
            connectionHandler, "connections");

    DeepConnection recoveredConnection = mapConnection.get(CLUSTER_NAME);

    assertNotNull("The connection is not null", recoveredConnection);
    // assertEquals("The recoveredConnection is correct", connection, recoveredConnection);
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:30,代码来源:ConnectionHandlerTest.java

示例11: prepareConfiguration

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Create the configuration object to config the connector cluster information
 * 
 * @return Cluster configuration object
 */
public static ConnectorClusterConfig prepareConfiguration() {

    Map<String, String> options = new HashMap<>();
    options.put(ExtractorConstants.HOST, HOST);
    options.put(ExtractorConstants.PORT, PORT);
    options.put(ExtractorConstants.INNERCLASS, AEROSPIKE_CELL_CLASS);
    Map<String, String> connectorOptions = new HashMap<>();
    connectorOptions.put(DeepConnectorConstants.PROPERTY_DEFAULT_LIMIT,
                    String.valueOf(DeepConnectorConstants.DEFAULT_RESULT_SIZE));
    ConnectorClusterConfig configuration = new ConnectorClusterConfig(CLUSTERNAME_CONSTANT, connectorOptions,
                    options);
    configuration.setDataStoreName(new DataStoreName("aerospike"));
    return configuration;
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:20,代码来源:AerospikeConnectionConfigurationBuilder.java

示例12: connect

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
@Override public void connect(ICredentials credentials, ConnectorClusterConfig config) throws ConnectionException {
    //TODO Add connect functionality. The connector should establish the connection with the underlying
    //datastore. ICredentials is currently not supported.
    throw new ConnectionException("Method not implemented");
}
 
开发者ID:Stratio,项目名称:crossdata-connector-skeleton,代码行数:6,代码来源:SkeletonConnector.java

示例13: createNativeConnection

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
/**
 * Use config & Credentials to create Deep native connection.
 * 
 * @param iCredentials
 *            			The credentials
 * @param connectorClusterConfig
 *            					The connector cluster configuration
 * 
 * @return DeepConnection
 **/
@Override
protected Connection createNativeConnection(ICredentials iCredentials, ConnectorClusterConfig connectorClusterConfig)
		throws ConnectionException {

	Connection connection;

	connection = new DeepConnection(iCredentials, connectorClusterConfig);


	return connection;
}
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:22,代码来源:DeepConnectionHandler.java

示例14: connect

import com.stratio.crossdata.common.connector.ConnectorClusterConfig; //导入依赖的package包/类
public void connect(ConnectorClusterConfig configuration) throws ConnectionException {

        this.deepConnector.connect(null, configuration);
    }
 
开发者ID:Stratio,项目名称:stratio-connector-deep,代码行数:5,代码来源:ConnectionsHandler.java


注:本文中的com.stratio.crossdata.common.connector.ConnectorClusterConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。