ClassificationsTransformerService.java
2.56 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Reference
* org.apache.felix.scr.annotations.ReferenceCardinality
* org.apache.felix.scr.annotations.ReferencePolicy
* org.apache.felix.scr.annotations.Service
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.day.cq.analytics.sitecatalyst.impl.servlets;
import com.day.cq.analytics.sitecatalyst.ClassificationsTransformer;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component
@Service(value={ClassificationsTransformerService.class})
@Reference(name="transformer", referenceInterface=ClassificationsTransformer.class, bind="bindComponent", unbind="unbindComponent", cardinality=ReferenceCardinality.OPTIONAL_MULTIPLE, policy=ReferencePolicy.DYNAMIC)
public class ClassificationsTransformerService {
private static final Logger LOG = LoggerFactory.getLogger(ClassificationsTransformerService.class);
private final ConcurrentHashMap<String, ClassificationsTransformer> transformers = new ConcurrentHashMap();
public ClassificationsTransformer getTransformer(String name) {
return this.transformers.get(name);
}
public Map<String, ClassificationsTransformer> getTransformers() {
return this.transformers;
}
protected void bindComponent(ClassificationsTransformer transformer, Map<String, Object> props) {
String name = transformer.getClass().getSimpleName();
LOG.info("Binding ClassificationsTransformer: {}", (Object)name);
this.transformers.put(name, transformer);
this.logComponents();
}
protected void unbindComponent(ClassificationsTransformer transformer, Map<String, Object> props) {
String name = transformer.getClass().getSimpleName();
LOG.info("Unbinding ClassificationsTransformer: {}", (Object)name);
this.transformers.remove(name);
this.logComponents();
}
private void logComponents() {
if (LOG.isDebugEnabled()) {
LOG.debug("ClassificationsTransformer count changed, list rebuilt with {} transformers: [{}]", (Object)this.transformers.size(), (Object)this.transformers.keySet());
}
}
}