KickJava   Java API By Example, From Geeks To Geeks.

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


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-2006 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.i18n.Messages;
18 import info.magnolia.cms.security.AccessManager;
19 import info.magnolia.cms.security.User;
20
21 import java.util.Locale JavaDoc;
22 import java.util.Map JavaDoc;
23
24
25 /**
26  * This interface defines all the methods which should be implemented by any configured magnolia context, implementing
27  * class should never be accessible directly but only via MgnlContext static methods which work on a local (Thread) copy
28  * of the implementation
29  * @author Sameer Charles
30  * @version $Revision $ ($Author $)
31  */

32 public interface Context extends org.apache.commons.chain.Context {
33
34     /**
35      * Attribute visibility scope
36      */

37     public static final int LOCAL_SCOPE = 1;
38
39     /**
40      * Attribute visibility scope Shared by all requests from this session
41      */

42     public static final int SESSION_SCOPE = 2;
43
44     /**
45      * Attribute visibility scope, its visible to all sessions of this application
46      */

47     public static final int APPLICATION_SCOPE = 3;
48
49     final static public String JavaDoc ATTRIBUTE_REPOSITORY = "repository";
50
51     final static public String JavaDoc ATTRIBUTE_PATH = "path";
52
53     final static public String JavaDoc ATTRIBUTE_VERSION = "version";
54
55     final static public String JavaDoc ATTRIBUTE_VERSION_MAP = "versionMap";
56
57     final static public String JavaDoc ATTRIBUTE_UUID = "uuid";
58
59     final static public String JavaDoc ATTRIBUTE_RECURSIVE = "recursive";
60
61     public static final String JavaDoc ATTRIBUTE_COMMENT = "comment";
62
63     public static final String JavaDoc ATTRIBUTE_MESSAGE = "msg";
64
65     public static final String JavaDoc ATTRIBUTE_EXCEPTION = "exception";
66
67     /**
68      * Set user instance for this context
69      * @param user
70      */

71     public void setUser(User user);
72
73     /**
74      * Get exiting logged in user instance
75      * @return User
76      * @see info.magnolia.cms.security.User
77      */

78     public User getUser();
79
80     /**
81      * @param locale
82      */

83     public void setLocale(Locale JavaDoc locale);
84
85     /**
86      * Get the current locale
87      */

88     public Locale JavaDoc getLocale();
89
90     /**
91      * Get hierarchy manager initialized for this user
92      * @param repositoryId
93      * @return hierarchy manager
94      */

95     public HierarchyManager getHierarchyManager(String JavaDoc repositoryId);
96
97     /**
98      * Get hierarchy manager initialized for this user
99      * @param repositoryId
100      * @param workspaceId
101      * @return hierarchy manager
102      */

103     public HierarchyManager getHierarchyManager(String JavaDoc repositoryId, String JavaDoc workspaceId);
104
105     /**
106      * Get access manager for the specified repository on default workspace
107      * @param repositoryId
108      * @return access manager
109      */

110     public AccessManager getAccessManager(String JavaDoc repositoryId);
111
112     /**
113      * Get access manager for the specified repository on the specified workspace
114      * @param repositoryId
115      * @param workspaceId
116      * @return access manager
117      */

118     public AccessManager getAccessManager(String JavaDoc repositoryId, String JavaDoc workspaceId);
119
120     /**
121      * Get QueryManager created for this user on the specified repository
122      * @param repositoryId
123      * @return query manager
124      */

125     public QueryManager getQueryManager(String JavaDoc repositoryId);
126
127     /**
128      * Get QueryManager created for this user on the specified repository and workspace
129      * @param repositoryId
130      * @param workspaceId
131      * @return query manager
132      */

133     public QueryManager getQueryManager(String JavaDoc repositoryId, String JavaDoc workspaceId);
134
135     /**
136      * Set attribute value, scope of the attribute is defined
137      * @param name is used as a key
138      * @param value
139      * @param scope , highest level of scope from which this attribute is visible
140      */

141     public void setAttribute(String JavaDoc name, Object JavaDoc value, int scope);
142
143     /**
144      * Get attribute value
145      * @param name to which value is associated to
146      * @param scope the scope (request, session, application)
147      * @return attribute value
148      */

149     public Object JavaDoc getAttribute(String JavaDoc name, int scope);
150
151     /**
152      * Get attribute value without passing a scope. the scopes are searched from bottom up (request, session,
153      * application)
154      * @param name to which value is associated to
155      * @return attribute value
156      */

157     public Object JavaDoc getAttribute(String JavaDoc name);
158
159     /**
160      * Get a map of a attributes set in the scope
161      * @param scope
162      * @return the map
163      */

164     public Map JavaDoc getAttributes(int scope);
165
166     /**
167      * Remove an attribute
168      * @param name
169      * @param scope
170      */

171     public void removeAttribute(String JavaDoc name, int scope);
172
173     /**
174      * Get an over all map
175      * @return the map
176      */

177     public Map JavaDoc getAttributes();
178
179     /**
180      * Get the default messages. It uses the locale set on this context
181      */

182     public Messages getMessages();
183
184     /**
185      * Get the messages of the named bundle. It uses the locale set on this context
186      * @param basename name of the bundle
187      */

188     public Messages getMessages(String JavaDoc basename);
189
190 }
191
Popular Tags