[opencms-dev] Resource Bundles

Pere Torrodellas ptorrodellas at fihoca.com
Wed Dec 21 09:29:45 CET 2005


Hola Jorge, this was my approach to the problem:

- Load your data in Singletons that have a method to get it and another to
reload it.
- Build a class that implements I_CmsEventListener, and register an instance
of it as:

int[] events = {I_CmsEventListener.EVENT_PUBLISH_PROJECT};
OpenCms.addCmsEventListener(listenerInstance, events);

- Its cmsEvent(CmsEvent ev) method will be invoked each time a resource is
published. There, I look at the list of published resources and decide,
based on their path, if I should reload the data. This is the code I use:

CmsUUID publishHistoryId = new
CmsUUID((String)ev.getData().get(I_CmsEventListener.KEY_PUBLISHID)); // Note
the typo
List publishedResources = cms.readPublishedResources(publishHistoryId);
Iterator it = publishedResources.iterator();
CmsPublishedResource pr = null;
String path = null;
while(it.hasNext()) {
    pr = (CmsPublishedResource)it.next();
   path = pr.getRootPath();
   /*
    * Here, analyse path and decide if it's one of the files to reload. If
    * so, invoke your Singleton reload method.
    */
}

HTH

Pere

----- Original Message -----
From: "Jorge González" <informatico at hotelparadisepark.com>
To: "'The OpenCms mailing list'" <opencms-dev at opencms.org>
Sent: Tuesday, December 20, 2005 6:38 PM
Subject: [opencms-dev] Resource Bundles


> Hi list:
>
> Do anybody know a better approach to solve the resource bundle necesity of
> reloading the app server to update the translations / add new keys ?
>
> I can't understand why do i have to stop the content editors work to
> slightly change one frontend phrase, or add a new button label.
>
> Need help on it !
>
>
> Thanks.
>
>
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev




More information about the opencms-dev mailing list