KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > context > ContextDecorator


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2005 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.context;
14
15 import info.magnolia.cms.core.HierarchyManager;
16 import info.magnolia.cms.core.search.QueryManager;
17 import info.magnolia.cms.security.AccessManager;
18 import info.magnolia.cms.security.User;
19
20 import java.util.Map JavaDoc;
21
22
23 /**
24  * Subclass this context if you like to decorate an other context
25  * @author Philipp Bracher
26  * @version $Revision: 6494 $ ($Author: fgiust $)
27  */

28 public class ContextDecorator extends AbstractContext {
29
30     protected Context ctx;
31
32     /**
33      * @param ctx the context to decorate
34      */

35     public ContextDecorator(Context ctx) {
36         this.ctx = ctx;
37     }
38
39     /**
40      * Delegate
41      */

42     public AccessManager getAccessManager(String JavaDoc repositoryId, String JavaDoc workspaceId) {
43         return this.ctx.getAccessManager(repositoryId, workspaceId);
44     }
45
46     /**
47      * Delegate
48      */

49     public Object JavaDoc getAttribute(String JavaDoc name, int scope) {
50         return this.ctx.getAttribute(name, scope);
51     }
52
53     /**
54      * Delegate
55      */

56     public Map JavaDoc getAttributes(int scope) {
57         return this.ctx.getAttributes(scope);
58     }
59
60     /**
61      * Delegate
62      */

63     public HierarchyManager getHierarchyManager(String JavaDoc repositoryId, String JavaDoc workspaceId) {
64         return this.ctx.getHierarchyManager(repositoryId, workspaceId);
65     }
66
67     /**
68      * Delegate
69      */

70     public User getUser() {
71         return this.ctx.getUser();
72     }
73
74     /**
75      * Delegate
76      */

77     public void setAttribute(String JavaDoc name, Object JavaDoc value, int scope) {
78         this.ctx.setAttribute(name, value, scope);
79     }
80
81     /**
82      * Delegate
83      */

84     public void setUser(User user) {
85         this.ctx.setUser(user);
86     }
87
88     /**
89      * Delegate
90      */

91     public QueryManager getQueryManager(String JavaDoc repositoryId, String JavaDoc workspaceId) {
92         return this.ctx.getQueryManager(repositoryId, workspaceId);
93     }
94
95     /**
96      * Delegate
97      */

98     public void removeAttribute(String JavaDoc name, int scope) {
99         this.ctx.removeAttribute(name, scope);
100     }
101
102     /**
103      * Returns the context wrapped by this decorator.
104      * @return wrapped context
105      */

106     public Context getWrappedContext() {
107         return this.ctx;
108     }
109
110 }
111
Popular Tags