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


Java DseSession类代码示例

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


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

示例1: executeGraphQuery

import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
/**
 * Creates a SimpleGraphStatement out of the input string Runs it through a
 * DSESession and returns the result
 * 
 * @param sb
 * @return
 */
protected GraphResultSet executeGraphQuery(StringBuilder sb) {
	// create a SimpleGraphStatement out of the gremlin string created
	SimpleGraphStatement statement = connectionManager.getStatement(sb.toString());
	// obtain the DSE connection session and execute the query
	DseSession session = connectionManager.getDSEGraphSession().getSession();
	GraphResultSet graphResultSet = null;
	try {
		ListenableFuture<GraphResultSet> resultSet = session.executeGraphAsync(statement);
		GraphCallBack callBack = new GraphCallBack();
		Futures.addCallback(resultSet, callBack);
		if (resultSet != null) {
			graphResultSet = resultSet.get();
		} else {
			LOGGER.error("Failed to execute DSE Graph command " + statement.toString());
			return graphResultSet;
		}
	} catch (InterruptedException | ExecutionException e) {
		LOGGER.error("Failed to execute DSE Graph command " + statement.toString(), e);
		throw new RepositoryException(e.getMessage(), e);
	}
	return graphResultSet;
}
 
开发者ID:intuit,项目名称:universal-graph-client,代码行数:30,代码来源:GraphOperations.java

示例2: build

import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
@JsonIgnore
public DseCluster build(Environment environment) throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException {
    DseCluster.Builder builder = DseCluster.builder()
            .addContactPoints(contactPoints)
            .withGraphOptions(new GraphOptions().setGraphName(graphName));

    if (null != userName && userName.length() > 0 && null != password && password.length() > 0) {
        builder = builder.withCredentials(userName, password);
    }

    if (null != sslTruststoreFile && sslTruststoreFile.length() > 0 && null != sslTruststorePassword && sslTruststorePassword.length() > 0) {
        builder = withSSL(builder);
    }

    DseCluster cluster = builder.build();
    DseSession session = cluster.newSession();

    environment.lifecycle().manage(new DseGraphManaged(cluster, getShutdownTimeout()));
    environment.healthChecks().register("dsegraph",
            new DseGraphHealthCheck(session, validationQuery, validationQueryTimeout));

    return cluster;
}
 
开发者ID:experoinc,项目名称:dropwizard-dsegraph,代码行数:24,代码来源:DseGraphFactory.java

示例3: DseGraphHealthCheck

import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
public DseGraphHealthCheck(
        @NotNull DseSession session,
        @NotNull String validationQuery,
        @NotNull Duration validationTimeout) {

    this.session = session;
    this.validationQuery = validationQuery;
    this.validationTimeout = validationTimeout;
}
 
开发者ID:experoinc,项目名称:dropwizard-dsegraph,代码行数:10,代码来源:DseGraphHealthCheck.java

示例4: hierarchy

import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
@Test
public void hierarchy() {
  assertEquals(ImmutableSet.of(), hierarchy(Object.class));
  // normal
  assertEquals(ImmutableSet.of(Cluster.class), hierarchy(Cluster.class));
  assertEquals(ImmutableSet.of(Session.class), hierarchy(Session.class));
  // dse
  assertEquals(ImmutableSet.of(DseCluster.class, DelegatingCluster.class, Cluster.class),
      hierarchy(DseCluster.class));
  assertEquals(ImmutableSet.of(DseSession.class, Session.class), hierarchy(DseSession.class));
}
 
开发者ID:jooby-project,项目名称:jooby,代码行数:12,代码来源:CassandraTest.java

示例5: getSession

import com.datastax.driver.dse.DseSession; //导入依赖的package包/类
/**
 * Get DSESession
 * 
 * @return
 */
public DseSession getSession() {
	return dseSession;
}
 
开发者ID:intuit,项目名称:universal-graph-client,代码行数:9,代码来源:DSEGraphSession.java


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