use of org.xwiki.wiki.provisioning.WikiProvisioningJobException in project xwiki-platform by xwiki.
the class DefaultWikiProvisioningJobExecutor method createAndExecuteJob.
@Override
public WikiProvisioningJob createAndExecuteJob(String wikiId, String provisioningJobName, Object parameter) throws WikiProvisioningJobException {
try {
// Get the context
XWikiContext xcontext = xcontextProvider.get();
// Create the job
WikiProvisioningJob job = componentManager.getInstance(Job.class, provisioningJobName);
// Id of the new job
List<String> jobId = new ArrayList<String>();
jobId.add("wiki");
jobId.add("provisioning");
jobId.add(provisioningJobName);
jobId.add(wikiId);
// Initialize it
job.initialize(new WikiProvisioningJobRequest(jobId, wikiId, parameter, xcontext.getUserReference()));
// Add it to the list of jobs
jobs.put(jobId, job);
// Pass it to the executor
jobExecutor.execute(job);
// Return the job
return job;
} catch (ComponentLookupException e) {
throw new WikiProvisioningJobException(String.format("Failed to lookup provisioning job component for role [%s]", provisioningJobName), e);
}
}
Aggregations