cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/4.4-forward to 3e7ea4e
Date Tue, 29 Apr 2014 01:21:15 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 69add34ad -> 3e7ea4e8d


CLOUDSTACK-6530: Populate the first class entities in the context to be available for publishing more information for the event bus, checking the displayable property etc.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3e7ea4e8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3e7ea4e8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3e7ea4e8

Branch: refs/heads/4.4-forward
Commit: 3e7ea4e8d99a92872007f11a09ab87c8ba61e1da
Parents: 69add34
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Mon Apr 28 18:16:13 2014 -0700
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Mon Apr 28 18:16:13 2014 -0700

----------------------------------------------------------------------
 api/src/com/cloud/event/EventTypes.java         | 469 ++++++++++---------
 api/src/com/cloud/vm/VirtualMachine.java        |   4 +-
 .../org/apache/cloudstack/api/BaseAsyncCmd.java |  28 ++
 api/src/org/apache/cloudstack/api/BaseCmd.java  |   2 +-
 .../org/apache/cloudstack/api/Displayable.java  |  21 +
 .../api/command/user/vm/DeployVMCmd.java        |  18 +-
 .../api/command/user/vm/UpdateVMCmd.java        |   2 +-
 .../api/command/user/vm/UpgradeVMCmd.java       |   2 +-
 .../command/user/volume/CreateVolumeCmd.java    |  10 -
 .../command/user/volume/DeleteVolumeCmd.java    |   2 +-
 .../command/user/volume/UpdateVolumeCmd.java    |   5 -
 .../apache/cloudstack/context/CallContext.java  |  11 +
 .../com/cloud/api/ApiAsyncJobDispatcher.java    |  10 +-
 server/src/com/cloud/api/ApiDispatcher.java     |  17 +-
 server/src/com/cloud/api/ApiServer.java         |  12 +-
 .../api/dispatch/CommandCreationWorker.java     |   2 +
 .../cloud/api/dispatch/ParamProcessWorker.java  |  22 +-
 .../src/com/cloud/event/ActionEventUtils.java   |  64 ++-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   9 -
 .../api/dispatch/CommandCreationWorkerTest.java |   8 +
 .../affinity/AffinityApiUnitTest.java           |   6 +
 21 files changed, 419 insertions(+), 305 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 39ef710..075b1c8 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -19,6 +19,9 @@ package com.cloud.event;
 import java.util.HashMap;
 import java.util.Map;
 
+import com.cloud.server.ResourceTag;
+import com.cloud.vm.ConsoleProxy;
+import com.cloud.vm.SecondaryStorageVm;
 import org.apache.cloudstack.config.Configuration;
 
 import com.cloud.dc.DataCenter;
@@ -62,7 +65,7 @@ import com.cloud.vm.VirtualMachine;
 public class EventTypes {
 
     //map of Event and corresponding entity for which Event is applicable
-    private static Map<String, String> entityEventDetails = null;
+    private static Map<String, Object> entityEventDetails = null;
 
     // VM Events
     public static final String EVENT_VM_CREATE = "VM.CREATE";
@@ -492,122 +495,120 @@ public class EventTypes {
     static {
 
         // TODO: need a way to force author adding event types to declare the entity details as well, with out braking
-        // current ActionEvent annotation semantics
-        // TODO #2 - The map should be from event type to class.
-
-        entityEventDetails = new HashMap<String, String>();
-
-        entityEventDetails.put(EVENT_VM_CREATE, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_DESTROY, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_START, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_STOP, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_REBOOT, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_UPDATE, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_UPGRADE, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_DYNAMIC_SCALE, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_RESETPASSWORD, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_RESETSSHKEY, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_MIGRATE, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_MOVE, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_RESTORE, VirtualMachine.class.getName());
-        entityEventDetails.put(EVENT_VM_EXPUNGE, VirtualMachine.class.getName());
-
-        entityEventDetails.put(EVENT_ROUTER_CREATE, VirtualRouter.class.getName());
-        entityEventDetails.put(EVENT_ROUTER_DESTROY, VirtualRouter.class.getName());
-        entityEventDetails.put(EVENT_ROUTER_START, VirtualRouter.class.getName());
-        entityEventDetails.put(EVENT_ROUTER_STOP, VirtualRouter.class.getName());
-        entityEventDetails.put(EVENT_ROUTER_REBOOT, VirtualRouter.class.getName());
-        entityEventDetails.put(EVENT_ROUTER_HA, VirtualRouter.class.getName());
-        entityEventDetails.put(EVENT_ROUTER_UPGRADE, VirtualRouter.class.getName());
-
-        entityEventDetails.put(EVENT_PROXY_CREATE, "ConsoleProxy");
-        entityEventDetails.put(EVENT_PROXY_DESTROY, "ConsoleProxy");
-        entityEventDetails.put(EVENT_PROXY_START, "ConsoleProxy");
-        entityEventDetails.put(EVENT_PROXY_STOP, "ConsoleProxy");
-        entityEventDetails.put(EVENT_PROXY_REBOOT, "ConsoleProxy");
-        entityEventDetails.put(EVENT_ROUTER_HA, "ConsoleProxy");
-        entityEventDetails.put(EVENT_PROXY_HA, "ConsoleProxy");
+
+        entityEventDetails = new HashMap<String, Object>();
+
+        entityEventDetails.put(EVENT_VM_CREATE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_DESTROY, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_START, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_STOP, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_REBOOT, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_UPDATE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_UPGRADE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_DYNAMIC_SCALE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_RESETPASSWORD, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_RESETSSHKEY, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_MIGRATE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_MOVE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_RESTORE, VirtualMachine.class);
+        entityEventDetails.put(EVENT_VM_EXPUNGE, VirtualMachine.class);
+
+        entityEventDetails.put(EVENT_ROUTER_CREATE, VirtualRouter.class);
+        entityEventDetails.put(EVENT_ROUTER_DESTROY, VirtualRouter.class);
+        entityEventDetails.put(EVENT_ROUTER_START, VirtualRouter.class);
+        entityEventDetails.put(EVENT_ROUTER_STOP, VirtualRouter.class);
+        entityEventDetails.put(EVENT_ROUTER_REBOOT, VirtualRouter.class);
+        entityEventDetails.put(EVENT_ROUTER_HA, VirtualRouter.class);
+        entityEventDetails.put(EVENT_ROUTER_UPGRADE, VirtualRouter.class);
+
+        entityEventDetails.put(EVENT_PROXY_CREATE, ConsoleProxy.class);
+        entityEventDetails.put(EVENT_PROXY_DESTROY, ConsoleProxy.class);
+        entityEventDetails.put(EVENT_PROXY_START, ConsoleProxy.class);
+        entityEventDetails.put(EVENT_PROXY_STOP, ConsoleProxy.class);
+        entityEventDetails.put(EVENT_PROXY_REBOOT, ConsoleProxy.class);
+        entityEventDetails.put(EVENT_ROUTER_HA, ConsoleProxy.class);
+        entityEventDetails.put(EVENT_PROXY_HA, ConsoleProxy.class);
 
         entityEventDetails.put(EVENT_VNC_CONNECT, "VNC");
         entityEventDetails.put(EVENT_VNC_DISCONNECT, "VNC");
 
         // Network Events
-        entityEventDetails.put(EVENT_NETWORK_CREATE, Network.class.getName());
-        entityEventDetails.put(EVENT_NETWORK_DELETE, Network.class.getName());
-        entityEventDetails.put(EVENT_NETWORK_UPDATE, Network.class.getName());
-        entityEventDetails.put(EVENT_NETWORK_RESTART, Network.class.getName());
-        entityEventDetails.put(EVENT_NET_IP_ASSIGN, PublicIpAddress.class.getName());
-        entityEventDetails.put(EVENT_NET_IP_RELEASE, PublicIpAddress.class.getName());
-        entityEventDetails.put(EVENT_NET_RULE_ADD, Network.class.getName());
-        entityEventDetails.put(EVENT_NET_RULE_DELETE, Network.class.getName());
-        entityEventDetails.put(EVENT_NET_RULE_MODIFY, Network.class.getName());
-        entityEventDetails.put(EVENT_FIREWALL_OPEN, Network.class.getName());
-        entityEventDetails.put(EVENT_FIREWALL_CLOSE, Network.class.getName());
+        entityEventDetails.put(EVENT_NETWORK_CREATE, Network.class);
+        entityEventDetails.put(EVENT_NETWORK_DELETE, Network.class);
+        entityEventDetails.put(EVENT_NETWORK_UPDATE, Network.class);
+        entityEventDetails.put(EVENT_NETWORK_RESTART, Network.class);
+        entityEventDetails.put(EVENT_NET_IP_ASSIGN, PublicIpAddress.class);
+        entityEventDetails.put(EVENT_NET_IP_RELEASE, PublicIpAddress.class);
+        entityEventDetails.put(EVENT_NET_RULE_ADD, Network.class);
+        entityEventDetails.put(EVENT_NET_RULE_DELETE, Network.class);
+        entityEventDetails.put(EVENT_NET_RULE_MODIFY, Network.class);
+        entityEventDetails.put(EVENT_FIREWALL_OPEN, Network.class);
+        entityEventDetails.put(EVENT_FIREWALL_CLOSE, Network.class);
 
         // Load Balancers
-        entityEventDetails.put(EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LOAD_BALANCER_CREATE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LOAD_BALANCER_DELETE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_CREATE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_DELETE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LOAD_BALANCER_UPDATE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LB_CERT_UPLOAD, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LB_CERT_DELETE, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LB_CERT_ASSIGN, LoadBalancer.class.getName());
-        entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class.getName());
+        entityEventDetails.put(EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LOAD_BALANCER_CREATE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LOAD_BALANCER_DELETE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_CREATE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_DELETE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LOAD_BALANCER_UPDATE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LB_CERT_UPLOAD, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LB_CERT_DELETE, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LB_CERT_ASSIGN, LoadBalancer.class);
+        entityEventDetails.put(EVENT_LB_CERT_REMOVE, LoadBalancer.class);
 
         // Account events
-        entityEventDetails.put(EVENT_ACCOUNT_ENABLE, Account.class.getName());
-        entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class.getName());
-        entityEventDetails.put(EVENT_ACCOUNT_CREATE, Account.class.getName());
-        entityEventDetails.put(EVENT_ACCOUNT_DELETE, Account.class.getName());
-        entityEventDetails.put(EVENT_ACCOUNT_UPDATE, Account.class.getName());
-        entityEventDetails.put(EVENT_ACCOUNT_MARK_DEFAULT_ZONE, Account.class.getName());
+        entityEventDetails.put(EVENT_ACCOUNT_ENABLE, Account.class);
+        entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class);
+        entityEventDetails.put(EVENT_ACCOUNT_CREATE, Account.class);
+        entityEventDetails.put(EVENT_ACCOUNT_DELETE, Account.class);
+        entityEventDetails.put(EVENT_ACCOUNT_UPDATE, Account.class);
+        entityEventDetails.put(EVENT_ACCOUNT_MARK_DEFAULT_ZONE, Account.class);
 
         // UserVO Events
