Examples of FailedToDeleteFolderException


Examples of org.apache.jetspeed.page.document.FailedToDeleteFolderException

                        handlerFactory.getDocumentHandler(node.getType()).removeDocument((Document)node);
                    }
                    catch (Exception e)
                    {
                        File documentFile = new File(this.documentRootDir, node.getPath());
                        throw new FailedToDeleteFolderException(documentFile.getAbsolutePath()+" document cannot be deleted.");
                    }
                }
                ((NodeSetImpl)folderImpl.getAllNodes()).remove(node);
            }
        }
        catch (FailedToDeleteFolderException fdfe)
        {
            throw fdfe;
        }
        catch (Exception e)
        {
            throw new FailedToDeleteFolderException(e.getMessage());
        }

        // remove underlying folder and unknown files
        File folderFile = new File(this.documentRootDir, path);
        File metadataFile = null;
        if ((folderImpl.getFolderMetaData() != null) && (folderImpl.getFolderMetaData().getPath() != null))
        {
            metadataFile = new File(this.documentRootDir, folderImpl.getFolderMetaData().getPath());
        }
        if (folderFile.exists() && folderFile.isDirectory())
        {
            // attempt to clean folder for delete
            String[] contents = folderFile.list();
            for (int i = 0; (i < contents.length); i++)
            {
                File contentFile = new File(folderFile, contents[i]);
                if ((metadataFile == null) || !contentFile.equals(metadataFile))
                {
                    if (!deleteFile(contentFile))
                    {
                        throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" unrecognized folder contents cannot be deleted.");
                    }
                }
            }
            // delete folder and metadata
            if ((metadataFile != null) && metadataFile.exists() && !metadataFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder metadata cannot be deleted.");
            }
            // delete folder and all remaining folder contents
            // unless folder is root folder which should be
            // preserved as PSML "mount point"
            if (!path.equals(Folder.PATH_SEPARATOR) && !folderFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder cannot be deleted.");
            }
        }
        else
        {
            throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" not found.");
        }

        // remove from cache
        fileCache.remove(path);
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToDeleteFolderException

                        handlerFactory.getDocumentHandler(node.getType()).removeDocument((Document)node);
                    }
                    catch (Exception e)
                    {
                        File documentFile = new File(this.documentRootDir, node.getPath());
                        throw new FailedToDeleteFolderException(documentFile.getAbsolutePath()+" document cannot be deleted.");
                    }
                }
                ((NodeSetImpl)folderImpl.getAllNodes()).remove(node);
            }
        }
        catch (FailedToDeleteFolderException fdfe)
        {
            throw fdfe;
        }
        catch (Exception e)
        {
            throw new FailedToDeleteFolderException(e.getMessage());
        }

        // remove underlying folder and unknown files
        File folderFile = new File(this.documentRootDir, path);
        File metadataFile = null;
        if ((folderImpl.getFolderMetaData() != null) && (folderImpl.getFolderMetaData().getPath() != null))
        {
            metadataFile = new File(this.documentRootDir, folderImpl.getFolderMetaData().getPath());
        }
        if (folderFile.exists() && folderFile.isDirectory())
        {
            // attempt to clean folder for delete
            String[] contents = folderFile.list();
            for (int i = 0; (i < contents.length); i++)
            {
                File contentFile = new File(folderFile, contents[i]);
                if ((metadataFile == null) || !contentFile.equals(metadataFile))
                {
                    if (!deleteFile(contentFile))
                    {
                        throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" unrecognized folder contents cannot be deleted.");
                    }
                }
            }
            // delete folder and metadata
            if ((metadataFile != null) && metadataFile.exists() && !metadataFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder metadata cannot be deleted.");
            }
            // delete folder and all remaining folder contents
            // unless folder is root folder which should be
            // preserved as PSML "mount point"
            if (!path.equals(Folder.PATH_SEPARATOR) && !folderFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder cannot be deleted.");
            }
        }
        else
        {
            throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" not found.");
        }

        // remove from cache
        fileCache.remove(path);
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToDeleteFolderException

                        handlerFactory.getDocumentHandler(node.getType()).removeDocument((Document)node);
                    }
                    catch (Exception e)
                    {
                        File documentFile = new File(this.documentRootDir, node.getPath());
                        throw new FailedToDeleteFolderException(documentFile.getAbsolutePath()+" document cannot be deleted.");
                    }
                }
                ((NodeSetImpl)folderImpl.getAllNodes()).remove(node);
            }
        }
        catch (FailedToDeleteFolderException fdfe)
        {
            throw fdfe;
        }
        catch (Exception e)
        {
            throw new FailedToDeleteFolderException(e.getMessage());
        }

        // remove underlying folder and unknown files
        File folderFile = new File(this.documentRootDir, path);
        File metadataFile = null;
        if ((folderImpl.getFolderMetaData() != null) && (folderImpl.getFolderMetaData().getPath() != null))
        {
            metadataFile = new File(this.documentRootDir, folderImpl.getFolderMetaData().getPath());
        }
        if (folderFile.exists() && folderFile.isDirectory())
        {
            // attempt to clean folder for delete
            String[] contents = folderFile.list();
            for (int i = 0; (i < contents.length); i++)
            {
                File contentFile = new File(folderFile, contents[i]);
                if ((metadataFile == null) || !contentFile.equals(metadataFile))
                {
                    if (!deleteFile(contentFile))
                    {
                        throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" unrecognized folder contents cannot be deleted.");
                    }
                }
            }
            // delete folder and metadata
            if ((metadataFile != null) && metadataFile.exists() && !metadataFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder metadata cannot be deleted.");
            }
            // delete folder and all remaining folder contents
            // unless folder is root folder which should be
            // preserved as PSML "mount point"
            if (!path.equals(Folder.PATH_SEPARATOR) && !folderFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder cannot be deleted.");
            }
        }
        else
        {
            throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" not found.");
        }

        // remove from cache
        fileCache.remove(path);
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToDeleteFolderException

            // test to make sure folder empty
            File [] folderContents = folderFile.listFiles();
            if ((folderContents.length > 0) &&
                ((folderContents.length > 1) || (metadataFile == null) || !folderContents[0].getName().equals(metadataFile.getName())))
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder not empty.");
            }

            // delete folder and metadata
            if ((metadataFile != null) && metadataFile.exists() && !metadataFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder metadata cannot be deleted.");
            }
            if (!folderFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder cannot be deleted.");
            }
        }

        // remove from cache
        fileCache.remove(path);
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToDeleteFolderException

                        handlerFactory.getDocumentHandler(node.getType()).removeDocument((Document)node);
                    }
                    catch (Exception e)
                    {
                        File documentFile = new File(this.documentRootDir, node.getPath());
                        throw new FailedToDeleteFolderException(documentFile.getAbsolutePath()+" document cannot be deleted.");
                    }
                }
                ((NodeSetImpl)folderImpl.getAllNodes()).remove(node);
            }
        }
        catch (FailedToDeleteFolderException fdfe)
        {
            throw fdfe;
        }
        catch (Exception e)
        {
            throw new FailedToDeleteFolderException(e.getMessage());
        }

        // remove underlying folder and unknown files
        File folderFile = new File(this.documentRootDir, path);
        File metadataFile = null;
        if ((folderImpl.getFolderMetaData() != null) && (folderImpl.getFolderMetaData().getPath() != null))
        {
            metadataFile = new File(this.documentRootDir, folderImpl.getFolderMetaData().getPath());
        }
        if (folderFile.exists() && folderFile.isDirectory())
        {
            // attempt to clean folder for delete
            String[] contents = folderFile.list();
            for (int i = 0; (i < contents.length); i++)
            {
                File contentFile = new File(folderFile, contents[i]);
                if ((metadataFile == null) || !contentFile.equals(metadataFile))
                {
                    if (!deleteFile(contentFile))
                    {
                        throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" unrecognized folder contents cannot be deleted.");
                    }
                }
            }
            // delete folder and metadata
            if ((metadataFile != null) && metadataFile.exists() && !metadataFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder metadata cannot be deleted.");
            }
            // delete folder and all remaining folder contents
            // unless folder is root folder which should be
            // preserved as PSML "mount point"
            if (!path.equals(Folder.PATH_SEPARATOR) && !folderFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder cannot be deleted.");
            }
        }
        else
        {
            throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" not found.");
        }

        // remove from cache
        fileCache.remove(path);
