@Override public void restore(Storage storage) throws StorageException { try { BufferedReader bufferedReaderInst = new BufferedReader(new InputStreamReader(storage.open(getNamespace(), getEntity()))); String configInString = bufferedReaderInst.readLine(); setConfiguration((V) getConfiguration().deserialize(configInString)); bufferedReaderInst.close(); } catch (IOException e) { throw new StorageException(e.getMessage()); } catch (SerdeException e) { throw new StorageException(e.getMessage()); } }
@Override public void store(Storage storage) throws StorageException { try { BufferedWriter bufferedWriterInst = new BufferedWriter(new OutputStreamWriter(storage.create(getNamespace(), getEntity()))); String serializedResource = getConfiguration().serialize(); bufferedWriterInst.write(serializedResource); bufferedWriterInst.close(); } catch (IOException e) { throw new StorageException(e.getMessage()); } catch (SerdeException e) { throw new StorageException(e.getMessage()); } }