[opencms-dev] I_CmsResourceLoader and I_CmsLauncher: which to use?

Alexander Kandzior alex at opencms.org
Sat Mar 13 08:42:01 CET 2004


Matt,

the launcher interface comes from the OpenCms 4 versions that only had the
XmlTemplate mechanism available. The loader interface was added for OpenCms
5 chiefly because of different requirements in the JSP integration. This
makes the code in OpenCms version 5 quite messy. All will be better in in
version 6 (sound like I repeat myself ;-). But there will also be changes in
version 6 that will break version 5 launcher/loader code.

For version 5, you must implement the loader interface if you want you
resource being a sub-element of JSP pages (ie. something you load with
<cms:include>). You must implement the launcher interface if you want your
resource being a sub-element of an XmlTemplate. You must implement both if
you want both. 

If your resource does not need to be a sub-element in a template (like e.g.
images, binaries) then you can use the DumpLauncher as base and go from
there. 

But there will be changes in that area in version 6!

Best Regards,
Alex.

Alexander Kandzior
Alkacon Software - The OpenCms Experts
http://www.alkacon.com



> -----Original Message-----
> From: opencms-dev-admin at opencms.org 
> [mailto:opencms-dev-admin at opencms.org] On Behalf Of M Butcher
> Sent: Saturday, March 13, 2004 1:10 AM
> To: opencms-dev at opencms.org
> Subject: [opencms-dev] I_CmsResourceLoader and I_CmsLauncher: 
> which to use?
> 
> 
> 
> I want to add a custom launcher-thing to handle my new custom 
> resource 
> type. Reading through the Javadocs, it appears that I have 
> two options: 
> I can implement I_CmsResourceLoader or I_CmsLauncher.
> 
> I tried implementing the I_CmsLauncher interface, basing it 
> largely on 
> A_CmsLauncher and the CmsLinkLauncher class. The only methods that I 
> implemented were those defined in I_CmsLauncher. Once I finished and 
> compiled it, I loaded it into my module, added it to <launchers/> in 
> registry.xml, associated <launcherType/> for my resource type, and 
> restarted Tomcat, and... nothing happened.
> 
> Well, actually, I did get this note in the log:
> 
> Launcher loaded: 
> tv.aleph_null.opencms.xml.generic.CmsXslLauncher with id 21
> 
> No errors or anything -- not even in catalina.out.
> 
> My resource type definition looks like this:
> <restype>
>    <name>genxml</name>
>    <launcherType>21</launcherType>
>    <launcherClass/>
>    
> <resourceClass>com.opencms.file.GenericXmlResourceType</resourceClas
> s>
> </restype>
> 
> But as far as I can tell, the CmsDumpLoader is being used 
> instead of the 
> CmsXslLauncher launcher that I defined. So... did I miss the point of 
> how to implement an I_CmsLauncher? Should I have used an 
> I_CmsResourceLoader? What is the difference?
> 
> Actually, I like the I_CmsResourceLoader interface a lot more (looks 
> like a servlet), but I don't know how to register it. Do I use the 
> <launchers/> definition for that, too?
> 
> Thanks,
> 
> Matt
> _______________________________________________
> 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