View Full Code Here

Examples of org.apache.jetspeed.page.document.FailedToDeleteFolderException

                        handlerFactory.getDocumentHandler(node.getType()).removeDocument((Document)node);
                    }
                    catch (Exception e)
                    {
                        File documentFile = new File(this.documentRootDir, node.getPath());
                        throw new FailedToDeleteFolderException(documentFile.getAbsolutePath()+" document cannot be deleted.");
                    }
                }
                ((NodeSetImpl)folderImpl.getAllNodes()).remove(node);
            }
        }
        catch (FailedToDeleteFolderException fdfe)
        {
            throw fdfe;
        }
        catch (Exception e)
        {
            throw new FailedToDeleteFolderException(e.getMessage());
        }

        // remove underlying folder and unknown files
        File folderFile = new File(this.documentRootDir, path);
        File metadataFile = null;
        if ((folderImpl.getFolderMetaData() != null) && (folderImpl.getFolderMetaData().getPath() != null))
        {
            metadataFile = new File(this.documentRootDir, folderImpl.getFolderMetaData().getPath());
        }
        if (folderFile.exists() && folderFile.isDirectory())
        {
            // attempt to clean folder for delete
            String[] contents = folderFile.list();
            for (int i = 0; (i < contents.length); i++)
            {
                File contentFile = new File(folderFile, contents[i]);
                if ((metadataFile == null) || !contentFile.equals(metadataFile))
                {
                    if (!deleteFile(contentFile))
                    {
                        throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" unrecognized folder contents cannot be deleted.");
                    }
                }
            }
            // delete folder and metadata
            if ((metadataFile != null) && metadataFile.exists() && !metadataFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder metadata cannot be deleted.");
            }
            // delete folder and all remaining folder contents
            // unless folder is root folder which should be
            // preserved as PSML "mount point"
            if (!path.equals(Folder.PATH_SEPARATOR) && !folderFile.delete())
            {
                throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" folder cannot be deleted.");
            }
        }
        else
        {
            throw new FailedToDeleteFolderException(folderFile.getAbsolutePath()+" not found.");
        }

        // remove from cache
        fileCache.remove(path);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.