@Override
    public boolean deleteResource(CmsObject cms, String resourcename, CmsResourceDeleteMode siblingMode)
    throws CmsException {

        // find the xml page this is for
        CmsResource xmlPage = findXmlPage(cms, resourcename);
        if (xmlPage != null) {

            // cut off trailing slash
            if (resourcename.endsWith("/")) {
                resourcename = resourcename.substring(0, resourcename.length() - 1);
            }

            // get the path below the xml page
            String path = getSubPath(cms, xmlPage, resourcename);

            // if sub path is empty
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(path)) {

                // delete the xml page itself
                cms.deleteResource(resourcename, siblingMode);

                // remove all virtual files for this resource
                Iterator<String> iter = getVirtualFiles().iterator();
                while (iter.hasNext()) {
                    TMP_FILE_TABLE.remove(resourcename + "/" + iter.next());
                }

                return true;
            }

            CmsFile file = cms.readFile(xmlPage);
            CmsXmlPage xml = CmsXmlPageFactory.unmarshal(cms, file);

            String[] tokens = path.split("/");
            if (tokens.length == 1) {

                // deleting a virtual file
                if (getVirtualFiles().contains(tokens[0])) {

                    // mark the virtual file in the temp file table as deleted
                    TMP_FILE_TABLE.add(resourcename);
                } else {

                    // delete locale
                    xml.removeLocale(CmsLocaleManager.getLocale(tokens[0]));

                    // save the xml page
                    file.setContents(xml.marshal());
                    cms.writeFile(file);
                }

            } else if (tokens.length == 2) {

                String name = tokens[1];
                if (name.endsWith(EXTENSION_ELEMENT)) {
                    name = name.substring(0, name.length() - EXTENSION_ELEMENT.length() - 1);
                }

                // delete element
                xml.removeValue(name, CmsLocaleManager.getLocale(tokens[0]));

                // save the xml page
                file.setContents(xml.marshal());
                cms.writeFile(file);
            }

            return true;
        }

        return false;
    }
@ Override public boolean deleteResource ( CmsObject cms , String resourcename , CmsResourceDeleteMode siblingMode ) throws CmsException { CmsResource xmlPage = findXmlPage ( cms , resourcename ) ; if ( xmlPage != null ) { if ( resourcename . endsWith ( "/" ) ) { resourcename = resourcename . substring ( 0 , resourcename . length ( ) - 1 ) ; } String path = getSubPath ( cms , xmlPage , resourcename ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( path ) ) { cms . deleteResource ( resourcename , siblingMode ) ; Iterator < String > iter = getVirtualFiles ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { TMP_FILE_TABLE . remove ( resourcename + "/" + iter . next ( ) ) ; } return true ; } CmsFile file = cms . readFile ( xmlPage ) ; CmsXmlPage xml = CmsXmlPageFactory . unmarshal ( cms , file ) ; String [ ] tokens = path . split ( "/" ) ; if ( tokens . length == 1 ) { if ( getVirtualFiles ( ) . contains ( tokens [ 0 ] ) ) { TMP_FILE_TABLE . add ( resourcename ) ; } else { xml . removeLocale ( CmsLocaleManager . getLocale ( tokens [ 0 ] ) ) ; file . setContents ( xml . marshal ( ) ) ; cms . writeFile ( file ) ; } } else if ( tokens . length == 2 ) { String name = tokens [ 1 ] ; if ( name . endsWith ( EXTENSION_ELEMENT ) ) { name = name . substring ( 0 , name . length ( ) - EXTENSION_ELEMENT . length ( ) - 1 ) ; } xml . removeValue ( name , CmsLocaleManager . getLocale ( tokens [ 0 ] ) ) ; file . setContents ( xml . marshal ( ) ) ; cms . writeFile ( file ) ; } return true ; } return false ; }
@see org.opencms.file.wrapper.A_CmsResourceWrapper#deleteResource(CmsObject, String, org.opencms.file.CmsResource.CmsResourceDeleteMode)