[opencms-dev] Accessing files with a new CmsObject instance

bart vandendriessche bart at nascom.be
Thu Dec 9 18:25:13 CET 2004


hi,

I was wondering about how to go about accessing (reading/writing) files 
when you don't have access to the CmsObject that is acquired by doing:
/    CmsJspActionElement cmsjsp = new CmsJspActionElement(pageContext, 
request, response);
    CmsObject cmso = cmsjsp.getCmsObject();/

Usually I just run the code above and then pass on the cmso object as 
required, however,...
I am trying to create a singleton class that will parse a XML file on 
initialization and then keep the contents of this XML file in an 
internal datastructure. Unfortunately, since I want this class to be a 
singleton, I can't pass a CmsObject to it when it initializes. Therefore 
I tried the following:

/CmsObject cmso = new CmsObject();
CmsResourceBroker broker = new CmsResourceBroker();
cmso.init(broker);/

This code however fails. Any help or tips on this matter are greatly 
appreciated.

-Bart



More information about the opencms-dev mailing list