1 Reply Latest reply: Nov 15, 2012 8:31 AM by codigoadf RSS

    Reloading external resource-bundle

    neha
      Hi,

      Version : Jdev 11.1.1.4.0 & 11.1.1.5.0

      I was wondering , if there is any possible way to reload faces-config.xml.

      My Scenario's :

      *1.*
      I have configured a bundle in faces-config.xml
           <resource-bundle>
            <base-name>test.backing.loadMyBundle</base-name>
            <var>rbMyBundle</var>
          </resource-bundle>
      and my bundle class loads data from an external propertyFile
      public class loadMyBundle extends ListResourceBundle {
      
        protected Object[][] getContents() {
      
            PropertyResourceBundle resource= null;
              try {
                  File file = new File("C:\myBundle.properties");
                  fileInputStream = new FileInputStream(file);
                  resource = new PropertyResourceBundle(fileInputStream);
      
              if (resource != null) {           
      
                  /*
                       filling data from loaded property file into contents 
                  */
              }
      
              } catch (IOException ioException) {
               
              } catch (Exception exception) {
               
              }
              return contents;
          }
      
      }
      This getContents method is just called once even if I have changed a label value, where as my scenario to call "getContents" method is called when the resource file is changed or once per session atleast.


      *2.*
      I tried using loadBundle
      <f:loadBundle basename="test.backing.loadMyBundle"
                                   var="rbMyBundle"/>
      but this refers & loads the property file again & again.

      <br>
      My requirment :

      Scenario 1. Is there any way, to reload faces-config.xml every time the session is created. So that new property file is loaded.
      or Scenario 2. Is there any way, I can cache the already loaded bundle & reuse it instead of making a IO call to load file.



      Thanx in advance.
      -Neha..
        • 1. Re: Reloading external resource-bundle
          codigoadf
          Hi,
          maybe these links will help you
          http://technology.amis.nl/2012/07/11/adf-11g-label-modifications-and-persisting-resource-bundle-changes/
          http://technology.amis.nl/2012/08/14/refresh-resource-bundle-from-within-the-adf-application-to-absorb-changes-in-database-backed-bundles/