KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > api > cintoo > messages > bundle > BundleManager


1 /*
2  * Copyright 2006 cintoo, Berlin, Germany
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package api.cintoo.messages.bundle;
17
18 import api.cintoo.messages.context.Context;
19 import api.cintoo.messages.context.ContextCache;
20
21 import java.util.Locale JavaDoc;
22 import java.util.ResourceBundle JavaDoc;
23
24 /**
25  * Bundle manager stores associations from bundles and contexts.
26  * Bundles can be associated with a context and bundles can
27  * be found by a context.
28  *
29  * @author Stephan J. Schmidt
30  * @version $id$
31  * @since 1.0
32  */

33 public interface BundleManager {
34   /**
35    * Set bundle for full scope
36    *
37    * @param bundleName bundle to set
38    */

39   public void setBundle(String JavaDoc bundleName);
40
41   /**
42    * Set bundle with for package pattern
43    *
44    * @param bundleName bundle to set
45    * @param packageName package scope of the bundle
46    */

47   public void setBundle(String JavaDoc bundleName, String JavaDoc packageName);
48
49   /**
50    * Set bundle for context
51    *
52    * @param bundleName bundle to set
53    * @param context context with the scope of the bundle
54    */

55   public void setBundle(String JavaDoc bundleName, Context context);
56
57   /**
58    * Return full scope bundle
59    *
60    * @param locale locale for which the bundle should be returned
61    * @return corresponding bundle
62    */

63   public ResourceBundle JavaDoc getBundle(Locale JavaDoc locale);
64
65   /**
66    * Return bundle for given context and locale.
67    *
68    * @param contextObject object which defines the scope
69    * @param locale locale for which the bundle should be created
70    * @return matching bundle
71    */

72   public ResourceBundle JavaDoc getBundle(Object JavaDoc contextObject, Locale JavaDoc locale);
73
74   /**
75    * Set a context cache which the manager should use to cache
76    * context to bundle mappings.
77    *
78    * @param contextCache context cache to use for caching contexts
79    */

80   public void setContextCache(ContextCache contextCache);
81
82   /**
83    * Clear all cached bundles and mappings
84    */

85   public void clear();
86 }
87
Popular Tags