-        entityEventDetails.put(EVENT_USER_LOGIN, User.class.getName());
-        entityEventDetails.put(EVENT_USER_LOGOUT, User.class.getName());
-        entityEventDetails.put(EVENT_USER_CREATE, User.class.getName());
-        entityEventDetails.put(EVENT_USER_DELETE, User.class.getName());
-        entityEventDetails.put(EVENT_USER_DISABLE, User.class.getName());
-        entityEventDetails.put(EVENT_USER_UPDATE, User.class.getName());
-        entityEventDetails.put(EVENT_USER_ENABLE, User.class.getName());
-        entityEventDetails.put(EVENT_USER_LOCK, User.class.getName());
+        entityEventDetails.put(EVENT_USER_LOGIN, User.class);
+        entityEventDetails.put(EVENT_USER_LOGOUT, User.class);
+        entityEventDetails.put(EVENT_USER_CREATE, User.class);
+        entityEventDetails.put(EVENT_USER_DELETE, User.class);
+        entityEventDetails.put(EVENT_USER_DISABLE, User.class);
+        entityEventDetails.put(EVENT_USER_UPDATE, User.class);
+        entityEventDetails.put(EVENT_USER_ENABLE, User.class);
+        entityEventDetails.put(EVENT_USER_LOCK, User.class);
 
         // Template Events
-        entityEventDetails.put(EVENT_TEMPLATE_CREATE, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_DELETE, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_UPDATE, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_START, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_SUCCESS, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_FAILED, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_COPY, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_EXTRACT, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_UPLOAD, VirtualMachineTemplate.class.getName());
-        entityEventDetails.put(EVENT_TEMPLATE_CLEANUP, VirtualMachineTemplate.class.getName());
+        entityEventDetails.put(EVENT_TEMPLATE_CREATE, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_DELETE, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_UPDATE, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_START, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_SUCCESS, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_FAILED, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_COPY, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_EXTRACT, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_UPLOAD, VirtualMachineTemplate.class);
+        entityEventDetails.put(EVENT_TEMPLATE_CLEANUP, VirtualMachineTemplate.class);
 
         // Volume Events
-        entityEventDetails.put(EVENT_VOLUME_CREATE, Volume.class.getName());
-        entityEventDetails.put(EVENT_VOLUME_DELETE, Volume.class.getName());
-        entityEventDetails.put(EVENT_VOLUME_ATTACH, Volume.class.getName());
-        entityEventDetails.put(EVENT_VOLUME_DETACH, Volume.class.getName());
-        entityEventDetails.put(EVENT_VOLUME_EXTRACT, Volume.class.getName());
-        entityEventDetails.put(EVENT_VOLUME_UPLOAD, Volume.class.getName());
-        entityEventDetails.put(EVENT_VOLUME_MIGRATE, Volume.class.getName());
-        entityEventDetails.put(EVENT_VOLUME_RESIZE, Volume.class.getName());
+        entityEventDetails.put(EVENT_VOLUME_CREATE, Volume.class);
+        entityEventDetails.put(EVENT_VOLUME_DELETE, Volume.class);
+        entityEventDetails.put(EVENT_VOLUME_ATTACH, Volume.class);
+        entityEventDetails.put(EVENT_VOLUME_DETACH, Volume.class);
+        entityEventDetails.put(EVENT_VOLUME_EXTRACT, Volume.class);
+        entityEventDetails.put(EVENT_VOLUME_UPLOAD, Volume.class);
+        entityEventDetails.put(EVENT_VOLUME_MIGRATE, Volume.class);
+        entityEventDetails.put(EVENT_VOLUME_RESIZE, Volume.class);
 
         // Domains
-        entityEventDetails.put(EVENT_DOMAIN_CREATE, Domain.class.getName());
-        entityEventDetails.put(EVENT_DOMAIN_DELETE, Domain.class.getName());
-        entityEventDetails.put(EVENT_DOMAIN_UPDATE, Domain.class.getName());
+        entityEventDetails.put(EVENT_DOMAIN_CREATE, Domain.class);
+        entityEventDetails.put(EVENT_DOMAIN_DELETE, Domain.class);
+        entityEventDetails.put(EVENT_DOMAIN_UPDATE, Domain.class);
 
         // Snapshots
-        entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class.getName());
-        entityEventDetails.put(EVENT_SNAPSHOT_DELETE, Snapshot.class.getName());
-        entityEventDetails.put(EVENT_SNAPSHOT_POLICY_CREATE, Snapshot.class.getName());
-        entityEventDetails.put(EVENT_SNAPSHOT_POLICY_UPDATE, Snapshot.class.getName());
-        entityEventDetails.put(EVENT_SNAPSHOT_POLICY_DELETE, Snapshot.class.getName());
+        entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class);
+        entityEventDetails.put(EVENT_SNAPSHOT_DELETE, Snapshot.class);
+        entityEventDetails.put(EVENT_SNAPSHOT_POLICY_CREATE, Snapshot.class);
+        entityEventDetails.put(EVENT_SNAPSHOT_POLICY_UPDATE, Snapshot.class);
+        entityEventDetails.put(EVENT_SNAPSHOT_POLICY_DELETE, Snapshot.class);
 
         // ISO
         entityEventDetails.put(EVENT_ISO_CREATE, "Iso");
