[opencms-dev] OpenCms 8 deleteResource not working

Christoph Fröhlich cfauto at folge2.de
Sat Sep 1 19:03:12 CEST 2012


Hi Daniel

maybe you can write a custom class that implement I_CmsShellCommands.

When you start CmsShell you pass the class via the additonal argument value (i.e. "-additional=my.company.CmsMyShellCommands")

Your class could look like the one below.
I just wrote it down without really checking that it works but it should point you in the right direction...

--------------------------------------------------------------------------
package my.company;

import org.opencms.file.CmsObject;
import org.opencms.file.CmsResource.CmsResourceDeleteMode;

/**
 * Additional shell commands.
 * @author Christoph Froehlich
 *
 */
public class CmsMyShellCommands implements I_CmsShellCommands {

	private CmsObject cms;
	
	protected  CmsMyShellCommands() {
		super();
	}

	@Override
	public void initShellCmsObject(CmsObject cms, CmsShell shell) {
		this.cms = cms;
	}

	@Override
	public void shellExit() {
		
	}

	@Override
	public void shellStart() {
		
	}

	
	public void deleteResource (String resource, int type) throws Exception{
		CmsResourceDeleteMode mode = CmsResourceDeleteMode.valueOf(type);
		cms.deleteResource(resource, mode);
	}
}


--------------------------------------------------------------------------

Regards 
Christoph


Am 01.09.2012 um 17:50 schrieb Daniel Beddoe:

> Hi, I recently had a look on the OpenCms dev mailing list archives and noticed you recently had a problem with the deleteResource command through the Cms Shell: http://lists.opencms.org/pipermail/opencms-dev/2012q3/037129.html
> 
> Did you manage to find a work around for this using the CmsShellCommands API? So far we have had no luck in finding other commands to replicate this missing command. Any help would be much appreciated.
> 
> Thanks,
> 
> Daniel
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20120901/63755a8b/attachment.htm>


More information about the opencms-dev mailing list