@Override
 public IOObject retrieveData(ProgressListener l) throws RepositoryException {
   if (l != null) {
     l.setTotal(100);
   }
   try {
     HttpURLConnection connection =
         getRepository()
             .getResourceHTTPConnection(getLocation().getPath(), EntryStreamType.IOOBJECT, false);
     connection.setDoInput(true);
     connection.setDoOutput(false);
     connection.setRequestMethod("GET");
     InputStream in;
     try {
       in = connection.getInputStream();
     } catch (IOException e) {
       throw new RepositoryException(
           "Cannot download IOObject: "
               + connection.getResponseCode()
               + ": "
               + connection.getResponseMessage(),
           e);
     }
     Object result = IOObjectSerializer.getInstance().deserialize(in);
     if (result instanceof IOObject) {
       return (IOObject) result;
     } else {
       throw new RepositoryException(
           "Server did not send I/O-Object, but instance of " + result.getClass());
     }
   } catch (Exception e) {
     throw new RepositoryException("Cannot parse I/O-Object: " + e, e);
   } finally {
     if (l != null) {
       l.complete();
     }
   }
 }
  protected static void storeData(
      IOObject ioobject, String location, RemoteRepository repository, ProgressListener l)
      throws RepositoryException {
    if (l != null) {
      l.setTotal(100);
      l.setCompleted(0);
    }

    HttpURLConnection conn;
    try {
      conn = repository.getResourceHTTPConnection(location, EntryStreamType.IOOBJECT, false);
    } catch (IOException e1) {
      throw new RepositoryException("Cannot store object at " + location + ": " + e1, e1);
    }
    OutputStream out = null;
    try {
      conn.setRequestProperty("Content-Type", RMContentType.IOOBJECT.getContentTypeString());
      conn.setRequestMethod("POST");
      conn.setDoOutput(true);
      conn.setDoInput(true);
      try {
        out = conn.getOutputStream();
      } catch (IOException e) {
        throw new RepositoryException(
            "Cannot upload object: " + conn.getResponseCode() + ": " + conn.getResponseMessage(),
            e);
      }
      IOObjectSerializer.getInstance().serialize(out, ioobject);
      out.close();
      BufferedReader in = null;
      try {
        try {
          in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
          LogService.getRoot().fine("BEGIN Reply of server:");
          String line;
          while ((line = in.readLine()) != null) {
            LogService.getRoot().fine(line);
          }
          LogService.getRoot().fine("END Reply of server.");
        } catch (IOException e) {
        }
      } finally {
        try {
          if (in != null) {
            in.close();
          }
        } catch (IOException e) {
        }
      }
    } catch (IOException e) {
      try {
        throw new RepositoryException(
            "Cannot store object at "
                + location
                + ": "
                + conn.getResponseCode()
                + ": "
                + conn.getResponseMessage(),
            e);
      } catch (IOException e1) {
        throw new RepositoryException("Cannot store object at " + location + ": " + e, e);
      }
    } finally {
      if (out != null) {
        try {
          out.close();
        } catch (IOException e) {
        }
      }
    }

    if (l != null) {
      l.setCompleted(100);
      l.complete();
    }
  }