Example #1
0
  private void handle(APIChangeDiskOfferingStateMsg msg) {
    DiskOfferingStateEvent sevt = DiskOfferingStateEvent.valueOf(msg.getStateEvent());
    if (sevt == DiskOfferingStateEvent.disable) {
      self.setState(DiskOfferingState.Disabled);
    } else {
      self.setState(DiskOfferingState.Enabled);
    }

    self = dbf.updateAndRefresh(self);
    DiskOfferingInventory inv = DiskOfferingInventory.valueOf(self);

    APIChangeDiskOfferingStateEvent evt = new APIChangeDiskOfferingStateEvent(msg.getId());
    evt.setInventory(inv);
    bus.publish(evt);
  }
Example #2
0
  private void handle(APIUpdateDiskOfferingMsg msg) {
    boolean update = false;
    if (msg.getName() != null) {
      self.setName(msg.getName());
      update = true;
    }
    if (msg.getDescription() != null) {
      self.setDescription(msg.getDescription());
      update = true;
    }
    if (update) {
      self = dbf.updateAndRefresh(self);
    }

    APIUpdateDiskOfferingEvent evt = new APIUpdateDiskOfferingEvent(msg.getId());
    evt.setInventory(DiskOfferingInventory.valueOf(self));
    bus.publish(evt);
  }
Example #3
0
 private void handle(DiskOfferingDeletionMsg msg) {
   DiskOfferingDeletionReply reply = new DiskOfferingDeletionReply();
   dbf.remove(self);
   logger.debug(String.format("deleted disk offering [uuid:%s]", self.getUuid()));
   bus.reply(msg, reply);
 }