Source Code Cross Referenced for LocaleServiceProvider.java in  » 6.0-JDK-Core » Collections-Jar-Zip-Logging-regex » java » util » spi » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Collections Jar Zip Logging regex » java.util.spi 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
003         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004         *
005         * This code is free software; you can redistribute it and/or modify it
006         * under the terms of the GNU General Public License version 2 only, as
007         * published by the Free Software Foundation.  Sun designates this
008         * particular file as subject to the "Classpath" exception as provided
009         * by Sun in the LICENSE file that accompanied this code.
010         *
011         * This code is distributed in the hope that it will be useful, but WITHOUT
012         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014         * version 2 for more details (a copy is included in the LICENSE file that
015         * accompanied this code).
016         *
017         * You should have received a copy of the GNU General Public License version
018         * 2 along with this work; if not, write to the Free Software Foundation,
019         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020         *
021         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022         * CA 95054 USA or visit www.sun.com if you need additional information or
023         * have any questions.
024         */
025
026        package java.util.spi;
027
028        import java.util.Locale;
029
030        /**
031         * <p>
032         * This is the super class of all the locale sensitive service provider 
033         * interfaces (SPIs).  
034         * <p>
035         * Locale sensitive  service provider interfaces are interfaces that 
036         * correspond to locale sensitive classes in the <code>java.text</code>
037         * and <code>java.util</code> packages. The interfaces enable the 
038         * construction of locale sensitive objects and the retrieval of 
039         * localized names for these packages. Locale sensitive factory methods 
040         * and methods for name retrieval in the <code>java.text</code> and 
041         * <code>java.util</code> packages use implementations of the provider 
042         * interfaces to offer support for locales beyond the set of locales 
043         * supported by the Java runtime environment itself.
044         * <p>
045         * <h4>Packaging of Locale Sensitive Service Provider Implementations</h4>
046         * Implementations of these locale sensitive services are packaged using the 
047         * <a href="../../../../technotes/guides/extensions/index.html">Java Extension Mechanism</a>
048         * as installed extensions.  A provider identifies itself with a 
049         * provider-configuration file in the resource directory META-INF/services, 
050         * using the fully qualified provider interface class name as the file name. 
051         * The file should contain a list of fully-qualified concrete provider class names, 
052         * one per line. A line is terminated by any one of a line feed ('\n'), a carriage 
053         * return ('\r'), or a carriage return followed immediately by a line feed. Space 
054         * and tab characters surrounding each name, as well as blank lines, are ignored. 
055         * The comment character is '#' ('\u0023'); on each line all characters following 
056         * the first comment character are ignored. The file must be encoded in UTF-8.
057         * <p>
058         * If a particular concrete provider class is named in more than one configuration 
059         * file, or is named in the same configuration file more than once, then the 
060         * duplicates will be ignored. The configuration file naming a particular provider 
061         * need not be in the same jar file or other distribution unit as the provider itself. 
062         * The provider must be accessible from the same class loader that was initially 
063         * queried to locate the configuration file; this is not necessarily the class loader 
064         * that loaded the file. 
065         * <p>
066         * For example, an implementation of the
067         * {@link java.text.spi.DateFormatProvider DateFormatProvider} class should 
068         * take the form of a jar file which contains the file: 
069         * <pre>
070         * META-INF/services/java.text.spi.DateFormatProvider 
071         * </pre>
072         * And the file <code>java.text.spi.DateFormatProvider</code> should have 
073         * a line such as: 
074         * <pre>
075         * <code>com.foo.DateFormatProviderImpl</code>
076         * </pre>
077         * which is the fully qualified class name of the class implementing 
078         * <code>DateFormatProvider</code>.
079         * <h4>Invocation of Locale Sensitive Services</h4>
080         * <p>
081         * Locale sensitive factory methods and methods for name retrieval in the 
082         * <code>java.text</code> and <code>java.util</code> packages invoke 
083         * service provider methods when needed to support the requested locale. 
084         * The methods first check whether the Java runtime environment itself 
085         * supports the requested locale, and use its support if available. 
086         * Otherwise, they call the <code>getAvailableLocales()</code> methods of 
087         * installed providers for the appropriate interface to find one that 
088         * supports the requested locale. If such a provider is found, its other 
089         * methods are called to obtain the requested object or name. If neither 
090         * the Java runtime environment itself nor an installed provider supports 
091         * the requested locale, a fallback locale is constructed by replacing the 
092         * first of the variant, country, or language strings of the locale that's 
093         * not an empty string with an empty string, and the lookup process is 
094         * restarted. In the case that the variant contains one or more '_'s, the 
095         * fallback locale is constructed by replacing the variant with a new variant 
096         * which eliminates the last '_' and the part following it.  Even if a 
097         * fallback occurs, methods that return requested objects or name are 
098         * invoked with the original locale before the fallback.The Java runtime 
099         * environment must support the root locale for all locale sensitive services 
100         * in order to guarantee that this process terminates.
101         * <p>
102         * Providers of names (but not providers of other objects) are allowed to 
103         * return null for some name requests even for locales that they claim to 
104         * support by including them in their return value for 
105         * <code>getAvailableLocales</code>. Similarly, the Java runtime 
106         * environment itself may not have all names for all locales that it 
107         * supports. This is because the sets of objects for which names are 
108         * requested can be large and vary over time, so that it's not always 
109         * feasible to cover them completely. If the Java runtime environment or a 
110         * provider returns null instead of a name, the lookup will proceed as 
111         * described above as if the locale was not supported.
112         * 
113         * @since        1.6
114         * @version      @(#)LocaleServiceProvider.java	1.10 07/05/05
115         */
116        public abstract class LocaleServiceProvider {
117
118            /**
119             * Sole constructor.  (For invocation by subclass constructors, typically
120             * implicit.)
121             */
122            protected LocaleServiceProvider() {
123            }
124
125            /**
126             * Returns an array of all locales for which this locale service provider 
127             * can provide localized objects or names.
128             *
129             * @return An array of all locales for which this locale service provider 
130             * can provide localized objects or names.
131             */
132            public abstract Locale[] getAvailableLocales();
133        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.