1 17 package org.jahia.resourcebundle; 18 19 import java.util.Hashtable ; 20 import java.util.ResourceBundle ; 21 22 import org.jahia.params.ParamBean; 23 import org.jahia.services.pages.ContentPage; 24 25 26 32 public class PagesEngineResourceBundle 33 { 34 35 private static final String CLASS_NAME = PagesEngineResourceBundle.class.getName(); 36 37 private static PagesEngineResourceBundle mInstance ; 38 39 private Hashtable resources ; 40 41 42 private PagesEngineResourceBundle(){ 43 resources = new Hashtable (); 44 } 45 46 47 public static synchronized PagesEngineResourceBundle getInstance(){ 48 49 if ( mInstance == null ){ 50 mInstance = new PagesEngineResourceBundle(); 51 } 52 return mInstance; 53 } 54 55 56 63 public void addResourceBundle(ContentPage contentPage, ResourceBundle res, ParamBean jParams ){ 64 65 if ( contentPage == null || res == null || jParams == null ) 66 return; 67 resources.put( JahiaResourceBundle.ENGINE_DEFAULT_RESOURCE_BUNDLE + "_" + contentPage.getID(), res ); 68 } 69 70 77 public ResourceBundle getResourceBundle(ContentPage contentPage, ParamBean jParams ){ 78 79 if ( contentPage == null || jParams == null ) 80 return null; 81 82 ResourceBundle res = (ResourceBundle )resources.get( JahiaResourceBundle.ENGINE_DEFAULT_RESOURCE_BUNDLE 83 + "_" + contentPage.getID() ); 84 return res; 85 } 86 87 } 88 89 | Popular Tags |