Exemplo n.º 1
0
 @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());
   }
 }
Exemplo n.º 2
0
  @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());
    }
  }
Exemplo n.º 3
0
 @Override
 public void delete(Storage storage) throws StorageException {
   storage.delete(getNamespace(), getEntity());
   setConfiguration(null);
 }