private void pushStatus(DownloadLink dl) {

    HashMap<String, Object> dls = new HashMap<String, Object>();
    dls.put("uuid", dl.getUniqueID().getID());

    DownloadLinkAPIStorableV2 dlss =
        RemoteAPIController.getInstance()
            .getDownloadsAPIV2()
            .setStatus(new DownloadLinkAPIStorableV2(), dl, this);

    dls.put("statusIconKey", dlss.getStatusIconKey());
    dls.put("status", dlss.getStatus());

    fire(
        BASIC_EVENT.LINK_UPDATE.name() + ".status",
        dls,
        BASIC_EVENT.LINK_UPDATE.name() + ".status." + dl.getUniqueID().getID());

    // package

    FilePackageView fpView = new FilePackageView(dl.getFilePackage());
    fpView.aggregate();
    FilePackageAPIStorableV2 dpss =
        RemoteAPIController.getInstance()
            .getDownloadsAPIV2()
            .setStatus(new FilePackageAPIStorableV2(), fpView);
    dls = new HashMap<String, Object>();
    dls.put("uuid", dl.getFilePackage().getUniqueID().getID());
    dls.put("statusIconKey", dpss.getStatusIconKey());
    dls.put("status", dpss.getStatus());

    fire(
        BASIC_EVENT.PACKAGE_UPDATE.name() + ".status",
        dls,
        BASIC_EVENT.PACKAGE_UPDATE.name() + ".status." + dl.getFilePackage().getUniqueID().getID());
  }
  private void fire(String eventID, Object dls, String collapseKey) {
    synchronized (this) {
      ArrayList<Subscriber> subscribers = eventsAPI.getSubscribers();
      final SimpleEventObject eventObject = new SimpleEventObject(this, eventID, dls, collapseKey);
      RemoteAPIController.getInstance()
          .getEventSender()
          .fireEvent(
              new RemoteAPIInternalEvent() {

                @Override
                public void fireTo(RemoteAPIInternalEventListener listener) {
                  listener.onRemoteAPIEvent(eventObject);
                }
              });
      for (Subscriber subscriber : subscribers) {

        pushToBuffer(subscriber, eventObject);
      }
    }
  }
 public DownloadControllerEventPublisher(EventsAPI eventsapi) {
   RemoteAPIController.validateInterfaces(
       DownloadControllerEventPublisherInterface.class, DownloadsEventsInterface.class);
   this.eventsAPI = eventsapi;
   eventsapi.getLocalEventSender().addListener(this);
 }