@Test(expectedExceptions = InternalException.class) public void testCreateCommandFailure() throws InternalException { step.setOperation(Operation.CREATE_RESOURCE_TICKET); stepCommandFactory.createCommand(taskCommand, step); }
public StepCommand createCommand(TaskCommand taskCommand, StepEntity stepEntity) throws InternalException { checkNotNull(stepEntity); switch (stepEntity.getOperation()) { case RESERVE_RESOURCE: return new ResourceReserveStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, vmBackend, networkBackend, flavorBackend, useVirtualNetwork); case CREATE_DISK: return new DiskCreateStepCmd(taskCommand, stepBackend, stepEntity, diskBackend); case DELETE_DISK: return new DiskDeleteStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case CREATE_VM: return new VmCreateStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend, networkHelper); case GET_VM_IP: return new VmGetIpStepCmd(taskCommand, stepBackend, stepEntity); case RELEASE_VM_IP: return new VmReleaseIpStepCmd(taskCommand, stepBackend, stepEntity, networkHelper); case DELETE_VM: return new VmDeleteStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend); case START_VM: case STOP_VM: case RESTART_VM: case SUSPEND_VM: case RESUME_VM: return new VmPowerOpStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case ATTACH_DISK: case DETACH_DISK: return new VmDiskOpStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case ATTACH_ISO: return new IsoAttachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, entityLockBackend); case DETACH_ISO: return new IsoDetachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case UPLOAD_ISO: return new IsoUploadStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, isoStore); case GET_NETWORKS: return new VmGetNetworksStepCmd(taskCommand, stepBackend, stepEntity, taskBackend, networkBackend, vmBackend, networkHelper); case GET_MKS_TICKET: return new VmGetMksTicketStepCmd(taskCommand, stepBackend, stepEntity, taskBackend); case CREATE_VM_IMAGE: return new VmCreateImageStepCmd(taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case UPLOAD_IMAGE: return new ImageUploadStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create(), imageConfig); case REPLICATE_IMAGE: return new ImageReplicateStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case CREATE_HOST: return new HostCreateStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case PROVISION_HOST: return new HostProvisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case DEPROVISION_HOST: return new HostDeprovisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_DEPROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostDeprovisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_PROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostProvisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case DELETE_HOST: return new HostDeleteStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case SUSPEND_HOST: return new HostEnterSuspendedModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case RESUME_HOST: return new HostResumeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_HOST_CHANGE_MODE_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostChangeModeTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostCreateTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case ENTER_MAINTENANCE_MODE: return new HostEnterMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case EXIT_MAINTENANCE_MODE: return new HostExitMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SET_AVAILABILITYZONE: return new HostSetAvailabilityZoneStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SCHEDULE_DEPLOYMENT: return new DeploymentCreateStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case SCHEDULE_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentInitializeMigrationStatusStepCmd.DeploymentInitializeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentFinalizeMigrationStatusStepCmd.DeploymentFinalizeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case PROVISION_CONTROL_PLANE_HOSTS: case PROVISION_CONTROL_PLANE_VMS: case PROVISION_CLOUD_HOSTS: case PROVISION_CLUSTER_MANAGER: case CREATE_SUBNET_ALLOCATOR: case CREATE_DHCP_SUBNET: case CONFIGURE_DHCP_RELAY_PROFILE: case CONFIGURE_DHCP_RELAY_SERVICE: case MIGRATE_DEPLOYMENT_DATA: return new DeploymentStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentStatusStepCmd.DeploymentStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_DELETE_DEPLOYMENT: return new DeploymentDeleteStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_DELETE_DEPLOYMENT: case DEPROVISION_HOSTS: return new DeploymentDeleteStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentDeleteStatusStepCmd.DeploymentDeleteStepPoller(taskCommand, taskBackend, deploymentBackend)); case PUSH_DEPLOYMENT_SECURITY_GROUPS: return new DeploymentPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case CREATE_KUBERNETES_CLUSTER_INITIATE: return new KubernetesClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_KUBERNETES_CLUSTER_SETUP_ETCD: case CREATE_KUBERNETES_CLUSTER_SETUP_MASTER: case CREATE_KUBERNETES_CLUSTER_UPDATE_EXTENDED_PROPERTIES: case CREATE_KUBERNETES_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new KubernetesClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_MESOS_CLUSTER_INITIATE: return new MesosClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_MESOS_CLUSTER_SETUP_ZOOKEEPERS: case CREATE_MESOS_CLUSTER_SETUP_MASTERS: case CREATE_MESOS_CLUSTER_SETUP_MARATHON: case CREATE_MESOS_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new MesosClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_SWARM_CLUSTER_INITIATE: return new SwarmClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_SWARM_CLUSTER_SETUP_ETCD: case CREATE_SWARM_CLUSTER_SETUP_MASTER: case CREATE_SWARM_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new SwarmClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_HARBOR_CLUSTER_INITIATE: return new HarborClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_HARBOR_CLUSTER_SETUP_HARBOR: case CREATE_HARBOR_CLUSTER_UPDATE_EXTENDED_PROPERTIES: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HarborClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case RESIZE_CLUSTER_INITIATE: return new ClusterResizeStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case RESIZE_CLUSTER_INITIALIZE_CLUSTER: case RESIZE_CLUSTER_RESIZE: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterResizeTaskStatusPoller(clusterBackend)); case DELETE_CLUSTER_INITIATE: return new ClusterDeleteStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case DELETE_CLUSTER_UPDATE_CLUSTER_DOCUMENT: case DELETE_CLUSTER_DELETE_VMS: case DELETE_CLUSTER_DOCUMENT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterDeleteTaskStatusPoller(clusterBackend)); case SET_TENANT_SECURITY_GROUPS: return new TenantSetSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case PUSH_TENANT_SECURITY_GROUPS: return new TenantPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend, projectBackend); case PAUSE_SYSTEM: return new SystemPauseStepCmd(taskCommand, stepBackend, stepEntity); case PAUSE_BACKGROUND_TASKS: return new SystemPauseBackgroundTasksStepCmd(taskCommand, stepBackend, stepEntity); case RESUME_SYSTEM: return new SystemResumeStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG_INITIATE: return new HostsConfigSyncStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostsConfigSyncTaskStatusPoller(taskCommand, taskBackend)); default: throw new InternalException(String.format("Invalid Operation %s to create StepCommand", stepEntity.getOperation())); } }
StepCommandFactory { public StepCommand createCommand(TaskCommand taskCommand, StepEntity stepEntity) throws InternalException { checkNotNull(stepEntity); switch (stepEntity.getOperation()) { case RESERVE_RESOURCE: return new ResourceReserveStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, vmBackend, networkBackend, flavorBackend, useVirtualNetwork); case CREATE_DISK: return new DiskCreateStepCmd(taskCommand, stepBackend, stepEntity, diskBackend); case DELETE_DISK: return new DiskDeleteStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case CREATE_VM: return new VmCreateStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend, networkHelper); case GET_VM_IP: return new VmGetIpStepCmd(taskCommand, stepBackend, stepEntity); case RELEASE_VM_IP: return new VmReleaseIpStepCmd(taskCommand, stepBackend, stepEntity, networkHelper); case DELETE_VM: return new VmDeleteStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend); case START_VM: case STOP_VM: case RESTART_VM: case SUSPEND_VM: case RESUME_VM: return new VmPowerOpStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case ATTACH_DISK: case DETACH_DISK: return new VmDiskOpStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case ATTACH_ISO: return new IsoAttachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, entityLockBackend); case DETACH_ISO: return new IsoDetachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case UPLOAD_ISO: return new IsoUploadStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, isoStore); case GET_NETWORKS: return new VmGetNetworksStepCmd(taskCommand, stepBackend, stepEntity, taskBackend, networkBackend, vmBackend, networkHelper); case GET_MKS_TICKET: return new VmGetMksTicketStepCmd(taskCommand, stepBackend, stepEntity, taskBackend); case CREATE_VM_IMAGE: return new VmCreateImageStepCmd(taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case UPLOAD_IMAGE: return new ImageUploadStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create(), imageConfig); case REPLICATE_IMAGE: return new ImageReplicateStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case CREATE_HOST: return new HostCreateStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case PROVISION_HOST: return new HostProvisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case DEPROVISION_HOST: return new HostDeprovisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_DEPROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostDeprovisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_PROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostProvisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case DELETE_HOST: return new HostDeleteStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case SUSPEND_HOST: return new HostEnterSuspendedModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case RESUME_HOST: return new HostResumeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_HOST_CHANGE_MODE_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostChangeModeTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostCreateTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case ENTER_MAINTENANCE_MODE: return new HostEnterMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case EXIT_MAINTENANCE_MODE: return new HostExitMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SET_AVAILABILITYZONE: return new HostSetAvailabilityZoneStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SCHEDULE_DEPLOYMENT: return new DeploymentCreateStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case SCHEDULE_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentInitializeMigrationStatusStepCmd.DeploymentInitializeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentFinalizeMigrationStatusStepCmd.DeploymentFinalizeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case PROVISION_CONTROL_PLANE_HOSTS: case PROVISION_CONTROL_PLANE_VMS: case PROVISION_CLOUD_HOSTS: case PROVISION_CLUSTER_MANAGER: case CREATE_SUBNET_ALLOCATOR: case CREATE_DHCP_SUBNET: case CONFIGURE_DHCP_RELAY_PROFILE: case CONFIGURE_DHCP_RELAY_SERVICE: case MIGRATE_DEPLOYMENT_DATA: return new DeploymentStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentStatusStepCmd.DeploymentStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_DELETE_DEPLOYMENT: return new DeploymentDeleteStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_DELETE_DEPLOYMENT: case DEPROVISION_HOSTS: return new DeploymentDeleteStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentDeleteStatusStepCmd.DeploymentDeleteStepPoller(taskCommand, taskBackend, deploymentBackend)); case PUSH_DEPLOYMENT_SECURITY_GROUPS: return new DeploymentPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case CREATE_KUBERNETES_CLUSTER_INITIATE: return new KubernetesClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_KUBERNETES_CLUSTER_SETUP_ETCD: case CREATE_KUBERNETES_CLUSTER_SETUP_MASTER: case CREATE_KUBERNETES_CLUSTER_UPDATE_EXTENDED_PROPERTIES: case CREATE_KUBERNETES_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new KubernetesClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_MESOS_CLUSTER_INITIATE: return new MesosClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_MESOS_CLUSTER_SETUP_ZOOKEEPERS: case CREATE_MESOS_CLUSTER_SETUP_MASTERS: case CREATE_MESOS_CLUSTER_SETUP_MARATHON: case CREATE_MESOS_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new MesosClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_SWARM_CLUSTER_INITIATE: return new SwarmClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_SWARM_CLUSTER_SETUP_ETCD: case CREATE_SWARM_CLUSTER_SETUP_MASTER: case CREATE_SWARM_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new SwarmClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_HARBOR_CLUSTER_INITIATE: return new HarborClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_HARBOR_CLUSTER_SETUP_HARBOR: case CREATE_HARBOR_CLUSTER_UPDATE_EXTENDED_PROPERTIES: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HarborClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case RESIZE_CLUSTER_INITIATE: return new ClusterResizeStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case RESIZE_CLUSTER_INITIALIZE_CLUSTER: case RESIZE_CLUSTER_RESIZE: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterResizeTaskStatusPoller(clusterBackend)); case DELETE_CLUSTER_INITIATE: return new ClusterDeleteStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case DELETE_CLUSTER_UPDATE_CLUSTER_DOCUMENT: case DELETE_CLUSTER_DELETE_VMS: case DELETE_CLUSTER_DOCUMENT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterDeleteTaskStatusPoller(clusterBackend)); case SET_TENANT_SECURITY_GROUPS: return new TenantSetSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case PUSH_TENANT_SECURITY_GROUPS: return new TenantPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend, projectBackend); case PAUSE_SYSTEM: return new SystemPauseStepCmd(taskCommand, stepBackend, stepEntity); case PAUSE_BACKGROUND_TASKS: return new SystemPauseBackgroundTasksStepCmd(taskCommand, stepBackend, stepEntity); case RESUME_SYSTEM: return new SystemResumeStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG_INITIATE: return new HostsConfigSyncStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostsConfigSyncTaskStatusPoller(taskCommand, taskBackend)); default: throw new InternalException(String.format("Invalid Operation %s to create StepCommand", stepEntity.getOperation())); } } }
StepCommandFactory { public StepCommand createCommand(TaskCommand taskCommand, StepEntity stepEntity) throws InternalException { checkNotNull(stepEntity); switch (stepEntity.getOperation()) { case RESERVE_RESOURCE: return new ResourceReserveStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, vmBackend, networkBackend, flavorBackend, useVirtualNetwork); case CREATE_DISK: return new DiskCreateStepCmd(taskCommand, stepBackend, stepEntity, diskBackend); case DELETE_DISK: return new DiskDeleteStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case CREATE_VM: return new VmCreateStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend, networkHelper); case GET_VM_IP: return new VmGetIpStepCmd(taskCommand, stepBackend, stepEntity); case RELEASE_VM_IP: return new VmReleaseIpStepCmd(taskCommand, stepBackend, stepEntity, networkHelper); case DELETE_VM: return new VmDeleteStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend); case START_VM: case STOP_VM: case RESTART_VM: case SUSPEND_VM: case RESUME_VM: return new VmPowerOpStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case ATTACH_DISK: case DETACH_DISK: return new VmDiskOpStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case ATTACH_ISO: return new IsoAttachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, entityLockBackend); case DETACH_ISO: return new IsoDetachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case UPLOAD_ISO: return new IsoUploadStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, isoStore); case GET_NETWORKS: return new VmGetNetworksStepCmd(taskCommand, stepBackend, stepEntity, taskBackend, networkBackend, vmBackend, networkHelper); case GET_MKS_TICKET: return new VmGetMksTicketStepCmd(taskCommand, stepBackend, stepEntity, taskBackend); case CREATE_VM_IMAGE: return new VmCreateImageStepCmd(taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case UPLOAD_IMAGE: return new ImageUploadStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create(), imageConfig); case REPLICATE_IMAGE: return new ImageReplicateStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case CREATE_HOST: return new HostCreateStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case PROVISION_HOST: return new HostProvisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case DEPROVISION_HOST: return new HostDeprovisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_DEPROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostDeprovisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_PROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostProvisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case DELETE_HOST: return new HostDeleteStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case SUSPEND_HOST: return new HostEnterSuspendedModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case RESUME_HOST: return new HostResumeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_HOST_CHANGE_MODE_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostChangeModeTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostCreateTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case ENTER_MAINTENANCE_MODE: return new HostEnterMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case EXIT_MAINTENANCE_MODE: return new HostExitMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SET_AVAILABILITYZONE: return new HostSetAvailabilityZoneStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SCHEDULE_DEPLOYMENT: return new DeploymentCreateStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case SCHEDULE_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentInitializeMigrationStatusStepCmd.DeploymentInitializeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentFinalizeMigrationStatusStepCmd.DeploymentFinalizeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case PROVISION_CONTROL_PLANE_HOSTS: case PROVISION_CONTROL_PLANE_VMS: case PROVISION_CLOUD_HOSTS: case PROVISION_CLUSTER_MANAGER: case CREATE_SUBNET_ALLOCATOR: case CREATE_DHCP_SUBNET: case CONFIGURE_DHCP_RELAY_PROFILE: case CONFIGURE_DHCP_RELAY_SERVICE: case MIGRATE_DEPLOYMENT_DATA: return new DeploymentStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentStatusStepCmd.DeploymentStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_DELETE_DEPLOYMENT: return new DeploymentDeleteStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_DELETE_DEPLOYMENT: case DEPROVISION_HOSTS: return new DeploymentDeleteStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentDeleteStatusStepCmd.DeploymentDeleteStepPoller(taskCommand, taskBackend, deploymentBackend)); case PUSH_DEPLOYMENT_SECURITY_GROUPS: return new DeploymentPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case CREATE_KUBERNETES_CLUSTER_INITIATE: return new KubernetesClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_KUBERNETES_CLUSTER_SETUP_ETCD: case CREATE_KUBERNETES_CLUSTER_SETUP_MASTER: case CREATE_KUBERNETES_CLUSTER_UPDATE_EXTENDED_PROPERTIES: case CREATE_KUBERNETES_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new KubernetesClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_MESOS_CLUSTER_INITIATE: return new MesosClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_MESOS_CLUSTER_SETUP_ZOOKEEPERS: case CREATE_MESOS_CLUSTER_SETUP_MASTERS: case CREATE_MESOS_CLUSTER_SETUP_MARATHON: case CREATE_MESOS_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new MesosClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_SWARM_CLUSTER_INITIATE: return new SwarmClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_SWARM_CLUSTER_SETUP_ETCD: case CREATE_SWARM_CLUSTER_SETUP_MASTER: case CREATE_SWARM_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new SwarmClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_HARBOR_CLUSTER_INITIATE: return new HarborClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_HARBOR_CLUSTER_SETUP_HARBOR: case CREATE_HARBOR_CLUSTER_UPDATE_EXTENDED_PROPERTIES: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HarborClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case RESIZE_CLUSTER_INITIATE: return new ClusterResizeStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case RESIZE_CLUSTER_INITIALIZE_CLUSTER: case RESIZE_CLUSTER_RESIZE: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterResizeTaskStatusPoller(clusterBackend)); case DELETE_CLUSTER_INITIATE: return new ClusterDeleteStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case DELETE_CLUSTER_UPDATE_CLUSTER_DOCUMENT: case DELETE_CLUSTER_DELETE_VMS: case DELETE_CLUSTER_DOCUMENT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterDeleteTaskStatusPoller(clusterBackend)); case SET_TENANT_SECURITY_GROUPS: return new TenantSetSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case PUSH_TENANT_SECURITY_GROUPS: return new TenantPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend, projectBackend); case PAUSE_SYSTEM: return new SystemPauseStepCmd(taskCommand, stepBackend, stepEntity); case PAUSE_BACKGROUND_TASKS: return new SystemPauseBackgroundTasksStepCmd(taskCommand, stepBackend, stepEntity); case RESUME_SYSTEM: return new SystemResumeStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG_INITIATE: return new HostsConfigSyncStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostsConfigSyncTaskStatusPoller(taskCommand, taskBackend)); default: throw new InternalException(String.format("Invalid Operation %s to create StepCommand", stepEntity.getOperation())); } } @Inject  StepCommandFactory(StepBackend stepBackend,
                            EntityLockBackend entityLockBackend,
                            VmBackend vmBackend,
                            DiskBackend diskBackend,
                            AttachedDiskBackend attachedDiskBackend,
                            ImageBackend imageBackend,
                            TaskBackend taskBackend,
                            DeploymentXenonBackend deploymentBackend,
                            HostXenonBackend hostBackend,
                            ImageConfig imageConfig,
                            ImageStoreFactory imageStoreFactory,
                            VsphereIsoStore isoStore,
                            NetworkBackend networkBackend,
                            FlavorBackend flavorBackend,
                            ClusterBackend clusterBackend,
                            TenantBackend tenantBackend,
                            ProjectBackend projectBackend,
                            NetworkHelper networkHelper,
                            @Named("useVirtualNetwork") Boolean useVirtualNetwork); }
StepCommandFactory { public StepCommand createCommand(TaskCommand taskCommand, StepEntity stepEntity) throws InternalException { checkNotNull(stepEntity); switch (stepEntity.getOperation()) { case RESERVE_RESOURCE: return new ResourceReserveStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, vmBackend, networkBackend, flavorBackend, useVirtualNetwork); case CREATE_DISK: return new DiskCreateStepCmd(taskCommand, stepBackend, stepEntity, diskBackend); case DELETE_DISK: return new DiskDeleteStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case CREATE_VM: return new VmCreateStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend, networkHelper); case GET_VM_IP: return new VmGetIpStepCmd(taskCommand, stepBackend, stepEntity); case RELEASE_VM_IP: return new VmReleaseIpStepCmd(taskCommand, stepBackend, stepEntity, networkHelper); case DELETE_VM: return new VmDeleteStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend); case START_VM: case STOP_VM: case RESTART_VM: case SUSPEND_VM: case RESUME_VM: return new VmPowerOpStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case ATTACH_DISK: case DETACH_DISK: return new VmDiskOpStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case ATTACH_ISO: return new IsoAttachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, entityLockBackend); case DETACH_ISO: return new IsoDetachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case UPLOAD_ISO: return new IsoUploadStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, isoStore); case GET_NETWORKS: return new VmGetNetworksStepCmd(taskCommand, stepBackend, stepEntity, taskBackend, networkBackend, vmBackend, networkHelper); case GET_MKS_TICKET: return new VmGetMksTicketStepCmd(taskCommand, stepBackend, stepEntity, taskBackend); case CREATE_VM_IMAGE: return new VmCreateImageStepCmd(taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case UPLOAD_IMAGE: return new ImageUploadStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create(), imageConfig); case REPLICATE_IMAGE: return new ImageReplicateStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case CREATE_HOST: return new HostCreateStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case PROVISION_HOST: return new HostProvisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case DEPROVISION_HOST: return new HostDeprovisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_DEPROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostDeprovisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_PROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostProvisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case DELETE_HOST: return new HostDeleteStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case SUSPEND_HOST: return new HostEnterSuspendedModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case RESUME_HOST: return new HostResumeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_HOST_CHANGE_MODE_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostChangeModeTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostCreateTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case ENTER_MAINTENANCE_MODE: return new HostEnterMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case EXIT_MAINTENANCE_MODE: return new HostExitMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SET_AVAILABILITYZONE: return new HostSetAvailabilityZoneStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SCHEDULE_DEPLOYMENT: return new DeploymentCreateStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case SCHEDULE_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentInitializeMigrationStatusStepCmd.DeploymentInitializeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentFinalizeMigrationStatusStepCmd.DeploymentFinalizeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case PROVISION_CONTROL_PLANE_HOSTS: case PROVISION_CONTROL_PLANE_VMS: case PROVISION_CLOUD_HOSTS: case PROVISION_CLUSTER_MANAGER: case CREATE_SUBNET_ALLOCATOR: case CREATE_DHCP_SUBNET: case CONFIGURE_DHCP_RELAY_PROFILE: case CONFIGURE_DHCP_RELAY_SERVICE: case MIGRATE_DEPLOYMENT_DATA: return new DeploymentStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentStatusStepCmd.DeploymentStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_DELETE_DEPLOYMENT: return new DeploymentDeleteStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_DELETE_DEPLOYMENT: case DEPROVISION_HOSTS: return new DeploymentDeleteStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentDeleteStatusStepCmd.DeploymentDeleteStepPoller(taskCommand, taskBackend, deploymentBackend)); case PUSH_DEPLOYMENT_SECURITY_GROUPS: return new DeploymentPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case CREATE_KUBERNETES_CLUSTER_INITIATE: return new KubernetesClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_KUBERNETES_CLUSTER_SETUP_ETCD: case CREATE_KUBERNETES_CLUSTER_SETUP_MASTER: case CREATE_KUBERNETES_CLUSTER_UPDATE_EXTENDED_PROPERTIES: case CREATE_KUBERNETES_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new KubernetesClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_MESOS_CLUSTER_INITIATE: return new MesosClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_MESOS_CLUSTER_SETUP_ZOOKEEPERS: case CREATE_MESOS_CLUSTER_SETUP_MASTERS: case CREATE_MESOS_CLUSTER_SETUP_MARATHON: case CREATE_MESOS_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new MesosClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_SWARM_CLUSTER_INITIATE: return new SwarmClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_SWARM_CLUSTER_SETUP_ETCD: case CREATE_SWARM_CLUSTER_SETUP_MASTER: case CREATE_SWARM_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new SwarmClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_HARBOR_CLUSTER_INITIATE: return new HarborClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_HARBOR_CLUSTER_SETUP_HARBOR: case CREATE_HARBOR_CLUSTER_UPDATE_EXTENDED_PROPERTIES: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HarborClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case RESIZE_CLUSTER_INITIATE: return new ClusterResizeStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case RESIZE_CLUSTER_INITIALIZE_CLUSTER: case RESIZE_CLUSTER_RESIZE: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterResizeTaskStatusPoller(clusterBackend)); case DELETE_CLUSTER_INITIATE: return new ClusterDeleteStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case DELETE_CLUSTER_UPDATE_CLUSTER_DOCUMENT: case DELETE_CLUSTER_DELETE_VMS: case DELETE_CLUSTER_DOCUMENT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterDeleteTaskStatusPoller(clusterBackend)); case SET_TENANT_SECURITY_GROUPS: return new TenantSetSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case PUSH_TENANT_SECURITY_GROUPS: return new TenantPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend, projectBackend); case PAUSE_SYSTEM: return new SystemPauseStepCmd(taskCommand, stepBackend, stepEntity); case PAUSE_BACKGROUND_TASKS: return new SystemPauseBackgroundTasksStepCmd(taskCommand, stepBackend, stepEntity); case RESUME_SYSTEM: return new SystemResumeStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG_INITIATE: return new HostsConfigSyncStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostsConfigSyncTaskStatusPoller(taskCommand, taskBackend)); default: throw new InternalException(String.format("Invalid Operation %s to create StepCommand", stepEntity.getOperation())); } } @Inject  StepCommandFactory(StepBackend stepBackend,
                            EntityLockBackend entityLockBackend,
                            VmBackend vmBackend,
                            DiskBackend diskBackend,
                            AttachedDiskBackend attachedDiskBackend,
                            ImageBackend imageBackend,
                            TaskBackend taskBackend,
                            DeploymentXenonBackend deploymentBackend,
                            HostXenonBackend hostBackend,
                            ImageConfig imageConfig,
                            ImageStoreFactory imageStoreFactory,
                            VsphereIsoStore isoStore,
                            NetworkBackend networkBackend,
                            FlavorBackend flavorBackend,
                            ClusterBackend clusterBackend,
                            TenantBackend tenantBackend,
                            ProjectBackend projectBackend,
                            NetworkHelper networkHelper,
                            @Named("useVirtualNetwork") Boolean useVirtualNetwork); StepCommand createCommand(TaskCommand taskCommand, StepEntity stepEntity); }
StepCommandFactory { public StepCommand createCommand(TaskCommand taskCommand, StepEntity stepEntity) throws InternalException { checkNotNull(stepEntity); switch (stepEntity.getOperation()) { case RESERVE_RESOURCE: return new ResourceReserveStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, vmBackend, networkBackend, flavorBackend, useVirtualNetwork); case CREATE_DISK: return new DiskCreateStepCmd(taskCommand, stepBackend, stepEntity, diskBackend); case DELETE_DISK: return new DiskDeleteStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case CREATE_VM: return new VmCreateStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend, networkHelper); case GET_VM_IP: return new VmGetIpStepCmd(taskCommand, stepBackend, stepEntity); case RELEASE_VM_IP: return new VmReleaseIpStepCmd(taskCommand, stepBackend, stepEntity, networkHelper); case DELETE_VM: return new VmDeleteStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, diskBackend); case START_VM: case STOP_VM: case RESTART_VM: case SUSPEND_VM: case RESUME_VM: return new VmPowerOpStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case ATTACH_DISK: case DETACH_DISK: return new VmDiskOpStepCmd(taskCommand, stepBackend, stepEntity, diskBackend, attachedDiskBackend); case ATTACH_ISO: return new IsoAttachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, entityLockBackend); case DETACH_ISO: return new IsoDetachStepCmd(taskCommand, stepBackend, stepEntity, vmBackend); case UPLOAD_ISO: return new IsoUploadStepCmd(taskCommand, stepBackend, stepEntity, vmBackend, isoStore); case GET_NETWORKS: return new VmGetNetworksStepCmd(taskCommand, stepBackend, stepEntity, taskBackend, networkBackend, vmBackend, networkHelper); case GET_MKS_TICKET: return new VmGetMksTicketStepCmd(taskCommand, stepBackend, stepEntity, taskBackend); case CREATE_VM_IMAGE: return new VmCreateImageStepCmd(taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case UPLOAD_IMAGE: return new ImageUploadStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create(), imageConfig); case REPLICATE_IMAGE: return new ImageReplicateStepCmd( taskCommand, stepBackend, stepEntity, imageBackend, imageStoreFactory.create()); case CREATE_HOST: return new HostCreateStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case PROVISION_HOST: return new HostProvisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case DEPROVISION_HOST: return new HostDeprovisionStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_DEPROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostDeprovisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_PROVISION_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostProvisionTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case DELETE_HOST: return new HostDeleteStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case SUSPEND_HOST: return new HostEnterSuspendedModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case RESUME_HOST: return new HostResumeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case QUERY_HOST_CHANGE_MODE_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostChangeModeTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case QUERY_HOST_TASK_RESULT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostCreateTaskStatusPoller(taskCommand, hostBackend, taskBackend)); case ENTER_MAINTENANCE_MODE: return new HostEnterMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend, vmBackend); case EXIT_MAINTENANCE_MODE: return new HostExitMaintenanceModeStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SET_AVAILABILITYZONE: return new HostSetAvailabilityZoneStepCmd(taskCommand, stepBackend, stepEntity, hostBackend); case SCHEDULE_DEPLOYMENT: return new DeploymentCreateStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case SCHEDULE_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_INITIALIZE_MIGRATE_DEPLOYMENT: return new DeploymentInitializeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentInitializeMigrationStatusStepCmd.DeploymentInitializeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_FINALIZE_MIGRATE_DEPLOYMENT: return new DeploymentFinalizeMigrationStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentFinalizeMigrationStatusStepCmd.DeploymentFinalizeMigrationStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case PROVISION_CONTROL_PLANE_HOSTS: case PROVISION_CONTROL_PLANE_VMS: case PROVISION_CLOUD_HOSTS: case PROVISION_CLUSTER_MANAGER: case CREATE_SUBNET_ALLOCATOR: case CREATE_DHCP_SUBNET: case CONFIGURE_DHCP_RELAY_PROFILE: case CONFIGURE_DHCP_RELAY_SERVICE: case MIGRATE_DEPLOYMENT_DATA: return new DeploymentStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentStatusStepCmd.DeploymentStatusStepPoller(taskCommand, taskBackend, deploymentBackend)); case SCHEDULE_DELETE_DEPLOYMENT: return new DeploymentDeleteStepCmd(taskCommand, stepBackend, stepEntity, deploymentBackend); case PERFORM_DELETE_DEPLOYMENT: case DEPROVISION_HOSTS: return new DeploymentDeleteStatusStepCmd(taskCommand, stepBackend, stepEntity, new DeploymentDeleteStatusStepCmd.DeploymentDeleteStepPoller(taskCommand, taskBackend, deploymentBackend)); case PUSH_DEPLOYMENT_SECURITY_GROUPS: return new DeploymentPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case CREATE_KUBERNETES_CLUSTER_INITIATE: return new KubernetesClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_KUBERNETES_CLUSTER_SETUP_ETCD: case CREATE_KUBERNETES_CLUSTER_SETUP_MASTER: case CREATE_KUBERNETES_CLUSTER_UPDATE_EXTENDED_PROPERTIES: case CREATE_KUBERNETES_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new KubernetesClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_MESOS_CLUSTER_INITIATE: return new MesosClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_MESOS_CLUSTER_SETUP_ZOOKEEPERS: case CREATE_MESOS_CLUSTER_SETUP_MASTERS: case CREATE_MESOS_CLUSTER_SETUP_MARATHON: case CREATE_MESOS_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new MesosClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_SWARM_CLUSTER_INITIATE: return new SwarmClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_SWARM_CLUSTER_SETUP_ETCD: case CREATE_SWARM_CLUSTER_SETUP_MASTER: case CREATE_SWARM_CLUSTER_SETUP_WORKERS: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new SwarmClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case CREATE_HARBOR_CLUSTER_INITIATE: return new HarborClusterCreateStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case CREATE_HARBOR_CLUSTER_SETUP_HARBOR: case CREATE_HARBOR_CLUSTER_UPDATE_EXTENDED_PROPERTIES: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HarborClusterCreateTaskStatusPoller(taskCommand, clusterBackend, taskBackend)); case RESIZE_CLUSTER_INITIATE: return new ClusterResizeStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case RESIZE_CLUSTER_INITIALIZE_CLUSTER: case RESIZE_CLUSTER_RESIZE: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterResizeTaskStatusPoller(clusterBackend)); case DELETE_CLUSTER_INITIATE: return new ClusterDeleteStepCmd(taskCommand, stepBackend, stepEntity, clusterBackend); case DELETE_CLUSTER_UPDATE_CLUSTER_DOCUMENT: case DELETE_CLUSTER_DELETE_VMS: case DELETE_CLUSTER_DOCUMENT: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new ClusterDeleteTaskStatusPoller(clusterBackend)); case SET_TENANT_SECURITY_GROUPS: return new TenantSetSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend); case PUSH_TENANT_SECURITY_GROUPS: return new TenantPushSecurityGroupsStepCmd(taskCommand, stepBackend, stepEntity, tenantBackend, projectBackend); case PAUSE_SYSTEM: return new SystemPauseStepCmd(taskCommand, stepBackend, stepEntity); case PAUSE_BACKGROUND_TASKS: return new SystemPauseBackgroundTasksStepCmd(taskCommand, stepBackend, stepEntity); case RESUME_SYSTEM: return new SystemResumeStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG_INITIATE: return new HostsConfigSyncStepCmd(taskCommand, stepBackend, stepEntity); case SYNC_HOSTS_CONFIG: return new XenonTaskStatusStepCmd(taskCommand, stepBackend, stepEntity, new HostsConfigSyncTaskStatusPoller(taskCommand, taskBackend)); default: throw new InternalException(String.format("Invalid Operation %s to create StepCommand", stepEntity.getOperation())); } } @Inject  StepCommandFactory(StepBackend stepBackend,
                            EntityLockBackend entityLockBackend,
                            VmBackend vmBackend,
                            DiskBackend diskBackend,
                            AttachedDiskBackend attachedDiskBackend,
                            ImageBackend imageBackend,
                            TaskBackend taskBackend,
                            DeploymentXenonBackend deploymentBackend,
                            HostXenonBackend hostBackend,
                            ImageConfig imageConfig,
                            ImageStoreFactory imageStoreFactory,
                            VsphereIsoStore isoStore,
                            NetworkBackend networkBackend,
                            FlavorBackend flavorBackend,
                            ClusterBackend clusterBackend,
                            TenantBackend tenantBackend,
                            ProjectBackend projectBackend,
                            NetworkHelper networkHelper,
                            @Named("useVirtualNetwork") Boolean useVirtualNetwork); StepCommand createCommand(TaskCommand taskCommand, StepEntity stepEntity);  }