DataStore.get
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.apache.gora.store.DataStore.get(Showing top 15 results out of 315)

origin: apache/gora

public static void testPutMixedMapTypes(DataStore<String, WebPage> store) {
 WebPage webpage = createWebPage();
 webpage.getByteData().put(new Utf8("byteData"), ByteBuffer.wrap(ByteUtils.toBytes("hello map")));
 webpage.getStringData().put(new Utf8("stringData"), "hello map");
 store.createSchema();
 store.put(webpage.getUrl().toString(), webpage);
 store.flush();
 assertNotNull(store.get(webpage.getUrl().toString()));
}
origin: apache/gora

public static void testGetEmployee(DataStore<String, Employee> dataStore)
 throws Exception {
 dataStore.createSchema();
 Employee employee = DataStoreTestUtil.createEmployee();
 String ssn = employee.getSsn().toString();
 dataStore.put(ssn, employee);
 dataStore.flush();
 Employee after = dataStore.get(ssn, AvroUtils.getSchemaFieldNames(Employee.SCHEMA$));
 assertEqualEmployeeObjects(employee, after);
}
origin: apache/gora

@Test
public void testPutGet() throws Exception {
 String key = "org.apache.gora:http:/";
 DataStore<String, WebPage> store = new MemStore<>();
 assumeTrue(store.get(key, new String[0]) == null);
 store.put(key, WebPage.newBuilder().build());
 assertNotNull(store.get(key, new String[0]));
 store.close();
}
origin: apache/gora

private static void assertTokenCount(DataStore<String, TokenDatum> outStore,
  String token, int count) throws Exception {
 TokenDatum datum = outStore.get(token, null);
 assertNotNull("token:" + token + " cannot be found in datastore", datum);
 assertEquals("count for token:" + token + " is wrong", count, datum.getCount().intValue());
}
origin: apache/gora

/** Fetches a single pageview object and prints it*/
private void get(long key) throws Exception {
 Pageview pageview = dataStore.get(key);
 printPageview(pageview);
}
origin: apache/gora

@Override
public T load(K key) throws CacheLoaderException {
 T persistent = null;
 try {
  persistent = dataStore.get(key);
  LOG.info("Loaded data bean from persistent datastore on key {}.", key.toString());
 } catch (CacheLoaderException ex) {
  throw ex;
 }
 return persistent;
}
origin: apache/gora

/**
 * Fetches a single pageview object with required fields and prints it
 */
private void get(long key, String[] fields) throws Exception {
 Pageview pageview = cacheStore.get(key, fields);
 printPageview(pageview);
}
origin: apache/gora

public static void testGetEmployeeNonExisting(DataStore<String, Employee> dataStore)
 throws Exception {
 Employee employee = dataStore.get("_NON_EXISTING_SSN_FOR_EMPLOYEE_");
 assertNull(employee);
}
origin: apache/gora

public static void testGetEmployeeRecursive(DataStore<String, Employee> dataStore)
 throws Exception {
 Employee employee = DataStoreTestUtil.createEmployee();
 Employee boss = DataStoreTestUtil.createBoss();
 employee.setBoss(boss);
 
 String ssn = employee.getSsn().toString();
 dataStore.put(ssn, employee);
 dataStore.flush();
 Employee after = dataStore.get(ssn, AvroUtils.getSchemaFieldNames(Employee.SCHEMA$));
 assertEqualEmployeeObjects(employee, after);
}
origin: apache/gora

private static void testGetWebPage(DataStore<String, WebPage> store, String[] fields)
 throws Exception {
 createWebPageData(store);
 for(int i=0; i<URLS.length; i++) {
  WebPage page = store.get(URLS[i], fields);
  assertWebPage(page, i);
 }
}
origin: apache/gora

@Override
protected boolean nextInner() throws IOException {
 if (!iterator.hasNext()) {
  return false;
 }
 key = iterator.next();
 LOG.info("Results set pointer is now moved to key {}.", key);
 persistent = dataStore.get(key);
 this.current++;
 return true;
}
origin: apache/gora

public static void testGetEmployee3UnionField(DataStore<String, Employee> dataStore)
 throws Exception {
 Employee employee = DataStoreTestUtil.createEmployee();
 employee.setBoss(new Utf8("Real boss")) ;
 String ssn = employee.getSsn().toString();
 dataStore.put(ssn, employee);
 dataStore.flush();
 Employee after = dataStore.get(ssn, AvroUtils.getSchemaFieldNames(Employee.SCHEMA$));
 assertEqualEmployeeObjects(employee, after);
 assertEquals("Real boss", after.getBoss().toString()) ;
}

origin: apache/gora

@Test
public void testGetMissingValue() {
 DataStore<String, WebPage> store = new MemStore<>();
 WebPage nullWebPage = store.get("missing", new String[0]);
 assertNull(nullWebPage);
 store.close();
}
origin: apache/gora

/**
 * Fetches a single pageview object and prints it
 */
private void get(long key, boolean isCacheEnabled) throws Exception {
 if (!isCacheEnabled) {
  Pageview pageview = dataStore.get(key);
  printPageview(pageview);
 } else {
  Pageview pageview = cacheStore.get(key);
  printPageview(pageview);
 }
}
origin: apache/gora

@Override
public Map<K, T> loadAll(Iterable<? extends K> keys) throws CacheLoaderException {
 Map<K, T> loaded = new HashMap<K, T>();
 for (K key : keys) {
  T persistent = dataStore.get(key);
  LOG.info("Loaded data bean from persistent datastore on key {}.", key.toString());
  if (persistent != null) {
   loaded.put(key, persistent);
  }
 }
 return loaded;
}
org.apache.gora.storeDataStoreget

Javadoc

Returns the object corresponding to the given key fetching all the fields.

Popular methods of DataStore

  • flush
    Forces the write caches to be flushed. DataStore implementations may optimize their writing by defer
  • close
    Close the DataStore. This should release any resources held by the implementation, so that the insta
  • put
    Inserts the persistent object with the given key. If an object with the same key already exists it w
  • getPersistentClass
    Returns the class of the persistent objects
  • newQuery
    Constructs and returns a new Query.
  • delete
    Deletes the object with the given key
  • deleteByQuery
    Deletes all the objects matching the query. See also the note on visibility.
  • deleteSchema
    Deletes the underlying schema or table (or similar) in the datastore that holds the objects. This al
  • getKeyClass
    Returns the class of the keys
  • newPersistent
    Returns a new instance of the managed persistent object.
  • createSchema
    Creates the optional schema or table (or similar) in the datastore to hold the objects. If the schem
  • execute
    Executes the given query and returns the results.
  • createSchema,
  • execute,
  • getPartitions,
  • getBeanFactory,
  • initialize,
  • newKey,
  • schemaExists,
  • setBeanFactory,
  • truncateSchema

Popular classes and methods

  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
    Sets the value of the specified request header field. The value will only be used by the current URL
  • Graphics2D (java.awt)
  • PrintStream (java.io)
    Wraps an existing OutputStream and provides convenience methods for writing common data types in a h
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Path (java.nio.file)
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Option (scala)

For IntelliJ IDEA and
Android Studio

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)