DTMWorkflowTriggerJob.java
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.day.cq.workflow.WorkflowException
* com.day.cq.workflow.WorkflowService
* javax.jcr.PathNotFoundException
* org.apache.sling.api.resource.LoginException
* org.apache.sling.api.resource.Resource
* org.apache.sling.api.resource.ResourceResolver
* org.apache.sling.api.resource.ResourceResolverFactory
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.adobe.cq.dtm.impl;
import com.adobe.cq.dtm.impl.constants.DTMServerType;
import com.adobe.cq.dtm.impl.util.DTMConfigurationUtil;
import com.day.cq.workflow.WorkflowException;
import com.day.cq.workflow.WorkflowService;
import java.util.Map;
import javax.jcr.PathNotFoundException;
import org.apache.sling.api.resource.LoginException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class DTMWorkflowTriggerJob
implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(DTMWorkflowTriggerJob.class);
private ResourceResolverFactory rrf;
private WorkflowService workflowService;
private DTMServerType dtmServerType;
private String dtmConfigPath;
public DTMWorkflowTriggerJob(ResourceResolverFactory rrf, WorkflowService workflowService, String dtmConfigPath, DTMServerType dtmServerType) {
this.rrf = rrf;
this.workflowService = workflowService;
this.dtmConfigPath = dtmConfigPath;
this.dtmServerType = dtmServerType;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
@Override
public void run() {
ResourceResolver serviceResourceResolver = null;
try {
serviceResourceResolver = this.rrf.getServiceResourceResolver(null);
Resource dtmConfig = serviceResourceResolver.getResource(this.dtmConfigPath);
DTMConfigurationUtil.triggerDTMWorkflow(this.workflowService, dtmConfig, this.dtmServerType);
LOG.info("DTM {} bundle download workflow started.", (Object)this.dtmServerType);
}
catch (PathNotFoundException e) {
LOG.error("DTM workflow model not found.", (Throwable)e);
}
catch (WorkflowException e) {
LOG.error("DTM {} bundle download workflow failed.", (Object)this.dtmServerType, (Object)e);
}
catch (LoginException e) {
LOG.error("Could not get a resolver.", (Throwable)e);
}
finally {
if (serviceResourceResolver != null) {
serviceResourceResolver.close();
}
}
}
}