Package org.modeshape.webdav.exceptions

Examples of org.modeshape.webdav.exceptions.WebdavException


    @Override
    public ITransaction begin( Principal principal ) throws WebdavException {
        LOG.trace("LocalFileSystemStore.begin()");
        if (!root.exists()) {
            if (!root.mkdirs()) {
                throw new WebdavException("root path: " + root.getAbsolutePath() + " does not exist and could not be created");
            }
        }
        return null;
    }
View Full Code Here


    public void createFolder( ITransaction transaction,
                              String uri ) throws WebdavException {
        LOG.trace("LocalFileSystemStore.createFolder(" + uri + ")");
        File file = new File(root, uri);
        if (!file.mkdir()) {
            throw new WebdavException("cannot create folder: " + uri);
        }
    }
View Full Code Here

                                String uri ) throws WebdavException {
        LOG.trace("LocalFileSystemStore.createResource(" + uri + ")");
        File file = new File(root, uri);
        try {
            if (!file.createNewFile()) {
                throw new WebdavException("cannot create file: " + uri);
            }
        } catch (IOException e) {
            LOG.error(new TextI18n("LocalFileSystemStore.createResource(" + uri + ") failed"));
            throw new WebdavException(e);
        }
    }
View Full Code Here

                    os.close();
                }
            }
        } catch (IOException e) {
            LOG.error(new TextI18n("LocalFileSystemStore.setResourceContent(" + uri + ") failed"));
            throw new WebdavException(e);
        }
        long length = -1;

        try {
            length = file.length();
View Full Code Here

                              String uri ) throws WebdavException {
        File file = new File(root, uri);
        boolean success = file.delete();
        LOG.trace("LocalFileSystemStore.removeObject(" + uri + ")=" + success);
        if (!success) {
            throw new WebdavException("cannot delete object: " + uri);
        }

    }
View Full Code Here

        InputStream in;
        try {
            in = new BufferedInputStream(new FileInputStream(file));
        } catch (IOException e) {
            LOG.error(new TextI18n("LocalFileSystemStore.getResourceContent(" + uri + ") failed"));
            throw new WebdavException(e);
        }
        return in;
    }
View Full Code Here

                FileUtil.delete(propertiesFile);
            } else {
                writeProperties(propertiesFile, updatedProperties);
            }
        } catch (IOException e) {
            throw new WebdavException(e);
        }
        return null;
    }
View Full Code Here

    }

    private File propertiesFileForResource( String resourceUri ) {
        File file = new File(root, resourceUri);
        if (!file.exists()) {
            throw new WebdavException(resourceUri + " does not represent an existing file or directory");
        }
        File propertiesFileParent = file.isFile() ? file.getParentFile() : file;
        if (!propertiesFileParent.canWrite()) {
            throw new WebdavException("Cannot write into the " + propertiesFileParent.getAbsolutePath()
                                      + " folder. Make sure that the FS permissions are correct");
        }
        String propertiesFileName = file.getName() + "_webdav.properties";
        return new File(propertiesFileParent, propertiesFileName);
    }
View Full Code Here

            if (propertiesFile.exists() && propertiesFile.canRead()) {
                return readExistingProperties(propertiesFile);
            }
            return Collections.emptyMap();
        } catch (IOException e) {
            throw new WebdavException(e);
        }
    }
View Full Code Here

    }

    private File getFileRoot() {
        String rootPath = getInitParameter(ROOTPATH_PARAMETER);
        if (rootPath == null) {
            throw new WebdavException("missing parameter: " + ROOTPATH_PARAMETER);
        }
        if (rootPath.equals("*WAR-FILE-ROOT*")) {
            String file = LocalFileSystemStore.class.getProtectionDomain().getCodeSource().getLocation().getFile().replace('\\',
                                                                                                                           '/');
            if (file.charAt(0) == '/' && System.getProperty("os.name").contains("Windows")) {
                file = file.substring(1, file.length());
            }

            int ix = file.indexOf("/WEB-INF/");
            if (ix != -1) {
                rootPath = file.substring(0, ix).replace('/', File.separatorChar);
            } else {
                throw new WebdavException("Could not determine root of war file. Can't extract from path '" + file
                                          + "' for this web container");
            }
        }
        return new File(rootPath);
    }
View Full Code Here

TOP

Related Classes of org.modeshape.webdav.exceptions.WebdavException

Copyright © 2018 www.massapicom. 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.