@Override public void deleteSchema() throws GoraException { throw new GoraException("delete schema is not supported for " + "file backed data stores"); }
/** * {@link org.apache.gora.store.DataStore} objects are created from a factory. It is necessary to * provide the key and value class. The datastore class parameters is optional, * and if not specified it will be read from the <code>gora.properties</code> file. * @throws WriterException if error occurs * @see org.apache.hadoop.chukwa.datacollection.writer.ChukwaWriter#init(org.apache.hadoop.conf.Configuration) */ @Override public void init(Configuration c) throws WriterException { try { chunkStore = DataStoreFactory.getDataStore(String.class, ChukwaChunk.class, c); } catch (GoraException e) { log.error(ExceptionUtil.getStackTrace(e)); e.printStackTrace(); } }
@Override public void close() { try{ flush(); } catch (GoraException e) { LOG.error(e.getMessage(), e); if (e.getCause() != null) { LOG.error(e.getCause().getMessage()); } // At this point, the exception is ignored... } cacheEntryList.clear(); if (!cache.isDestroyed() && !manager.isClosed()) { cache.close(); } if (!manager.isClosed()) { manager.close(); } hazelcastInstance.shutdown(); persistentDataStore.close(); LOG.info("JCache Gora datastore destroyed successfully."); }
@Override public void flush() throws GoraException { try{ if(outputStream != null) outputStream.flush(); } catch (Exception e) { throw new GoraException(e); } }
/** * {@inheritDoc} */ @Override public Result<K, T> execute(Query<K, T> query) throws GoraException { try { return (Result<K, T>) cassandraSerializer.execute(this, query); } catch (Exception e) { throw new GoraException(e); } }
@Override public boolean delete(K key) throws GoraException { try { return cache.remove(key); } catch (Exception e) { throw new GoraException(e); } }
@Override public T newPersistent() throws GoraException { try { return beanFactory.newPersistent(); } catch (Exception e) { throw new GoraException(e); } }
@Override public void flush() throws GoraException { try{ table.flushCommits(); } catch (Exception e) { throw new GoraException(e); } }
@Override public T get(K key) throws GoraException { LOG.debug("get("+key+")"); try { return infinispanClient.get(key); } catch (Exception e) { throw new GoraException(e); } }
@Override public void flush() throws GoraException { LOG.debug("flush()"); try { infinispanClient.flush(); } catch (Exception e) { throw new GoraException(e); } }
@Override public void flush() throws GoraException { try { if (batch.size() > 0) { add(batch, commitWithin); batch.clear(); } } catch (Exception e) { throw new GoraException(e); } }
@Override public K newKey() throws GoraException { try { return beanFactory.newKey(); } catch (Exception e) { throw new GoraException(e); } }
@Override /** * Executes a query inside a web service backed data store */ public Result<K, T> execute(Query<K, T> query) throws GoraException { try { return executeQuery(query); } catch (IOException e) { throw new GoraException(e); } }
public void dropCache() throws GoraException { try { cache.clear(); cacheExists = false; } catch (Exception e) { throw new GoraException(e); } }
@Override public void flush() throws GoraException { try { if (batchWriter != null) { batchWriter.flush(); } } catch (Exception e) { throw new GoraException(e); } }
@Override public T get(K key) throws GoraException { try { return cache.get(key); } catch (Exception e) { throw new GoraException(e); } }
@Override public void put(K key, T val) throws GoraException { try { cache.put(key, val); } catch (Exception e) { throw new GoraException(e); } }
@Override public boolean delete(K key) throws GoraException { LOG.debug("delete(" + key+")"); try { this.infinispanClient.deleteByKey(key); return true; } catch (Exception e) { throw new GoraException(e); } }
/** * Ensure the data is synced to disk. */ @Override public void flush() throws GoraException { try { for (MongoClient client : mapsOfClients.values()) { client.fsync(false); LOG.debug("Forced synced of database for Mongo instance {}.", new Object[] { client }); } } catch (Exception e) { throw new GoraException(e); } }
/** * {@inheritDoc} * * @param key * @param value */ @Override public void put(Object key, Persistent value) throws GoraException { try { LOG.debug("Object is saved with key : {} and value : {}", key, value); mapper.save((T) value); } catch (Exception e) { throw new GoraException(e); } }