KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > portal > session > PortalResources


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.portal.session;
6
7 import java.util.Locale JavaDoc;
8 import java.util.ResourceBundle JavaDoc;
9 import org.exoplatform.container.PortalContainer;
10 import org.exoplatform.services.resources.LocaleConfig;
11 import org.exoplatform.services.resources.LocaleConfigService;
12 /**
13  * @author Tuan Nguyen (tuan08@users.sourceforge.net)
14  * @since Jan 11, 2005
15  * @version $Id$
16  */

17 public class PortalResources {
18   private static String JavaDoc[] PORTAL_RESOURCES = {"locale.portal.portal"} ;
19   private ResourceBundle JavaDoc portalResource_ ;
20   private ResourceBundle JavaDoc portalOwnerResource_ ;
21   private LocaleConfig localeConfig_ ;
22   
23   public PortalResources() {
24     
25   }
26   
27   public void changeLocaleConfig(String JavaDoc locale, String JavaDoc owner) {
28     LocaleConfigService manager =
29       (LocaleConfigService)PortalContainer.getInstance().
30                            getComponentInstanceOfType(LocaleConfigService.class) ;
31     localeConfig_ = manager.getLocaleConfig(locale);
32     portalResource_ = localeConfig_.getMergeResourceBundle(PORTAL_RESOURCES);
33     portalOwnerResource_ = localeConfig_.getOwnerResourceBundle(owner) ;
34   }
35   
36   public LocaleConfig getLocaleConfig() { return localeConfig_ ; }
37   
38   public Locale JavaDoc getLocale() { return localeConfig_.getLocale() ; }
39   
40   public ResourceBundle JavaDoc getPortalResourceBundle() {
41     return portalResource_ ;
42   }
43   
44   public ResourceBundle JavaDoc getPortalOwnerResourceBundle() {
45     return portalOwnerResource_ ;
46   }
47
48   public ResourceBundle JavaDoc getApplicationResource() {
49     return portalResource_ ;
50   }
51
52   public ResourceBundle JavaDoc getApplicationOwnerResource() {
53     return portalOwnerResource_ ;
54   }
55   
56   public ResourceBundle JavaDoc getApplicationResource(String JavaDoc name) {
57     return localeConfig_.getResourceBundle(name) ;
58   }
59   
60   public ResourceBundle JavaDoc getApplicationOwnerResource(String JavaDoc owner) {
61     return localeConfig_.getOwnerResourceBundle(owner) ;
62   }
63 }
Popular Tags