/** Initialize the service. */
  @Override
  public void onCreate() {
    Log_OC.d(TAG, "onCreate");
    super.onCreate();

    mDownloadReceiver = new DownloadCompletedReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction(FileDownloader.getDownloadAddedMessage());
    filter.addAction(FileDownloader.getDownloadFinishMessage());
    registerReceiver(mDownloadReceiver, filter);

    mFolderObserversMap = new HashMap<String, FolderObserver>();
  }
    @Override
    public void onReceive(Context context, Intent intent) {
      Log_OC.d(TAG, "Received broadcast intent " + intent);

      File downloadedFile = new File(intent.getStringExtra(FileDownloader.EXTRA_FILE_PATH));
      String parentPath = downloadedFile.getParent();
      FolderObserver observer = mFolderObserversMap.get(parentPath);
      if (observer != null) {
        if (intent.getAction().equals(FileDownloader.getDownloadFinishMessage())
            && downloadedFile.exists()) {
          // no matter if the download was successful or not; the
          // file could be down anyway due to a former download or upload
          observer.startWatching(downloadedFile.getName());
          Log_OC.d(TAG, "Resuming observance of " + downloadedFile.getAbsolutePath());

        } else if (intent.getAction().equals(FileDownloader.getDownloadAddedMessage())) {
          observer.stopWatching(downloadedFile.getName());
          Log_OC.d(TAG, "Pausing observance of " + downloadedFile.getAbsolutePath());
        }

      } else {
        Log_OC.d(TAG, "No observer for path " + downloadedFile.getAbsolutePath());
      }
    }