@@ -619,129 +620,129 @@ public class EventTypes {
         entityEventDetails.put(EVENT_ISO_UPLOAD, "Iso");
 
         // SSVM
-        entityEventDetails.put(EVENT_SSVM_CREATE, "SecondaryStorageVm");
-        entityEventDetails.put(EVENT_SSVM_DESTROY, "SecondaryStorageVm");
-        entityEventDetails.put(EVENT_SSVM_START, "SecondaryStorageVm");
-        entityEventDetails.put(EVENT_SSVM_STOP, "SecondaryStorageVm");
-        entityEventDetails.put(EVENT_SSVM_REBOOT, "SecondaryStorageVm");
-        entityEventDetails.put(EVENT_SSVM_HA, "SecondaryStorageVm");
+        entityEventDetails.put(EVENT_SSVM_CREATE, SecondaryStorageVm.class);
+        entityEventDetails.put(EVENT_SSVM_DESTROY, SecondaryStorageVm.class);
+        entityEventDetails.put(EVENT_SSVM_START, SecondaryStorageVm.class);
+        entityEventDetails.put(EVENT_SSVM_STOP, SecondaryStorageVm.class);
+        entityEventDetails.put(EVENT_SSVM_REBOOT, SecondaryStorageVm.class);
+        entityEventDetails.put(EVENT_SSVM_HA, SecondaryStorageVm.class);
 
         // Service Offerings
-        entityEventDetails.put(EVENT_SERVICE_OFFERING_CREATE, ServiceOffering.class.getName());
-        entityEventDetails.put(EVENT_SERVICE_OFFERING_EDIT, ServiceOffering.class.getName());
-        entityEventDetails.put(EVENT_SERVICE_OFFERING_DELETE, ServiceOffering.class.getName());
+        entityEventDetails.put(EVENT_SERVICE_OFFERING_CREATE, ServiceOffering.class);
+        entityEventDetails.put(EVENT_SERVICE_OFFERING_EDIT, ServiceOffering.class);
+        entityEventDetails.put(EVENT_SERVICE_OFFERING_DELETE, ServiceOffering.class);
 
         // Disk Offerings
-        entityEventDetails.put(EVENT_DISK_OFFERING_CREATE, DiskOffering.class.getName());
-        entityEventDetails.put(EVENT_DISK_OFFERING_EDIT, DiskOffering.class.getName());
-        entityEventDetails.put(EVENT_DISK_OFFERING_DELETE, DiskOffering.class.getName());
+        entityEventDetails.put(EVENT_DISK_OFFERING_CREATE, DiskOffering.class);
+        entityEventDetails.put(EVENT_DISK_OFFERING_EDIT, DiskOffering.class);
+        entityEventDetails.put(EVENT_DISK_OFFERING_DELETE, DiskOffering.class);
 
         // Network offerings
-        entityEventDetails.put(EVENT_NETWORK_OFFERING_CREATE, NetworkOffering.class.getName());
-        entityEventDetails.put(EVENT_NETWORK_OFFERING_ASSIGN, NetworkOffering.class.getName());
-        entityEventDetails.put(EVENT_NETWORK_OFFERING_EDIT, NetworkOffering.class.getName());
-        entityEventDetails.put(EVENT_NETWORK_OFFERING_REMOVE, NetworkOffering.class.getName());
-        entityEventDetails.put(EVENT_NETWORK_OFFERING_DELETE, NetworkOffering.class.getName());
+        entityEventDetails.put(EVENT_NETWORK_OFFERING_CREATE, NetworkOffering.class);
+        entityEventDetails.put(EVENT_NETWORK_OFFERING_ASSIGN, NetworkOffering.class);
+        entityEventDetails.put(EVENT_NETWORK_OFFERING_EDIT, NetworkOffering.class);
+        entityEventDetails.put(EVENT_NETWORK_OFFERING_REMOVE, NetworkOffering.class);
+        entityEventDetails.put(EVENT_NETWORK_OFFERING_DELETE, NetworkOffering.class);
 
         // Pods
-        entityEventDetails.put(EVENT_POD_CREATE, Pod.class.getName());
-        entityEventDetails.put(EVENT_POD_EDIT, Pod.class.getName());
-        entityEventDetails.put(EVENT_POD_DELETE, Pod.class.getName());
+        entityEventDetails.put(EVENT_POD_CREATE, Pod.class);
+        entityEventDetails.put(EVENT_POD_EDIT, Pod.class);
+        entityEventDetails.put(EVENT_POD_DELETE, Pod.class);
 
         // Zones
-        entityEventDetails.put(EVENT_ZONE_CREATE, DataCenter.class.getName());
-        entityEventDetails.put(EVENT_ZONE_EDIT, DataCenter.class.getName());
-        entityEventDetails.put(EVENT_ZONE_DELETE, DataCenter.class.getName());
+        entityEventDetails.put(EVENT_ZONE_CREATE, DataCenter.class);
+        entityEventDetails.put(EVENT_ZONE_EDIT, DataCenter.class);
+        entityEventDetails.put(EVENT_ZONE_DELETE, DataCenter.class);
 
         // VLANs/IP ranges
-        entityEventDetails.put(EVENT_VLAN_IP_RANGE_CREATE, Vlan.class.getName());
-        entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE, Vlan.class.getName());
-        entityEventDetails.put(EVENT_VLAN_IP_RANGE_DEDICATE, Vlan.class.getName());
-        entityEventDetails.put(EVENT_VLAN_IP_RANGE_RELEASE, Vlan.class.getName());
+        entityEventDetails.put(EVENT_VLAN_IP_RANGE_CREATE, Vlan.class);
+        entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE, Vlan.class);
+        entityEventDetails.put(EVENT_VLAN_IP_RANGE_DEDICATE, Vlan.class);
+        entityEventDetails.put(EVENT_VLAN_IP_RANGE_RELEASE, Vlan.class);
 
-        entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class.getName());
-        entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class.getName());
-        entityEventDetails.put(EVENT_STORAGE_IP_RANGE_UPDATE, StorageNetworkIpRange.class.getName());
+        entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class);
+        entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class);
+        entityEventDetails.put(EVENT_STORAGE_IP_RANGE_UPDATE, StorageNetworkIpRange.class);
 
         // Configuration Table
-        entityEventDetails.put(EVENT_CONFIGURATION_VALUE_EDIT, Configuration.class.getName());
+        entityEventDetails.put(EVENT_CONFIGURATION_VALUE_EDIT, Configuration.class);
 
         // Security Groups
-        entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS, SecurityGroup.class.getName());
-        entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_INGRESS, SecurityGroup.class.getName());
-        entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS, SecurityGroup.class.getName());
-        entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_EGRESS, SecurityGroup.class.getName());
-        entityEventDetails.put(EVENT_SECURITY_GROUP_CREATE, SecurityGroup.class.getName());
-        entityEventDetails.put(EVENT_SECURITY_GROUP_DELETE, SecurityGroup.class.getName());
-        entityEventDetails.put(EVENT_SECURITY_GROUP_ASSIGN, SecurityGroup.class.getName());
-        entityEventDetails.put(EVENT_SECURITY_GROUP_REMOVE, SecurityGroup.class.getName());
+        entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS, SecurityGroup.class);
+        entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_INGRESS, SecurityGroup.class);
+        entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS, SecurityGroup.class);
+        entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_EGRESS, SecurityGroup.class);
+        entityEventDetails.put(EVENT_SECURITY_GROUP_CREATE, SecurityGroup.class);
+        entityEventDetails.put(EVENT_SECURITY_GROUP_DELETE, SecurityGroup.class);
+        entityEventDetails.put(EVENT_SECURITY_GROUP_ASSIGN, SecurityGroup.class);
+        entityEventDetails.put(EVENT_SECURITY_GROUP_REMOVE, SecurityGroup.class);
 
         // Host
