[opencms-dev] OpenCms 8 deleteResource not working

Christoph Fröhlich cfauto at folge2.de
Sun Sep 2 13:53:19 CEST 2012


looks perfect. 
Just assure that CmsMyShellCommands is available on your classpath (for example put it somewhere below "classes") and it should work 

Regards
Christoph

Am 02.09.2012 um 12:47 schrieb Daniel Beddoe:

> We also run it like this aswell! 
> java -classpath "${SERVLET_API}:${JSP_API}:${OPENCMS_CLASSPATH}:${TOMCAT_CLASSPATH}:classes" org.opencms.main.CmsShell -base="${OPENCMS_BASE}"
> So would we add that -additional flag like this:
> java -classpath "${SERVLET_API}:${JSP_API}:${OPENCMS_CLASSPATH}:${TOMCAT_CLASSPATH}:classes" org.opencms.main.CmsShell -additional="my.company.CmsMyShellCommands" -base="${OPENCMS_BASE}"
> 
> Thanks,
> 
> Dan
> 
> On Sun, Sep 2, 2012 at 11:40 AM, Daniel Beddoe <daniel.beddoe123 at googlemail.com> wrote:
> Hi,
> 
> Thank you very much for your suggestion. Just a few things to clarify. So this class goes in /org/opencms/main/ directory in the opencms.jar file, correct?
> We run the cms shell by entering ./cmsshell.sh at the prompt, so it will now become something like: 
> ./cmsshell.sh -additional=my.company.CmsMyShellCommands ?
> 
> Thanks very much for your help once again!
> 
> Dan
> 
> 
> On Sat, Sep 1, 2012 at 6:03 PM, Christoph Fröhlich <cfauto at folge2.de> wrote:
> 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
>> 
>> 
>> 
> 
> 
> _______________________________________________
> 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/20120902/8864c955/attachment.htm>


More information about the opencms-dev mailing list