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 package info.magnolia.context;
35
36 import info.magnolia.cms.security.AccessManager;
37 import info.magnolia.cms.security.User;
38
39 import java.util.Locale;
40 import java.util.Map;
41
42 import javax.jcr.LoginException;
43 import javax.jcr.RepositoryException;
44 import javax.jcr.Session;
45 import javax.security.auth.Subject;
46
47
48
49
50
51 public class ContextDecorator extends AbstractContext {
52
53 protected Context ctx;
54
55
56
57
58 public ContextDecorator(Context ctx) {
59 this.ctx = ctx;
60 }
61
62
63
64
65 @Override
66 public AccessManager getAccessManager(String name) {
67 return this.ctx.getAccessManager(name);
68 }
69
70
71
72
73 @Override
74 public Object getAttribute(String name, int scope) {
75 return this.ctx.getAttribute(name, scope);
76 }
77
78
79
80
81 @Override
82 public Map<String, Object> getAttributes(int scope) {
83 return this.ctx.getAttributes(scope);
84 }
85
86 @Override
87 public Session getJCRSession(String workspaceName) throws LoginException, RepositoryException {
88 return this.ctx.getJCRSession(workspaceName);
89 }
90
91
92
93
94 @Override
95 public User getUser() {
96 return this.ctx.getUser();
97 }
98
99
100
101
102 @Override
103 public void setAttribute(String name, Object value, int scope) {
104 this.ctx.setAttribute(name, value, scope);
105 }
106
107
108
109
110 @Override
111 public void removeAttribute(String name, int scope) {
112 this.ctx.removeAttribute(name, scope);
113 }
114
115 @Override
116 public Subject getSubject() {
117 return ctx.getSubject();
118 }
119
120 @Override
121 public void setLocale(Locale locale) {
122 ctx.setLocale(locale);
123 }
124
125 @Override
126 public Locale getLocale() {
127 return ctx.getLocale();
128 }
129
130
131
132
133
134
135
136 public Context getWrappedContext() {
137 return this.ctx;
138 }
139
140 @Override
141 public void release() {
142 this.ctx.release();
143 }
144
145 }