ServiceInputProcessor.java
1.93 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.felix.scr.annotations.Activate
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Deactivate
* org.apache.felix.scr.annotations.Service
* org.osgi.framework.BundleContext
*/
package com.adobe.aemfd.watchfolder.service;
import com.adobe.aemfd.watchfolder.config.WatchFolderConfiguration;
import com.adobe.aemfd.watchfolder.service.ServiceCallback;
import com.adobe.aemfd.watchfolder.service.ServiceInvoker;
import com.adobe.aemfd.watchfolder.service.api.ContentProcessor;
import com.adobe.aemfd.watchfolder.service.api.ProcessorContext;
import com.adobe.aemfd.watchfolder.util.AbstractSyncInputProcessor;
import java.io.File;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.BundleContext;
@Component(immediate=1)
@Service(value={ServiceInputProcessor.class})
public class ServiceInputProcessor
extends AbstractSyncInputProcessor {
private BundleContext bundleContext;
@Activate
public void activate(BundleContext bundleContext) {
this.bundleContext = bundleContext;
}
protected void doProcess(String jobId, WatchFolderConfiguration config, File source, final ProcessorContext ctxt) throws Exception {
String filter = config.getInputProcessorId();
ServiceInvoker cpi = new ServiceInvoker();
cpi.lookupAndInvoke(this.bundleContext, ContentProcessor.class, filter, new ServiceCallback<ContentProcessor, Void>(){
@Override
public Void execute(ContentProcessor service) throws Exception {
service.processInputs(ctxt);
return null;
}
});
}
@Deactivate
public void deactivate() {
this.bundleContext = null;
}
}