KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > i18n > BundleFactory


1 /*
2  * Copyright 1999-2005 The Apache Software Foundation.
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 org.apache.cocoon.i18n;
17
18 import org.apache.avalon.framework.component.Component;
19 import org.apache.avalon.framework.component.ComponentException;
20
21 import java.util.Locale JavaDoc;
22
23 /**
24  * Bundle Factory implementations are responsible for loading and providing
25  * particular types of resource bundles, implementors of Bundle interface.
26  *
27  * @author <a HREF="mailto:kpiroumian@apache.org">Konstantin Piroumian</a>
28  * @author <a HREF="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
29  * @version $Id: BundleFactory.java 312968 2005-10-11 22:28:46Z vgritsenko $
30  */

31 public interface BundleFactory extends Component {
32
33     /**
34      * Bundle factory ROLE name
35      */

36     String JavaDoc ROLE = BundleFactory.class.getName();
37
38     /**
39      * Constants for bundle factory configuration keys
40      */

41     static class ConfigurationKeys {
42         /**
43          * Configuration element specifying default location of the
44          * resource bundles.
45          *
46          * @see BundleFactory#select(String, String)
47          * @see BundleFactory#select(String, java.util.Locale)
48          */

49         public static final String JavaDoc ROOT_DIRECTORY = "catalogue-location";
50
51         /**
52          * Configuration element specifying role of the Store instance to use
53          * for storing cached bundles
54          * @since 2.1.8
55          */

56         public static final String JavaDoc STORE_ROLE = "store-role";
57
58         /**
59          * Configuration element specifying delay (in ms) between
60          * reload checks.
61          * @since 2.1.8
62          */

63         public static final String JavaDoc RELOAD_INTERVAL = "reload-interval";
64     }
65
66     /**
67      * Select a bundle based on the catalogue base location, bundle name,
68      * and the locale name.
69      *
70      * @param base catalogue base location (URI)
71      * @param bundleName bundle name
72      * @param locale locale name
73      * @return the bundle
74      * @exception ComponentException if a bundle is not found
75      */

76     Bundle select(String JavaDoc base, String JavaDoc bundleName, String JavaDoc locale) throws ComponentException;
77
78     /**
79      * Select a bundle based on the catalogue base location, bundle name,
80      * and the locale.
81      *
82      * @param base catalogue base location (URI)
83      * @param bundleName bundle name
84      * @param locale locale
85      * @return the bundle
86      * @exception ComponentException if a bundle is not found
87      */

88     Bundle select(String JavaDoc base, String JavaDoc bundleName, Locale JavaDoc locale) throws ComponentException;
89
90     /**
91      * Select a bundle based on the catalogue base location, bundle name,
92      * and the locale.
93      *
94      * @param directories catalogue base location (URI)
95      * @param bundleName bundle name
96      * @param locale locale
97      * @return the bundle
98      * @exception ComponentException if a bundle is not found
99      */

100     Bundle select(String JavaDoc[] directories, String JavaDoc bundleName, Locale JavaDoc locale) throws ComponentException;
101
102     /**
103      * Select a bundle based on the bundle name and the locale name from
104      * the default catalogue.
105      *
106      * @param bundleName bundle name
107      * @param locale locale name
108      * @return the bundle
109      * @exception ComponentException if a bundle is not found
110      */

111     Bundle select(String JavaDoc bundleName, String JavaDoc locale) throws ComponentException;
112
113     /**
114      * Select a bundle based on the bundle name and the locale from
115      * the default catalogue.
116      *
117      * @param bundleName bundle name
118      * @param locale locale
119      * @return the bundle
120      * @exception ComponentException if a bundle is not found
121      */

122     Bundle select(String JavaDoc bundleName, Locale JavaDoc locale) throws ComponentException;
123
124     /**
125      * Releases a bundle back to the bundle factory when it's not needed
126      * anymore.
127      * @param bundle the bundle
128      */

129     void release(Bundle bundle);
130 }
131
Popular Tags