/** * Instantiate a new {@link DataStore}. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @param properties The properties to be used be the store. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, Class<T> persistent, Configuration conf, Properties properties) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistent, conf, properties, null); }
/** * Instantiate a new {@link DataStore}. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @param properties The properties to be used be the store. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, Class<T> persistent, Configuration conf, Properties properties) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistent, conf, properties, null); }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistentClass The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D getDataStore( Class<D> dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Configuration conf) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistentClass, conf, createProps(), null); }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, Class<T> persistent, Configuration conf) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistent, conf, createProps(), null); }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, Class<T> persistent, Configuration conf) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistent, conf, createProps(), null); }
/** * Instantiate a new {@link DataStore}. Uses default properties. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @param schemaName A default schemaname that will be put on the properties. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, Class<T> persistent, Configuration conf, String schemaName) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistent, conf, createProps(), schemaName); }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistentClass The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D getDataStore( Class<D> dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Configuration conf) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistentClass, conf, createProps(), null); }
/** * Instantiate a new {@link DataStore}. Uses default properties. * * @param dataStoreClass The datastore implementation class. * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @param schemaName A default schemaname that will be put on the properties. * @return A new store instance. * @throws GoraException */ public static <D extends DataStore<K,T>, K, T extends Persistent> D createDataStore(Class<D> dataStoreClass , Class<K> keyClass, Class<T> persistent, Configuration conf, String schemaName) throws GoraException { return createDataStore(dataStoreClass, keyClass, persistent, conf, createProps(), schemaName); }
@Override @SuppressWarnings("unchecked") public RecordWriter<K, T> getRecordWriter(TaskAttemptContext context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); Class<? extends DataStore<K,T>> dataStoreClass = (Class<? extends DataStore<K,T>>) conf.getClass(DATA_STORE_CLASS, null); Class<K> keyClass = (Class<K>) conf.getClass(OUTPUT_KEY_CLASS, null); Class<T> rowClass = (Class<T>) conf.getClass(OUTPUT_VALUE_CLASS, null); final DataStore<K, T> store = DataStoreFactory.createDataStore(dataStoreClass, keyClass, rowClass, context.getConfiguration()); setOutputPath(store, context); return new GoraRecordWriter(store, context); }
@Override @SuppressWarnings("unchecked") public RecordWriter<K, T> getRecordWriter(TaskAttemptContext context) throws IOException, InterruptedException { Configuration conf = context.getConfiguration(); Class<? extends DataStore<K,T>> dataStoreClass = (Class<? extends DataStore<K,T>>) conf.getClass(DATA_STORE_CLASS, null); Class<K> keyClass = (Class<K>) conf.getClass(OUTPUT_KEY_CLASS, null); Class<T> rowClass = (Class<T>) conf.getClass(OUTPUT_VALUE_CLASS, null); final DataStore<K, T> store = DataStoreFactory.createDataStore(dataStoreClass, keyClass, rowClass, context.getConfiguration()); setOutputPath(store, context); return new GoraRecordWriter(store, context); }
/** * Instantiate a new {@link org.apache.gora.store.DataStore}. Uses default properties. * * @param keyClass The key class. * @param persistentClass The value class. * @param <K> class to be used for the key * @param <T> class to be persisted within the store * @return a new store instance. * @throws GoraException Gora specific exception. This extends IOException. */ @SuppressWarnings("unchecked") public <K, T extends Persistent> DataStore<K, T> createDataStore(Class<K> keyClass, Class<T> persistentClass) throws GoraException { final DataStore<K, T> dataStore = DataStoreFactory.createDataStore( (Class<? extends DataStore<K, T>>) dataStoreClass, keyClass, persistentClass, conf); dataStores.add(dataStore); log.info("Datastore for {} was added.", persistentClass); return dataStore; }
/** * Instantiate a new {@link org.apache.gora.store.DataStore}. * * @param keyClass The key class. * @param persistentClass The value class. * @param properties The properties to be used be the store. * @param <K> class to be used for the key * @param <T> class to be persisted within the store * @return new store instance. * @throws GoraException Gora specific exception. This extends IOException. */ @SuppressWarnings("unchecked") public<K, T extends Persistent> DataStore<K,T> createDataStore(Class<K> keyClass, Class<T> persistentClass, Properties properties) throws GoraException { final DataStore<K, T> dataStore = DataStoreFactory.createDataStore( (Class<? extends DataStore<K, T>>) dataStoreClass, keyClass, persistentClass, conf, properties); dataStores.add(dataStore); log.info("Datastore for {} was added.", persistentClass); return dataStore; }
/** * Instantiate <i>the default</i> {@link DataStore}. Uses default properties. Uses 'null' schema. * * Note: * consider that default dataStore is always visible * * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ @SuppressWarnings("unchecked") public static <K, T extends Persistent> DataStore<K, T> getDataStore( Class<K> keyClass, Class<T> persistent, Configuration conf) throws GoraException { Properties createProps = createProps(); Class<? extends DataStore<K, T>> c; try { c = (Class<? extends DataStore<K, T>>) Class.forName(getDefaultDataStore(createProps)); } catch (Exception ex) { throw new GoraException(ex); } return createDataStore(c, keyClass, persistent, conf, createProps, null); }
/** * Instantiate <i>the default</i> {@link DataStore}. Uses default properties. Uses 'null' schema. * * Note: * consider that default dataStore is always visible * * @param keyClass The key class. * @param persistent The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ @SuppressWarnings("unchecked") public static <K, T extends Persistent> DataStore<K, T> getDataStore( Class<K> keyClass, Class<T> persistent, Configuration conf) throws GoraException { Properties createProps = createProps(); Class<? extends DataStore<K, T>> c; try { c = (Class<? extends DataStore<K, T>>) Class.forName(getDefaultDataStore(createProps)); } catch (Exception ex) { throw new GoraException(ex); } return createDataStore(c, keyClass, persistent, conf, createProps, null); }
throw new GoraException(ex); return createDataStore(c, keyClass, persistent, conf, createProps, null);
throw new GoraException(ex); return createDataStore(c, keyClass, persistent, conf, createProps, null);
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class <i>as string</i>. * @param keyClass The key class. * @param persistentClass The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ @SuppressWarnings("unchecked") public static <K, T extends Persistent> DataStore<K, T> getDataStore( String dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Configuration conf) throws GoraException { try { Class<? extends DataStore<K,T>> c = (Class<? extends DataStore<K, T>>) ClassLoadingUtils.loadClass(dataStoreClass); return createDataStore(c, keyClass, persistentClass, conf, createProps(), null); } catch(GoraException ex) { throw ex; } catch (Exception ex) { throw new GoraException(ex); } }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class <i>as string</i>. * @param keyClass The key class <i>as string</i>. * @param persistentClass The value class <i>as string</i>. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ @SuppressWarnings({ "unchecked" }) public static <K, T extends Persistent> DataStore<K, T> getDataStore( String dataStoreClass, String keyClass, String persistentClass, Configuration conf) throws GoraException { try { Class<? extends DataStore<K,T>> c = (Class<? extends DataStore<K, T>>) Class.forName(dataStoreClass); Class<K> k = (Class<K>) ClassLoadingUtils.loadClass(keyClass); Class<T> p = (Class<T>) ClassLoadingUtils.loadClass(persistentClass); return createDataStore(c, k, p, conf, createProps(), null); } catch(GoraException ex) { throw ex; } catch (Exception ex) { throw new GoraException(ex); } }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class <i>as string</i>. * @param keyClass The key class. * @param persistentClass The value class. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ @SuppressWarnings("unchecked") public static <K, T extends Persistent> DataStore<K, T> getDataStore( String dataStoreClass, Class<K> keyClass, Class<T> persistentClass, Configuration conf) throws GoraException { try { Class<? extends DataStore<K,T>> c = (Class<? extends DataStore<K, T>>) ClassLoadingUtils.loadClass(dataStoreClass); return createDataStore(c, keyClass, persistentClass, conf, createProps(), null); } catch(GoraException ex) { throw ex; } catch (Exception ex) { throw new GoraException(ex); } }
/** * Instantiate a new {@link DataStore}. Uses default properties. Uses 'null' schema. * * @param dataStoreClass The datastore implementation class <i>as string</i>. * @param keyClass The key class <i>as string</i>. * @param persistentClass The value class <i>as string</i>. * @param conf {@link Configuration} to be used be the store. * @return A new store instance. * @throws GoraException */ @SuppressWarnings({ "unchecked" }) public static <K, T extends Persistent> DataStore<K, T> getDataStore( String dataStoreClass, String keyClass, String persistentClass, Configuration conf) throws GoraException { try { Class<? extends DataStore<K,T>> c = (Class<? extends DataStore<K, T>>) Class.forName(dataStoreClass); Class<K> k = (Class<K>) ClassLoadingUtils.loadClass(keyClass); Class<T> p = (Class<T>) ClassLoadingUtils.loadClass(persistentClass); return createDataStore(c, k, p, conf, createProps(), null); } catch(GoraException ex) { throw ex; } catch (Exception ex) { throw new GoraException(ex); } }