• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Result类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: assertTestQueryDataStore

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * Method to query the data store
 */
@Override
public void assertTestQueryDataStore(){
  log.info("test method: testQuery using DynamoDB store.");
  try {
    DynamoDBKey<String, String> dKey = new DynamoDBKey<String, String>();
    dKey.setHashKey("Peru");
    DynamoDBQuery.setScanCompOp(ComparisonOperator.LE);
    DynamoDBQuery.setType(DynamoDBQuery.SCAN_QUERY);
    Query<DynamoDBKey, person> query = new DynamoDBQuery<DynamoDBKey, person>();
    query.setKey(dKey);
    Result<DynamoDBKey, person> queryResult = dataStore.execute(query);
    processQueryResult(queryResult);
  } catch (Exception e) {
    log.error("error in test method: testQuery.");
    e.printStackTrace();
  }
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:21,代码来源:TestDynamoDBStore.java


示例2: assertTestQueryKeyRange

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * Method to query items into the data store
 */
@Override
public void assertTestQueryKeyRange(){
  log.info("test method: testQueryKeyRange using specific data store.");
  try {
    DynamoDBKey<String, String> dKey = new DynamoDBKey<String, String>();
    DynamoDBKey<String, String> startKey = new DynamoDBKey<String, String>();
    DynamoDBKey<String, String> endKey = new DynamoDBKey<String, String>();
    dKey.setHashKey("Peru");
    startKey.setRangeKey("01/01/1700");
    endKey.setRangeKey("31/12/1900");
    DynamoDBQuery.setRangeCompOp(ComparisonOperator.BETWEEN);
    DynamoDBQuery.setType(DynamoDBQuery.RANGE_QUERY);
    Query<DynamoDBKey, person> query = new DynamoDBQuery<DynamoDBKey, person>();
    query.setKey(dKey);
    query.setStartKey(startKey);
    query.setEndKey(endKey);
    Result<DynamoDBKey, person> queryResult = dataStore.execute(query);
    processQueryResult(queryResult);
  } catch (Exception e) {
    log.error("error in test method: testQueryKeyRange.");
    e.printStackTrace();
  }
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:27,代码来源:TestDynamoDBStore.java


示例3: findStartNode

import org.apache.gora.query.Result; //导入依赖的package包/类
private static CINode findStartNode(Random rand, DataStore<Long,CINode> store) throws IOException {
  Query<Long,CINode> query = store.newQuery();
  query.setStartKey(rand.nextLong());
  query.setLimit(1);
  query.setFields(PREV_FIELD);
  
  long t1 = System.currentTimeMillis();
  Result<Long,CINode> rs = store.execute(query);
  long t2 = System.currentTimeMillis();
  
  try {
    if (rs.next()) {
      LOG.info("FSR %d %016x\n {}", new Object[] {t2 - t1, rs.getKey()});
      return rs.get();
    }
  } catch (Exception e) {
    LOG.error(e.getMessage());
    throw new RuntimeException(e);
  }
  
  LOG.info("FSR {}", new Object [] {(t2 - t1)});
  
  return null;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:25,代码来源:Walker.java


示例4: execute

import org.apache.gora.query.Result; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Result<K, T> execute(Query<K, T> query) {
  K startKey = query.getStartKey();
  K endKey = query.getEndKey();
  if(startKey == null) {
    startKey = (K) map.firstKey();
  }
  if(endKey == null) {
    endKey = (K) map.lastKey();
  }

  //check if query.fields is null
  query.setFields(getFieldsToQuery(query.getFields()));

  ConcurrentNavigableMap<K,T> submap = map.subMap(startKey, true, endKey, true);

  return new MemResult<>(this, query, submap);
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:20,代码来源:MemStore.java


示例5: testSerdeWebPage

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * Creates an WebPage object in-memory setting several fields to dirty. 
 * Run a query over the persistent data.
 * Asserts that the results can be serialized and 
 * deserialzed without loosing data. We do this by asserting
 * what we get 'before' and 'after' (de)serialization processes.
 * Also simple assertion for equal number of URL's in WebPage 
 * and results.
 * @throws Exception
 */
@SuppressWarnings("unchecked")
@Test
public void testSerdeWebPage() throws Exception {

  MemStore<String, WebPage> store = DataStoreFactory.getDataStore(
      MemStore.class, String.class, WebPage.class, new Configuration());
  WebPageDataCreator.createWebPageData(store);

  Result<String, WebPage> result = store.newQuery().execute();

  int i = 0;
  while (result.next()) {
    WebPage page = result.get();
    TestIOUtils.testSerializeDeserialize(page);
    i++;
  }
  assertEquals(WebPageDataCreator.URLS.length, i);
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:29,代码来源:TestPersistentSerialization.java


示例6: testQueryWebPageSingleKey

import org.apache.gora.query.Result; //导入依赖的package包/类
private static void testQueryWebPageSingleKey(DataStore<String, WebPage> store
    , String[] fields) throws Exception {

  createWebPageData(store);

  for(int i=0; i<URLS.length; i++) {
    Query<String, WebPage> query = store.newQuery();
    query.setFields(fields);
    query.setKey(URLS[i]);
    Result<String, WebPage> result = query.execute();
    assertTrue(result.next());
    WebPage page = result.get();
    assertWebPage(page, i);
    assertFalse(result.next());
  }
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:17,代码来源:DataStoreTestUtil.java


示例7: get

import org.apache.gora.query.Result; //导入依赖的package包/类
@Override
public T get(K key, String[] fields) {
  CassandraQuery<K,T> query = new CassandraQuery<>();
  query.setDataStore(this);
  query.setKeyRange(key, key);
  
  if (fields == null){
    fields = this.getFields();
  }
  query.setFields(fields);

  query.setLimit(1);
  Result<K,T> result = execute(query);
  boolean hasResult = false;
  try {
    hasResult = result.next();
  } catch (Exception e) {
    LOG.error(e.getMessage());
    throw new RuntimeException(e);
  }
  return hasResult ? result.get() : null;
}
 
开发者ID:jianglibo,项目名称:gora-boot,代码行数:23,代码来源:CassandraStore.java


示例8: poll

import org.apache.gora.query.Result; //导入依赖的package包/类
@Override
protected int poll() throws Exception {
    final Exchange exchange = this.getEndpoint().createExchange();

    // compute time (approx) since last update
    if (firstRun) {
        this.query.setStartTime(System.currentTimeMillis());
    } else {
        this.query.setStartTime(System.currentTimeMillis() - getDelay());
    }

    //proceed with query
    final Result result = query.execute();

    LOG.trace("Processing exchange [{}]...", exchange);

    try {
        getProcessor().process(exchange);
    } finally {
        if (exchange.getException() != null) {
            getExceptionHandler().handleException("Error processing exchange", exchange, exchange.getException());
        }
    }

    return Long.valueOf(result.getOffset()).intValue();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:GoraConsumer.java


示例9: get

import org.apache.gora.query.Result; //导入依赖的package包/类
@Override
public T get(K key, String[] fields) {
   LOG.debug("get("+key+","+fields+")");
   if (fields==null)
      return infinispanClient.get(key);

   InfinispanQuery query = new InfinispanQuery(this);
   query.setKey(key);
   query.setFields(fields);
   query.build();


   Result<K,T> result = query.execute();
   try {
      result.next();
      return result.get();
   } catch (Exception e) {
      throw new RuntimeException(e);
   }
}
 
开发者ID:leads-project,项目名称:gora-infinispan,代码行数:21,代码来源:InfinispanStore.java


示例10: assertTestQueryDataStore

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * Method to query the data store
 */
@Override
public void assertTestQueryDataStore() {
  log.info("test method: testQuery using DynamoDB store.");
  try {
    DynamoDBKey<String, String> dKey = new DynamoDBKey<String, String>();
    dKey.setHashKey("Peru");
    DynamoDBQuery.setScanCompOp(ComparisonOperator.LE);
    DynamoDBQuery.setType(DynamoDBQuery.SCAN_QUERY);
    Query<DynamoDBKey, Person> query = new DynamoDBQuery<DynamoDBKey, Person>();
    query.setKey(dKey);
    Result<DynamoDBKey, Person> queryResult = dataStore.execute(query);
    processQueryResult(queryResult);
  } catch (Exception e) {
    log.error("error in test method: testQuery.", e.getMessage());
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:21,代码来源:TestDynamoDBNativeStore.java


示例11: assertTestQueryKeyRange

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * Method to query items into the data store
 */
@Override
public void assertTestQueryKeyRange() {
  log.info("test method: testQueryKeyRange using specific data store.");
  try {
    DynamoDBKey<String, String> dKey = new DynamoDBKey<String, String>();
    DynamoDBKey<String, String> startKey = new DynamoDBKey<String, String>();
    DynamoDBKey<String, String> endKey = new DynamoDBKey<String, String>();
    dKey.setHashKey("Peru");
    startKey.setRangeKey("01/01/1700");
    endKey.setRangeKey("31/12/1900");
    DynamoDBQuery.setRangeCompOp(ComparisonOperator.BETWEEN);
    DynamoDBQuery.setType(DynamoDBQuery.RANGE_QUERY);
    Query<DynamoDBKey, Person> query = new DynamoDBQuery<DynamoDBKey, Person>();
    query.setKey(dKey);
    query.setStartKey(startKey);
    query.setEndKey(endKey);
    Result<DynamoDBKey, Person> queryResult = dataStore.execute(query);
    processQueryResult(queryResult);
  } catch (Exception e) {
    log.error("error in test method: testQueryKeyRange.", e.getMessage());
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:27,代码来源:TestDynamoDBNativeStore.java


示例12: get

import org.apache.gora.query.Result; //导入依赖的package包/类
@Override
public T get(K key, String[] fields) {
  LOG.debug("get("+key+","+fields+")");
  if (fields==null)
    return infinispanClient.get(key);

  InfinispanQuery<K, T> query = new InfinispanQuery<K, T>(this);
  query.setKey(key);
  query.setFields(fields);
  query.build();


  Result<K,T> result = query.execute();
  try {
    result.next();
    return result.get();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:21,代码来源:InfinispanStore.java


示例13: testSerdeWebPage

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * Creates an WebPage object in-memory setting several fields to dirty.
 * Run a query over the persistent data.
 * Asserts that the results can be serialized and
 * deserialzed without loosing data. We do this by asserting
 * what we get 'before' and 'after' (de)serialization processes.
 * Also simple assertion for equal number of URL's in WebPage
 * and results.
 * @throws Exception
 */
@SuppressWarnings("unchecked")
@Test
public void testSerdeWebPage() throws Exception {

  MemStore<String, WebPage> store = DataStoreFactory.getDataStore(
          MemStore.class, String.class, WebPage.class, new Configuration());
  WebPageDataCreator.createWebPageData(store);

  Result<String, WebPage> result = store.newQuery().execute();

  int i = 0;
  while (result.next()) {
    WebPage page = result.get();
    TestIOUtils.testSerializeDeserialize(page);
    i++;
  }
  assertEquals(WebPageDataCreator.URLS.length, i);
}
 
开发者ID:apache,项目名称:gora,代码行数:29,代码来源:TestPersistentSerialization.java


示例14: execute

import org.apache.gora.query.Result; //导入依赖的package包/类
@Override
public Result<K, T> execute(Query<K, T> query) {
  K startKey = query.getStartKey();
  K endKey = query.getEndKey();
  if (startKey == null) {
    if (!cacheEntryList.isEmpty()) {
      startKey = (K) cacheEntryList.first();
    }
  }
  if (endKey == null) {
    if (!cacheEntryList.isEmpty()) {
      endKey = (K) cacheEntryList.last();
    }
  }
  query.setFields(getFieldsToQuery(query.getFields()));
  ConcurrentSkipListSet<K> cacheEntrySubList = null;
  try {
    cacheEntrySubList = (ConcurrentSkipListSet<K>) cacheEntryList.subSet(startKey, true, endKey, true);
  } catch (NullPointerException npe) {
    LOG.error("NPE occurred while executing the query for JCacheStore. Hence returning empty entry set.", npe);
    return new JCacheResult<>(this, query, new ConcurrentSkipListSet<K>());
  }
  return new JCacheResult<>(this, query, cacheEntrySubList);
}
 
开发者ID:apache,项目名称:gora,代码行数:25,代码来源:JCacheStore.java


示例15: deleteByQuery

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @param query matching records to this query will be deleted
 * @return the number of deleted records
 */
@Override
public long deleteByQuery(Query<K, T> query) {
  Result<K, T> result = query.execute();
  int deleteCount = 0;
  try {
    while (result.next()) {
      if (aerospikeClient.delete(null, getAerospikeKey(result.getKey()))) {
        deleteCount++;
      }
    }
    return deleteCount;
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
    return -1;
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:23,代码来源:AerospikeStore.java


示例16: execute

import org.apache.gora.query.Result; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public Result<K, T> execute(Query<K, T> query) {
  String[] fields = getFieldsToQuery(query.getFields());
  OrientDBQuery dataStoreQuery;
  if (query instanceof OrientDBQuery) {
    dataStoreQuery = ((OrientDBQuery) query);
  } else {
    dataStoreQuery = (OrientDBQuery) ((PartitionQueryImpl<K, T>) query).getBaseQuery();
  }
  dataStoreQuery.populateOrientDBQuery(orientDBMapping, fields, getFields());
  ODatabaseDocumentTx selectTx = connectionPool.acquire();
  selectTx.activateOnCurrentThread();
  try {
    OConcurrentResultSet<ODocument> result = selectTx.command(dataStoreQuery.getOrientDBQuery())
            .execute(dataStoreQuery.getParams());
    result.setLimit((int) query.getLimit());
    return new OrientDBResult<K, T>(this, query, result);
  } finally {
    selectTx.close();
  }
}
 
开发者ID:apache,项目名称:gora,代码行数:25,代码来源:OrientDBStore.java


示例17: deleteByQuery

import org.apache.gora.query.Result; //导入依赖的package包/类
@Override
 public long deleteByQuery(Query<K, T> query) {
try{
	long deletedRows = 0;
    Result<K,T> result = query.execute();

    while(result.next()) {
      if(delete(result.getKey()))
        deletedRows++;
    }
    return 0;
  }
catch(Exception e){
	  return 0;
}
 }
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:17,代码来源:MemStore.java


示例18: execute

import org.apache.gora.query.Result; //导入依赖的package包/类
@Override
public Result<K, T> execute(Query<K, T> query) {
  K startKey = query.getStartKey();
  K endKey = query.getEndKey();
  if(startKey == null) {
    startKey = map.firstKey();
  }
  if(endKey == null) {
    endKey = map.lastKey();
  }

  //check if query.fields is null
  query.setFields(getFieldsToQuery(query.getFields()));

  NavigableMap<K, T> submap = map.subMap(startKey, true, endKey, true);

  return new MemResult<K,T>(this, query, submap);
}
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:19,代码来源:MemStore.java


示例19: testCloneWebPage

import org.apache.gora.query.Result; //导入依赖的package包/类
@Test
public void testCloneWebPage() throws Exception {
  @SuppressWarnings("unchecked")
  DataStore<String, WebPage> store = DataStoreFactory.createDataStore(
      MemStore.class, String.class, WebPage.class, conf);
  WebPageDataCreator.createWebPageData(store);

  Query<String, WebPage> query = store.newQuery();
  Result<String, WebPage> result = query.execute();
  
  int tested = 0;
  while(result.next()) {
    WebPage page = result.get();
    testClone(page);
    tested++;
  }
  Assert.assertEquals(WebPageDataCreator.URLS.length, tested);
}
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:19,代码来源:TestPersistentDatumReader.java


示例20: testSerdeWebPage

import org.apache.gora.query.Result; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testSerdeWebPage() throws Exception {

  MemStore<String, WebPage> store = DataStoreFactory.getDataStore(
      MemStore.class, String.class, WebPage.class, new Configuration());
  WebPageDataCreator.createWebPageData(store);

  Result<String, WebPage> result = store.newQuery().execute();

  int i=0;
  while(result.next()) {
    WebPage page = result.get();
    TestIOUtils.testSerializeDeserialize(page);
    i++;
  }
  Assert.assertEquals(WebPageDataCreator.URLS.length, i);
}
 
开发者ID:galaxyeye,项目名称:gora-0.3-simplified,代码行数:19,代码来源:TestPersistentSerialization.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PluginDisableEvent类代码示例发布时间:2022-05-22
下一篇:
Java DoubleType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap