* @param jobType The type of job: deploy or undeploy
* @param deploymentUnit The deployment unit that should be acted upon
* @return The initial status of the job in a {@link JaxbDeploymentJobResult} instance
*/
private JaxbDeploymentJobResult scheduleDeploymentJobRequest(String deploymentId, JobType jobType, KModuleDeploymentUnit deploymentUnit) {
CommandContext ctx = new CommandContext();
ctx.setData(DEPLOYMENT_UNIT, deploymentUnit);
ctx.setData(JOB_TYPE, jobType);
ctx.setData("businessKey", deploymentId);
ctx.setData("retries", 0);
ctx.setData("owner", ExecutorService.EXECUTOR_ID);
String jobTypeLower = jobType.toString().toLowerCase();
String jobId = "" + System.currentTimeMillis() + "-" + jobIdGen.incrementAndGet();
ctx.setData(JOB_ID, jobId);
JaxbDeploymentJobResult jobResult = new JaxbDeploymentJobResult(
jobId,
jobTypeLower + " job accepted.",
convertKModuleDepUnitToJaxbDepUnit(deploymentUnit), jobType.toString());
jobResult.getDeploymentUnit().setStatus(JaxbDeploymentStatus.ACCEPTED);