[opencms-dev] How to get instance of CmsLauncherManager without calling new OpenCms(...)

Thomas Joseph Olaes thomas.olaes at gmail.com
Tue Aug 17 01:23:24 CEST 2004


Hello list,

I finally got my script working!

However, I do have a slight problem. I added the following lines to
CmsStaticExport.java at approximately line 630ish:

...

            // everthing is prepared now start the template mechanism
            CmsObject cmsForStaticExport =
m_cms.getCmsObjectForStaticExport(dReq, dRes); // m_cms has no
launcher manager!!

            /* Added 8/16/2004 11:02AM to address the null
LauncherManager during a scheduled task */
            if(cmsForStaticExport.getLauncherManager() == null){
              cmsForStaticExport.setLauncherManager(new
CmsLauncherManager(new OpenCms(new Configurations(new
ExtendedProperties("C:\\tomcat\\webapps\\opencms\\WEB-INF\\config\\opencms-nocron.properties")))));
            }

            cmsForStaticExport.setMode(C_MODUS_EXPORT);

...

I am constructing a new instance of OpenCms in the above code, and
I've altered the constructor for opencms  to read an additional line
from a separate .properties file that will disable the scheduler
daemon.

The log files are showing new instances of opencms being constructed,
which is fine and dandy i guess since that's technically what I'm
doing every time CmsStaticExport is called and the launchermanager
thing is null. However I feel there is a quick way to make this
process simpler... Ideally I would like to get the opencms object that
the CmsObject that is already passed into my task is attached to...
I'm thinking of altering CmsObject to do something like "getOpenCms()"
return the OpenCms object that's already running... somehow.

How do I do this better? Is my solution correct? Is it even possible?
I'm no Java expert, much less an OpenCms expert, so if anyone has a
better way of just getting an instance of CmsLauncherManager() without
having to create a brand new OpenCms object, I'm all ears.

I was also looking at using the CVS, but as with 90% of the things
coding-related on the internet, I'm a CVS newbie as well, and looking
at the web interface it's not readily apparent to me what files I need
to update/add to my current set of code files from the 5.0.1 source
package. I noticed there were some static export issues addressed in
some versions of CmsStaticExport.java... could it be possible I could
patch these into 5.0.1?

Thanks for the help so far, and thanks in advance for any responses to
my inquiry.

-TJ



More information about the opencms-dev mailing list