-        entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class.getName());
+        entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class);
 
         // Maintenance
-        entityEventDetails.put(EVENT_MAINTENANCE_CANCEL, Host.class.getName());
-        entityEventDetails.put(EVENT_MAINTENANCE_CANCEL_PRIMARY_STORAGE, Host.class.getName());
-        entityEventDetails.put(EVENT_MAINTENANCE_PREPARE, Host.class.getName());
-        entityEventDetails.put(EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE, Host.class.getName());
+        entityEventDetails.put(EVENT_MAINTENANCE_CANCEL, Host.class);
+        entityEventDetails.put(EVENT_MAINTENANCE_CANCEL_PRIMARY_STORAGE, Host.class);
+        entityEventDetails.put(EVENT_MAINTENANCE_PREPARE, Host.class);
+        entityEventDetails.put(EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE, Host.class);
 
         // VPN
-        entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_CREATE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_DESTROY, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_VPN_USER_ADD, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_VPN_USER_REMOVE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_CREATE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_DELETE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, RemoteAccessVpn.class.getName());
-        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, RemoteAccessVpn.class.getName());
+        entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_CREATE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_DESTROY, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_VPN_USER_ADD, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_VPN_USER_REMOVE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_CREATE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_DELETE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, RemoteAccessVpn.class);
+        entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, RemoteAccessVpn.class);
 
         // Custom certificates
         entityEventDetails.put(EVENT_UPLOAD_CUSTOM_CERTIFICATE, "Certificate");
 
         // OneToOnenat
-        entityEventDetails.put(EVENT_ENABLE_STATIC_NAT, StaticNat.class.getName());
-        entityEventDetails.put(EVENT_DISABLE_STATIC_NAT, StaticNat.class.getName());
+        entityEventDetails.put(EVENT_ENABLE_STATIC_NAT, StaticNat.class);
+        entityEventDetails.put(EVENT_DISABLE_STATIC_NAT, StaticNat.class);
 
-        entityEventDetails.put(EVENT_ZONE_VLAN_ASSIGN, Vlan.class.getName());
-        entityEventDetails.put(EVENT_ZONE_VLAN_RELEASE, Vlan.class.getName());
+        entityEventDetails.put(EVENT_ZONE_VLAN_ASSIGN, Vlan.class);
+        entityEventDetails.put(EVENT_ZONE_VLAN_RELEASE, Vlan.class);
 
         // Projects
-        entityEventDetails.put(EVENT_PROJECT_CREATE, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_UPDATE, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_DELETE, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_ACTIVATE, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_SUSPEND, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_ACCOUNT_ADD, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_INVITATION_UPDATE, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_INVITATION_REMOVE, Project.class.getName());
-        entityEventDetails.put(EVENT_PROJECT_ACCOUNT_REMOVE, Project.class.getName());
+        entityEventDetails.put(EVENT_PROJECT_CREATE, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_UPDATE, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_DELETE, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_ACTIVATE, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_SUSPEND, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_ACCOUNT_ADD, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_INVITATION_UPDATE, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_INVITATION_REMOVE, Project.class);
+        entityEventDetails.put(EVENT_PROJECT_ACCOUNT_REMOVE, Project.class);
 
         // Network as a Service
-        entityEventDetails.put(EVENT_NETWORK_ELEMENT_CONFIGURE, Network.class.getName());
+        entityEventDetails.put(EVENT_NETWORK_ELEMENT_CONFIGURE, Network.class);
 
         // Physical Network Events
-        entityEventDetails.put(EVENT_PHYSICAL_NETWORK_CREATE, PhysicalNetwork.class.getName());
-        entityEventDetails.put(EVENT_PHYSICAL_NETWORK_DELETE, PhysicalNetwork.class.getName());
-        entityEventDetails.put(EVENT_PHYSICAL_NETWORK_UPDATE, PhysicalNetwork.class.getName());
+        entityEventDetails.put(EVENT_PHYSICAL_NETWORK_CREATE, PhysicalNetwork.class);
+        entityEventDetails.put(EVENT_PHYSICAL_NETWORK_DELETE, PhysicalNetwork.class);
+        entityEventDetails.put(EVENT_PHYSICAL_NETWORK_UPDATE, PhysicalNetwork.class);
 
         // Physical Network Service Provider Events
-        entityEventDetails.put(EVENT_SERVICE_PROVIDER_CREATE, PhysicalNetworkServiceProvider.class.getName());
-        entityEventDetails.put(EVENT_SERVICE_PROVIDER_DELETE, PhysicalNetworkServiceProvider.class.getName());
-        entityEventDetails.put(EVENT_SERVICE_PROVIDER_UPDATE, PhysicalNetworkServiceProvider.class.getName());
+        entityEventDetails.put(EVENT_SERVICE_PROVIDER_CREATE, PhysicalNetworkServiceProvider.class);
+        entityEventDetails.put(EVENT_SERVICE_PROVIDER_DELETE, PhysicalNetworkServiceProvider.class);
+        entityEventDetails.put(EVENT_SERVICE_PROVIDER_UPDATE, PhysicalNetworkServiceProvider.class);
 
         // Physical Network TrafficType Events
-        entityEventDetails.put(EVENT_TRAFFIC_TYPE_CREATE, PhysicalNetworkTrafficType.class.getName());
-        entityEventDetails.put(EVENT_TRAFFIC_TYPE_DELETE, PhysicalNetworkTrafficType.class.getName());
-        entityEventDetails.put(EVENT_TRAFFIC_TYPE_UPDATE, PhysicalNetworkTrafficType.class.getName());
+        entityEventDetails.put(EVENT_TRAFFIC_TYPE_CREATE, PhysicalNetworkTrafficType.class);
+        entityEventDetails.put(EVENT_TRAFFIC_TYPE_DELETE, PhysicalNetworkTrafficType.class);
+        entityEventDetails.put(EVENT_TRAFFIC_TYPE_UPDATE, PhysicalNetworkTrafficType.class);
 
         // external network device events
-        entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_ADD, PhysicalNetwork.class.getName());
-        entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_DELETE, PhysicalNetwork.class.getName());
-        entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_CONFIGURE, PhysicalNetwork.class.getName());
+        entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_ADD, PhysicalNetwork.class);
+        entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_DELETE, PhysicalNetwork.class);
+        entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_CONFIGURE, PhysicalNetwork.class);
 
         // external switch management device events (E.g.: Cisco Nexus 1000v Virtual Supervisor Module.
         entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ADD, "Nexus1000v");
@@ -750,32 +751,32 @@ public class EventTypes {
         entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, "Nexus1000v");
         entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE, "Nexus1000v");
 
-        entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_ADD, PhysicalNetwork.class.getName());
-        entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE, PhysicalNetwork.class.getName());
-        entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE, PhysicalNetwork.class.getName());
+        entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_ADD, PhysicalNetwork.class);
+        entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE, PhysicalNetwork.class);
+        entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE, PhysicalNetwork.class);
 
         // VPC
-        entityEventDetails.put(EVENT_VPC_CREATE, Vpc.class.getName());
-        entityEventDetails.put(EVENT_VPC_UPDATE, Vpc.class.getName());
-        entityEventDetails.put(EVENT_VPC_DELETE, Vpc.class.getName());
-        entityEventDetails.put(EVENT_VPC_RESTART, Vpc.class.getName());
+        entityEventDetails.put(EVENT_VPC_CREATE, Vpc.class);
+        entityEventDetails.put(EVENT_VPC_UPDATE, Vpc.class);
+        entityEventDetails.put(EVENT_VPC_DELETE, Vpc.class);
+        entityEventDetails.put(EVENT_VPC_RESTART, Vpc.class);
 
         // VPC offerings
