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

Olli Aro olli_aro at yahoo.co.uk
Mon Feb 16 15:20:02 CET 2004


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
 




More information about the opencms-dev mailing list