Search in sources :

Example 1 with InfinispanStore

use of org.apache.gora.infinispan.store.InfinispanStore in project gora by apache.

the class GoraInfinispanTestDriver method createDataStore.

@Override
public <K, T extends Persistent> DataStore<K, T> createDataStore(Class<K> keyClass, Class<T> persistentClass) throws GoraException {
    InfinispanStore store = (InfinispanStore) super.createDataStore(keyClass, persistentClass);
    if (persistentClass.equals(Employee.class)) {
        store.setPrimaryFieldName("ssn");
        store.setPrimaryFieldPos(2);
    } else if (persistentClass.equals(WebPage.class)) {
        store.setPrimaryFieldName("url");
        store.setPrimaryFieldPos(0);
    }
    return store;
}
Also used : WebPage(org.apache.gora.examples.generated.WebPage) InfinispanStore(org.apache.gora.infinispan.store.InfinispanStore)

Example 2 with InfinispanStore

use of org.apache.gora.infinispan.store.InfinispanStore in project gora by apache.

the class InfinispanStoreMapReduceTest method createWebPageDataStore.

@Override
protected DataStore<String, WebPage> createWebPageDataStore() throws IOException {
    conf = driver.getConfiguration();
    conf.set(ISPN_CONNECTION_STRING_KEY, driver.connectionString());
    try {
        InfinispanStore<String, WebPage> store = new InfinispanStore<>();
        store.setConf(conf);
        store.initialize(String.class, WebPage.class, new Properties());
        return store;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : WebPage(org.apache.gora.examples.generated.WebPage) InfinispanStore(org.apache.gora.infinispan.store.InfinispanStore) Properties(java.util.Properties) IOException(java.io.IOException)

Aggregations

WebPage (org.apache.gora.examples.generated.WebPage)2 InfinispanStore (org.apache.gora.infinispan.store.InfinispanStore)2 IOException (java.io.IOException)1 Properties (java.util.Properties)1