-        entityEventDetails.put(EVENT_VPC_OFFERING_CREATE, Vpc.class.getName());
-        entityEventDetails.put(EVENT_VPC_OFFERING_UPDATE, Vpc.class.getName());
-        entityEventDetails.put(EVENT_VPC_OFFERING_DELETE, Vpc.class.getName());
+        entityEventDetails.put(EVENT_VPC_OFFERING_CREATE, Vpc.class);
+        entityEventDetails.put(EVENT_VPC_OFFERING_UPDATE, Vpc.class);
+        entityEventDetails.put(EVENT_VPC_OFFERING_DELETE, Vpc.class);
 
         // Private gateway
-        entityEventDetails.put(EVENT_PRIVATE_GATEWAY_CREATE, PrivateGateway.class.getName());
-        entityEventDetails.put(EVENT_PRIVATE_GATEWAY_DELETE, PrivateGateway.class.getName());
+        entityEventDetails.put(EVENT_PRIVATE_GATEWAY_CREATE, PrivateGateway.class);
+        entityEventDetails.put(EVENT_PRIVATE_GATEWAY_DELETE, PrivateGateway.class);
 
         // Static routes
-        entityEventDetails.put(EVENT_STATIC_ROUTE_CREATE, StaticRoute.class.getName());
-        entityEventDetails.put(EVENT_STATIC_ROUTE_DELETE, StaticRoute.class.getName());
+        entityEventDetails.put(EVENT_STATIC_ROUTE_CREATE, StaticRoute.class);
+        entityEventDetails.put(EVENT_STATIC_ROUTE_DELETE, StaticRoute.class);
 
         // tag related events
-        entityEventDetails.put(EVENT_TAGS_CREATE, "Tag");
-        entityEventDetails.put(EVENT_TAGS_DELETE, "tag");
+        entityEventDetails.put(EVENT_TAGS_CREATE, ResourceTag.class);
+        entityEventDetails.put(EVENT_TAGS_DELETE, ResourceTag.class);
 
         // external network device events
         entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_ADD, "NvpController");
@@ -783,23 +784,23 @@ public class EventTypes {
         entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_CONFIGURE, "NvpController");
 
         // AutoScale
-        entityEventDetails.put(EVENT_COUNTER_CREATE, AutoScaleCounter.class.getName());
-        entityEventDetails.put(EVENT_COUNTER_DELETE, AutoScaleCounter.class.getName());
-        entityEventDetails.put(EVENT_CONDITION_CREATE, Condition.class.getName());
-        entityEventDetails.put(EVENT_CONDITION_DELETE, Condition.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEPOLICY_CREATE, AutoScalePolicy.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEPOLICY_UPDATE, AutoScalePolicy.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEPOLICY_DELETE, AutoScalePolicy.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_CREATE, AutoScaleVmProfile.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_DELETE, AutoScaleVmProfile.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_UPDATE, AutoScaleVmProfile.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_CREATE, AutoScaleVmGroup.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DELETE, AutoScaleVmGroup.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName());
-        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
-        entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
-        entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
+        entityEventDetails.put(EVENT_COUNTER_CREATE, AutoScaleCounter.class);
+        entityEventDetails.put(EVENT_COUNTER_DELETE, AutoScaleCounter.class);
+        entityEventDetails.put(EVENT_CONDITION_CREATE, Condition.class);
+        entityEventDetails.put(EVENT_CONDITION_DELETE, Condition.class);
+        entityEventDetails.put(EVENT_AUTOSCALEPOLICY_CREATE, AutoScalePolicy.class);
+        entityEventDetails.put(EVENT_AUTOSCALEPOLICY_UPDATE, AutoScalePolicy.class);
+        entityEventDetails.put(EVENT_AUTOSCALEPOLICY_DELETE, AutoScalePolicy.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_CREATE, AutoScaleVmProfile.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_DELETE, AutoScaleVmProfile.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_UPDATE, AutoScaleVmProfile.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_CREATE, AutoScaleVmGroup.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DELETE, AutoScaleVmGroup.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class);
+        entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class);
+        entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class);
+        entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class);
 
         // OpenDaylight
         entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_ADD_CONTROLLER, "OpenDaylightController");
@@ -807,24 +808,40 @@ public class EventTypes {
         entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER, "OpenDaylightController");
 
         //Guest OS
