1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package io.wcm.sling.models.injectors.impl;
21
22 import org.osgi.service.component.annotations.Activate;
23 import org.osgi.service.component.annotations.Component;
24 import org.osgi.service.metatype.annotations.AttributeDefinition;
25 import org.osgi.service.metatype.annotations.Designate;
26 import org.osgi.service.metatype.annotations.ObjectClassDefinition;
27
28
29
30
31 @Component(service = ModelsImplConfiguration.class, immediate = true)
32 @Designate(ocd = ModelsImplConfiguration.Config.class)
33 public class ModelsImplConfiguration {
34
35 @ObjectClassDefinition(name = "wcm.io Models Configuration",
36 description = "Configures behavior of the wcm.io Injectors for Sling Models")
37 @interface Config {
38
39 @AttributeDefinition(name = "Request Thread Local",
40 description = "Enables the thread-local based injection of all request-derived objects in AEM Object " +
41 "and Sling Object injectors. These objects can than always be injected regardless of the adaptable.")
42 boolean requestThreadLocal() default true;
43
44 }
45
46 private boolean requestThreadLocal;
47
48 @Activate
49 private void activate(Config config) {
50 requestThreadLocal = config.requestThreadLocal();
51 }
52
53
54
55
56
57
58 public boolean isRequestThreadLocal() {
59 return this.requestThreadLocal;
60 }
61
62 }