[opencms-dev] How to add a new resource type

Alexander Kandzior alex at opencms.org
Tue Feb 17 08:46:00 CET 2004


Olli,

just FYI: we will do some changes regarding the resource types for the 6.0
version in the near future. It might be that this solution will not work
right awya when 6.0 is released. But then there will be a easier way to add
resource types available.

In genreral, it's likley that the protected "do..." methods in CmsObject
will be moved to some other object which will be an access layer for
resourceTypes to the database. This access-layer class will have mostly
public methods so that resource types will be able to stay in any package. 

I'll send some update on the list once we have started working on that
issue.

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 Olli Aro
> Sent: Monday, February 16, 2004 3:19 PM
> To: opencms-dev at opencms.org
> Subject: RE: [opencms-dev] How to add a new resource type
> 
> 
> Hi All,
> 
> I got this working:) The process for adding new resource 
> types is as below:-
> 
> 1) Add new content type in register.xml e.g.
> 
> <restype>
>     <name>MyNewType</name>
>     <launcherType>1</launcherType>
>     <launcherClass/>
>  <resourceClass>com.opencms.file. 
> CmsResourceTypeMyNewType</resourceClass>
>         </restype>
> 
> The launcherType attribute depends on your resource type, 
> however the most cases you can use the type 1, which does not 
> include any template parsing and delivers the content as it 
> is stored in your file.
> 
> 2) Write your own CmsResourceType class. It has to be part of 
> the package com.opencms.file, so that the protected methods 
> will work properly. Your class must implement 
> I_CmsResourceType, I_CmsConstants, Serializable and overwrite 
> all required workplace methods. Class 
> com.opencms.file.CmsResourceTypePlain provides an useful 
> example for the class structure.
> 
> 3) Customise the explorer popup menu for your new content 
> type by adding relevant file to /system/workplace/restypes/ 
> directory. Again file compatiblePlain provides an useful example.
> 
> Now you can create new resources based on your type with 
> cms.createResource whereby you must use your new resource 
> type name as the type reference.
> 
> Regards,
> 
> Olli     
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.580 / Virus Database: 367 - Release Date: 06/02/2004
>  
> 
> _______________________________________________
> 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