-        entityEventDetails.put(EVENT_GUEST_OS_ADD, GuestOS.class.getName());
-        entityEventDetails.put(EVENT_GUEST_OS_REMOVE, GuestOS.class.getName());
-        entityEventDetails.put(EVENT_GUEST_OS_UPDATE, GuestOS.class.getName());
-        entityEventDetails.put(EVENT_GUEST_OS_MAPPING_ADD, GuestOSHypervisor.class.getName());
-        entityEventDetails.put(EVENT_GUEST_OS_MAPPING_REMOVE, GuestOSHypervisor.class.getName());
-        entityEventDetails.put(EVENT_GUEST_OS_MAPPING_UPDATE, GuestOSHypervisor.class.getName());
+        entityEventDetails.put(EVENT_GUEST_OS_ADD, GuestOS.class);
+        entityEventDetails.put(EVENT_GUEST_OS_REMOVE, GuestOS.class);
+        entityEventDetails.put(EVENT_GUEST_OS_UPDATE, GuestOS.class);
+        entityEventDetails.put(EVENT_GUEST_OS_MAPPING_ADD, GuestOSHypervisor.class);
+        entityEventDetails.put(EVENT_GUEST_OS_MAPPING_REMOVE, GuestOSHypervisor.class);
+        entityEventDetails.put(EVENT_GUEST_OS_MAPPING_UPDATE, GuestOSHypervisor.class);
     }
 
     public static String getEntityForEvent(String eventName) {
-        String entityClassName = entityEventDetails.get(eventName);
-        if (entityClassName == null || entityClassName.isEmpty()) {
+        Object entityClass = entityEventDetails.get(eventName);
+        if (entityClass == null) {
             return null;
+        } else if (entityClass instanceof String){
+            return (String)entityClass;
+        } else if (entityClass instanceof Class){
+            String entityClassName = ((Class)entityClass).getName();
+            int index = entityClassName.lastIndexOf(".");
+            String entityName = entityClassName;
+            if (index != -1) {
+                entityName = entityClassName.substring(index + 1);
+            }
+            return entityName;
         }
-        int index = entityClassName.lastIndexOf(".");
-        String entityName = entityClassName;
-        if (index != -1) {
-            entityName = entityClassName.substring(index + 1);
+
+        return null;
+    }
+
+    public static Class getEntityClassForEvent(String eventName) {
+        Object clz = entityEventDetails.get(eventName);
+
+        if(clz instanceof Class){
+            return (Class)entityEventDetails.get(eventName);
         }
-        return entityName;
+
+        return null;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index e7cfd64..34387eb 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -20,6 +20,7 @@ import java.util.Date;
 import java.util.Map;
 
 import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Displayable;
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
 
@@ -31,7 +32,7 @@ import com.cloud.utils.fsm.StateObject;
  * VirtualMachine describes the properties held by a virtual machine
  *
  */
-public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachine.State> {
+public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, Displayable, StateObject<VirtualMachine.State> {
 
     public enum PowerState {
         PowerUnknown,
@@ -321,6 +322,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
 
     long getUpdated();
 
+    @Override
     boolean isDisplay();
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
index 0b1396f..82886aa 100644
--- a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java
@@ -17,6 +17,10 @@
 package org.apache.cloudstack.api;
 
 
+import com.cloud.event.EventTypes;
+import org.apache.cloudstack.context.CallContext;
+import org.apache.log4j.Logger;
+
 /**
  * queryAsyncJobResult API command.
  */
@@ -27,6 +31,7 @@ public abstract class BaseAsyncCmd extends BaseCmd {
     public static final String vpcSyncObject = "vpc";
     public static final String snapshotHostSyncObject = "snapshothost";
     public static final String gslbSyncObject = "globalserverloadbalacner";
+    private static final Logger s_logger = Logger.getLogger(BaseAsyncCmd.class.getName());
 
     private Object job;
 
@@ -89,4 +94,27 @@ public abstract class BaseAsyncCmd extends BaseCmd {
     public Object getJob() {
         return job;
     }
+
+    @Override
+    public boolean isDisplay(){
+
+        // Get entity Class from the event name. Eg. - Volume.class
+        final CallContext ctx = CallContext.current();
+        Class entityClass = EventTypes.getEntityClassForEvent(getEventType());
+        boolean isDisplay = true;
+
+        try{
+            // If the entity Class implements Displayable interface then see the flag from VO
+            if (entityClass != null && Displayable.class.isAssignableFrom(entityClass)){
+                Object objVO =_entityMgr.findById(entityClass, (Long)ctx.getContextParameter(entityClass.getName()));
+                isDisplay = ((Displayable)objVO).isDisplay();
+                ctx.setEventDisplayEnabled(isDisplay);
+            }
+        }catch (Exception e){
+           s_logger.trace("Caught exception while finding the display property, defaulting to true and moving on " +e);
+        }
+
+        return isDisplay;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index f6f21ae..6a4b4a8 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -360,7 +360,7 @@ public abstract class BaseCmd {
      * display flag is used to control the display of the resource only to the end user. It doesnt affect Root Admin.
      * @return display flag
      */
-    public boolean isDisplayResourceEnabled(){
+    public boolean isDisplay(){
         return true;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/Displayable.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/Displayable.java b/api/src/org/apache/cloudstack/api/Displayable.java
new file mode 100644
index 0000000..2a83c8d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/Displayable.java
@@ -0,0 +1,21 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api;
+
+public interface Displayable {
+    boolean isDisplay();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index cc91013..0adc57b 100755
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -250,6 +250,14 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
         return displayVm;
     }
 
+    @Override
+    public boolean isDisplay() {
+        if(displayVm == null)
+            return true;
+        else
+            return displayVm;
+    }
+
     public List<Long> getSecurityGroupIdList() {
         if (securityGroupNameList != null && securityGroupIdList != null) {
             throw new InvalidParameterValueException("securitygroupids parameter is mutually exclusive with securitygroupnames parameter");
@@ -409,16 +417,6 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
     }
 
     @Override
-    public boolean isDisplayResourceEnabled(){
-        Boolean display = getDisplayVm();
-        if(display == null){
-            return true;
-        } else {
-            return display;
-        }
-    }
-
-    @Override
     public String getEventType() {
         return EventTypes.EVENT_VM_CREATE;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
index 1d0e68d..b437305 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java
@@ -151,7 +151,7 @@ public class UpdateVMCmd extends BaseCustomIdCmd {
     }
 
     @Override
-    public boolean isDisplayResourceEnabled(){
+    public boolean isDisplay(){
         UserVm userVm = _entityMgr.findById(UserVm.class, getId());
         if (userVm != null) {
             return userVm.isDisplayVm();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
index 1923198..dec9243 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
@@ -118,7 +118,7 @@ public class UpgradeVMCmd extends BaseCmd {
     }
 
     @Override
-    public boolean isDisplayResourceEnabled(){
+    public boolean isDisplay(){
         return _userVmService.isDisplayResourceEnabled(getId());
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
index 2a65159..0fa540c 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java
@@ -195,16 +195,6 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd {
     }
 
     @Override
-    public boolean isDisplayResourceEnabled(){
-        Boolean display = getDisplayVolume();
-        if(display == null){
-            return true;
-        } else {
-            return display;
-        }
-    }
-
-    @Override
     public String getEventDescription() {
         return  "creating volume: " + getVolumeName() + ((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId());
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
index 02b80d9..3e267b9 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java
@@ -80,7 +80,7 @@ public class DeleteVolumeCmd extends BaseCmd {
     }
 
     @Override
-    public boolean isDisplayResourceEnabled(){
+    public boolean isDisplay(){
         return _volumeService.isDisplayResourceEnabled(getId());
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
index 3ad6f47..e7e3820 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/UpdateVolumeCmd.java
@@ -131,11 +131,6 @@ public class UpdateVolumeCmd extends BaseAsyncCustomIdCmd {
     }
 
     @Override
-    public boolean isDisplayResourceEnabled(){
-        return _volumeService.isDisplayResourceEnabled(getId());
-    }
-
-    @Override
     public String getEventType() {
         return EventTypes.EVENT_VOLUME_UPDATE;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/api/src/org/apache/cloudstack/context/CallContext.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/context/CallContext.java b/api/src/org/apache/cloudstack/context/CallContext.java
index 661b01d..7305d14 100644
--- a/api/src/org/apache/cloudstack/context/CallContext.java
+++ b/api/src/org/apache/cloudstack/context/CallContext.java
@@ -316,6 +316,17 @@ public class CallContext {
         isEventDisplayEnabled = eventDisplayEnabled;
     }
 
+    public Map<Object, Object> getContextParameters() {
+        return context;
+    }
+
+    public void putContextParameters(Map<Object, Object> details){
+        if (details == null) return;
+        for(Object key : details.keySet()){
+            putContextParameter(key, details.get(key));
+        }
+    }
+
     public static void setActionEventInfo(String eventType, String description) {
         CallContext context = CallContext.current();
         if (context != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
index f037f2e..71adf2a 100644
--- a/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
+++ b/server/src/com/cloud/api/ApiAsyncJobDispatcher.java
@@ -75,6 +75,9 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
             // whenever we deserialize, the UserContext needs to be updated
             String userIdStr = params.get("ctxUserId");
             String acctIdStr = params.get("ctxAccountId");
+            String contextDetails = params.get("ctxDetails");
+
+
             Long userId = null;
             Account accountObject = null;
 
@@ -94,7 +97,12 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
                 accountObject = _entityMgr.findById(Account.class, Long.parseLong(acctIdStr));
             }
 
-            CallContext.register(user, accountObject);
+            CallContext ctx = CallContext.register(user, accountObject);
+            if(contextDetails != null){
+                Type objectMapType = new TypeToken<Map<Object, Object>>() {}.getType();
+                ctx.putContextParameters((Map<Object, Object>) gson.fromJson(contextDetails, objectMapType));
+            }
+
             try {
                 // dispatch could ultimately queue the job
                 _dispatcher.dispatch(cmdObj, params, true);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/src/com/cloud/api/ApiDispatcher.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDispatcher.java b/server/src/com/cloud/api/ApiDispatcher.java
index 3026bee..b6b9b29 100755
--- a/server/src/com/cloud/api/ApiDispatcher.java
+++ b/server/src/com/cloud/api/ApiDispatcher.java
@@ -36,10 +36,7 @@ import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import com.cloud.api.dispatch.DispatchChain;
 import com.cloud.api.dispatch.DispatchChainFactory;
 import com.cloud.api.dispatch.DispatchTask;
-import com.cloud.event.EventTypes;
 import com.cloud.user.AccountManager;
-import com.cloud.utils.ReflectUtil;
-import com.cloud.vm.VirtualMachine;
 
 public class ApiDispatcher {
     private static final Logger s_logger = Logger.getLogger(ApiDispatcher.class.getName());
@@ -75,7 +72,6 @@ public class ApiDispatcher {
 
     public void dispatchCreateCmd(final BaseAsyncCreateCmd cmd, final Map<String, String> params) throws Exception {
         asyncCreationDispatchChain.dispatch(new DispatchTask(cmd, params));
-        CallContext.current().setEventDisplayEnabled(cmd.isDisplayResourceEnabled());
     }
 
     public void dispatch(final BaseCmd cmd, final Map<String, String> params, final boolean execute) throws Exception {
@@ -83,26 +79,15 @@ public class ApiDispatcher {
         standardDispatchChain.dispatch(new DispatchTask(cmd, params));
 
         final CallContext ctx = CallContext.current();
-        ctx.setEventDisplayEnabled(cmd.isDisplayResourceEnabled());
+        ctx.setEventDisplayEnabled(cmd.isDisplay());
 
         // TODO This if shouldn't be here. Use polymorphism and move it to validateSpecificParameters
         if (cmd instanceof BaseAsyncCmd) {
 
             final BaseAsyncCmd asyncCmd = (BaseAsyncCmd)cmd;
             final String startEventId = params.get(ApiConstants.CTX_START_EVENT_ID);
-            String uuid = params.get(ApiConstants.UUID);
             ctx.setStartEventId(Long.valueOf(startEventId));
 
-            // Fow now use the key from EventTypes.java rather than getInstanceType bcz the later doesn't refer to the interfaces
-            // Add the resource id in the call context, also add some other first class object ids (for now vm) if available.
-            // TODO - this should be done for all the uuids passed in the cmd - so should be moved where uuid to id conversion happens.
-            if(EventTypes.getEntityForEvent(asyncCmd.getEventType()) != null){
-                ctx.putContextParameter(EventTypes.getEntityForEvent(asyncCmd.getEventType()), uuid);
-            }
-            if(params.get(ApiConstants.VIRTUAL_MACHINE_ID) != null){
-                ctx.putContextParameter(ReflectUtil.getEntityName(VirtualMachine.class), params.get(ApiConstants.VIRTUAL_MACHINE_ID));
-            }
-
             // Synchronise job on the object if needed
             if (asyncCmd.getJob() != null && asyncCmd.getSyncObjId() != null && asyncCmd.getSyncObjType() != null) {
                 Long queueSizeLimit = null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index e4486c1..50b6869 100755
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -148,7 +148,6 @@ import com.cloud.user.UserAccount;
 import com.cloud.user.UserVO;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
-import com.cloud.utils.ReflectUtil;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.component.ManagerBase;
@@ -159,7 +158,6 @@ import com.cloud.utils.db.SearchCriteria;
 import com.cloud.utils.db.TransactionLegacy;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.ExceptionProxyObject;
-import com.cloud.vm.VirtualMachine;
 
 @Component
 public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiServerService {
@@ -511,7 +509,6 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
         final CallContext ctx = CallContext.current();
         final Long callerUserId = ctx.getCallingUserId();
         final Account caller = ctx.getCallingAccount();
-        String vmUUID = params.get(ApiConstants.VIRTUAL_MACHINE_ID);
 
         // Queue command based on Cmd super class:
         // BaseCmd: cmd is dispatched to ApiDispatcher, executed, serialized and returned.
@@ -526,6 +523,9 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
                 objectId = createCmd.getEntityId();
                 objectUuid = createCmd.getEntityUuid();
                 params.put("id", objectId.toString());
+                Class entityClass = EventTypes.getEntityClassForEvent(createCmd.getEventType());
+                if(entityClass != null)
+                    ctx.putContextParameter(entityClass.getName(), objectId);
             } else {
                 // Extract the uuid before params are processed and id reflects internal db id
                 objectUuid = params.get(ApiConstants.ID);
@@ -552,14 +552,11 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
             if(EventTypes.getEntityForEvent(asyncCmd.getEventType()) != null){
                 ctx.putContextParameter(EventTypes.getEntityForEvent(asyncCmd.getEventType()), objectUuid);
             }
-            if(vmUUID != null){
-                ctx.putContextParameter(ReflectUtil.getEntityName(VirtualMachine.class), vmUUID);
-            }
 
             // save the scheduled event
             final Long eventId =
                 ActionEventUtils.onScheduledActionEvent((callerUserId == null) ? User.UID_SYSTEM : callerUserId, asyncCmd.getEntityOwnerId(), asyncCmd.getEventType(),
-                    asyncCmd.getEventDescription(), asyncCmd.isDisplayResourceEnabled(), startEventId);
+                    asyncCmd.getEventDescription(), asyncCmd.isDisplay(), startEventId);
             if (startEventId == 0) {
                 // There was no create event before, set current event id as start eventId
                 startEventId = eventId;
@@ -567,6 +564,7 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
 
             params.put("ctxStartEventId", String.valueOf(startEventId));
             params.put("cmdEventType", asyncCmd.getEventType().toString());
+            params.put("ctxDetails", ApiGsonHelper.getBuilder().create().toJson(ctx.getContextParameters()));
 
             Long instanceId = (objectId == null) ? asyncCmd.getInstanceId() : objectId;
             AsyncJobVO job = new AsyncJobVO("", callerUserId, caller.getId(), cmdObj.getClass().getName(),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/src/com/cloud/api/dispatch/CommandCreationWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/CommandCreationWorker.java b/server/src/com/cloud/api/dispatch/CommandCreationWorker.java
index 30d4637..25846f9 100644
--- a/server/src/com/cloud/api/dispatch/CommandCreationWorker.java
+++ b/server/src/com/cloud/api/dispatch/CommandCreationWorker.java
@@ -23,6 +23,7 @@ import org.apache.cloudstack.api.BaseCmd;
 import org.apache.cloudstack.api.ServerApiException;
 
 import com.cloud.exception.ResourceAllocationException;
+import org.apache.cloudstack.context.CallContext;
 
 
 /**
@@ -42,6 +43,7 @@ public class CommandCreationWorker implements DispatchWorker {
 
         if (cmd instanceof BaseAsyncCreateCmd) {
             try {
+                CallContext.current().setEventDisplayEnabled(cmd.isDisplay());
                 ((BaseAsyncCreateCmd)cmd).create();
             } catch (final ResourceAllocationException e) {
                 throw new ServerApiException(ApiErrorCode.RESOURCE_ALLOCATION_ERROR,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
index 6eef3d6..2fd7721 100644
--- a/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
+++ b/server/src/com/cloud/api/dispatch/ParamProcessWorker.java
@@ -464,6 +464,11 @@ public class ParamProcessWorker implements DispatchWorker {
         // Enforce that it's uuid for newly added apis from version 3.x
         if (!isPre3x && !isUuid)
             return null;
+
+        // There may be multiple entities defined on the @EntityReference of a Response.class
+        // UUID CommandType would expect only one entityType, so use the first entityType
+        final Class<?>[] entities = annotation.entityType()[0].getAnnotation(EntityReference.class).value();
+
         // Allow both uuid and internal id for pre3x apis
         if (isPre3x && !isUuid) {
             try {
@@ -471,12 +476,15 @@ public class ParamProcessWorker implements DispatchWorker {
             } catch (final NumberFormatException e) {
                 internalId = null;
             }
-            if (internalId != null)
+            if (internalId != null){
+                // Populate CallContext for each of the entity.
+                for (final Class<?> entity : entities) {
+                    CallContext.current().putContextParameter(entity.getName(), internalId);
+                }
                 return internalId;
+            }
         }
-        // There may be multiple entities defined on the @EntityReference of a Response.class
-        // UUID CommandType would expect only one entityType, so use the first entityType
-        final Class<?>[] entities = annotation.entityType()[0].getAnnotation(EntityReference.class).value();
+
         // Go through each entity which is an interface to a VO class and get a VO object
         // Try to getId() for the object using reflection, break on first non-null value
         for (final Class<?> entity : entities) {
@@ -487,15 +495,17 @@ public class ParamProcessWorker implements DispatchWorker {
                 continue;
             }
             // Invoke the getId method, get the internal long ID
-            // If that fails hide exceptions as the uuid may not exist
+            // If that fails hide exceptions as the uuid may not exist                                         s
             try {
                 internalId = ((InternalIdentity)objVO).getId();
             } catch (final IllegalArgumentException e) {
             } catch (final NullPointerException e) {
             }
             // Return on first non-null Id for the uuid entity
-            if (internalId != null)
+            if (internalId != null){
+                CallContext.current().putContextParameter(entity.getName(), internalId);
                 break;
+            }
         }
         if (internalId == null) {
             if (s_logger.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/src/com/cloud/event/ActionEventUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/event/ActionEventUtils.java b/server/src/com/cloud/event/ActionEventUtils.java
index 28e5680..363bb93 100755
--- a/server/src/com/cloud/event/ActionEventUtils.java
+++ b/server/src/com/cloud/event/ActionEventUtils.java
@@ -26,7 +26,8 @@ import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
 import com.cloud.utils.ReflectUtil;
-import com.cloud.vm.VirtualMachine;
+import com.cloud.utils.db.EntityManager;
+import org.apache.cloudstack.api.Identity;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 
@@ -54,6 +55,7 @@ public class ActionEventUtils {
     private static ProjectDao s_projectDao;
     protected static UserDao s_userDao;
     protected static EventBus s_eventBus = null;
+    protected static EntityManager s_entityMgr;
 
     public static final String EventDetails = "event_details";
     public static final String EventId = "event_id";
@@ -69,6 +71,8 @@ public class ActionEventUtils {
     UserDao userDao;
     @Inject
     ProjectDao projectDao;
+    @Inject
+    EntityManager entityMgr;
 
     public ActionEventUtils() {
     }
@@ -79,6 +83,7 @@ public class ActionEventUtils {
         s_accountDao = accountDao;
         s_userDao = userDao;
         s_projectDao = projectDao;
+        s_entityMgr = entityMgr;
     }
 
     public static Long onActionEvent(Long userId, Long accountId, Long domainId, String type, String description) {
@@ -188,19 +193,24 @@ public class ActionEventUtils {
         String entityType = null;
         String entityUuid = null;
         CallContext context = CallContext.current();
-        String vmEntityName = ReflectUtil.getEntityName(VirtualMachine.class);
-        String vmuuid = (String) context.getContextParameter(vmEntityName);
         Class entityKey = getEntityKey(eventType);
-        if (entityKey != null)
-        {
+        if (entityKey != null){
             //FIXME - Remove this since it should be covered by the else if condition below.
             entityUuid = (String)context.getContextParameter(entityKey);
             if (entityUuid != null)
                 entityType = entityKey.getName();
-        }else if (EventTypes.getEntityForEvent(eventType) != null){
-            entityType = EventTypes.getEntityForEvent(eventType);
-            if (entityType != null){
-                entityUuid = (String)context.getContextParameter(entityType);
+        }else if (EventTypes.getEntityClassForEvent(eventType) != null){
+            //Get entity Class(Example - VirtualMachine.class) from the event Type eg. - VM.CREATE
+            Class entityClass = EventTypes.getEntityClassForEvent(eventType);
+
+            //Get uuid from id
+            if(context.getContextParameter(entityClass.getName()) != null){
+                try {
+                    final Object objVO = s_entityMgr.findByIdIncludingRemoved(entityClass, getInternalId(context.getContextParameter(entityClass.getName())));
+                    entityUuid = ((Identity)objVO).getUuid();
+                } catch (Exception e){
+                    s_logger.debug("Caught exception while finding entityUUID, moving on");
+                }
             }
         }
 
@@ -225,7 +235,7 @@ public class ActionEventUtils {
         eventDescription.put("entity", entityType);
         eventDescription.put("entityuuid", entityUuid);
         //Put all the first class entities that are touched during the action. For now atleast put in the vmid.
-        eventDescription.put(vmEntityName, vmuuid);
+        populateFirstClassEntities(eventDescription);
         eventDescription.put("description", description);
 
         String eventDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").format(new Date());
@@ -240,6 +250,19 @@ public class ActionEventUtils {
         }
     }
 
+    private static Long getInternalId(Object internalIdObj){
+        Long internalId = null;
+
+        // In case its an async job the value would be a string because of json deserialization
+        if(internalIdObj instanceof String){
+            internalId = Long.valueOf((String) internalIdObj);
+        }else if (internalIdObj instanceof Long){
+            internalId = (Long) internalIdObj;
+        }
+
+        return internalId;
+    }
+
     private static long getDomainId(long accountId) {
         AccountVO account = s_accountDao.findByIdIncludingRemoved(accountId);
         if (account == null) {
@@ -249,6 +272,27 @@ public class ActionEventUtils {
         return account.getDomainId();
     }
 
+    private static void populateFirstClassEntities(Map<String, String> eventDescription){
+
+        CallContext context = CallContext.current();
+        Map<Object, Object> contextMap = context.getContextParameters();
+
+        try{
+            for(Map.Entry<Object, Object> entry : contextMap.entrySet()){
+                Object key = entry.getKey();
+                Class clz = Class.forName((String)key);
+                if(clz instanceof Class && Identity.class.isAssignableFrom(clz)){
+                    final Object objVO = s_entityMgr.findById(clz, getInternalId(entry.getValue()));
+                    String uuid = ((Identity) objVO).getUuid();
+                    eventDescription.put(ReflectUtil.getEntityName(clz), uuid);
+                }
+            }
+        }catch (Exception e){
+            s_logger.debug("Caught exception while populating first class entities for event bus, moving on", e);
+        }
+
+    }
+
     private static Class getEntityKey(String eventType)
     {
         // FIXME - Remove this

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 9a5a034..abc188e 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1862,15 +1862,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
         return updateVirtualMachine(id, displayName, group, ha, isDisplayVm, osTypeId, userData, isDynamicallyScalable, cmd.getHttpMethod(), cmd.getCustomId(), hostName);
     }
 
-    private void usage(VirtualMachine vm){
-        List<NicVO> nics = _nicDao.listByVmId(vm.getId());
-        for (NicVO nic : nics) {
-            NetworkVO network = _networkDao.findById(nic.getNetworkId());
-            UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), vm.getId(),
-                    Long.toString(nic.getId()), network.getNetworkOfferingId(), null, 0L, vm.getClass().getName(), vm.getUuid(), vm.isDisplay());
-        }
-    }
-
     private void saveUsageEvent(UserVmVO vm) {
 
         // If vm not destroyed

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/test/com/cloud/api/dispatch/CommandCreationWorkerTest.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/api/dispatch/CommandCreationWorkerTest.java b/server/test/com/cloud/api/dispatch/CommandCreationWorkerTest.java
index 34d64fc..72dd770 100644
--- a/server/test/com/cloud/api/dispatch/CommandCreationWorkerTest.java
+++ b/server/test/com/cloud/api/dispatch/CommandCreationWorkerTest.java
@@ -18,7 +18,12 @@ package com.cloud.api.dispatch;
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.UUID;
 
+import com.cloud.user.Account;
+import com.cloud.user.AccountVO;
+import com.cloud.user.UserVO;
+import org.apache.cloudstack.context.CallContext;
 import org.junit.Test;
 
 import static org.mockito.Mockito.mock;
@@ -36,6 +41,9 @@ public class CommandCreationWorkerTest {
         // Prepare
         final BaseAsyncCreateCmd asyncCreateCmd = mock(BaseAsyncCreateCmd.class);
         final Map<String, String> params = new HashMap<String, String>();
+        Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");
+        UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString());
+        CallContext.register(user, account);
 
         // Execute
         final CommandCreationWorker creationWorker = new CommandCreationWorker();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e7ea4e8/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
----------------------------------------------------------------------
diff --git a/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java b/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
index f0ee8ab..e7581d6 100644
--- a/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
+++ b/server/test/org/apache/cloudstack/affinity/AffinityApiUnitTest.java
@@ -32,6 +32,7 @@ import java.util.UUID;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import com.cloud.utils.db.EntityManager;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -283,6 +284,11 @@ public class AffinityApiUnitTest {
         }
 
         @Bean
+        public EntityManager entityManager() {
+            return Mockito.mock(EntityManager.class);
+        }
+
+        @Bean
         public DomainDao domainDao() {
             return Mockito.mock(DomainDao.class);
         }


Mime
View raw message