Example usage for org.apache.commons.vfs2 FileSystemException FileSystemException

List of usage examples for org.apache.commons.vfs2 FileSystemException FileSystemException

Introduction

In this page you can find the example usage for org.apache.commons.vfs2 FileSystemException FileSystemException.

Prototype

public FileSystemException(final Throwable throwable) 

Source Link

Document

Constructs wrapper exception.

Usage

From source file:org.pentaho.reporting.libraries.pensol.vfs.XmlSolutionFileModel.java

public void setData(final FileName file, final byte[] data) throws FileSystemException {
    final String[] fileName = computeFileNames(file);
    final FileInfo fileInfo = lookupNode(fileName);
    if (fileInfo == null) {
        throw new FileSystemException("File is not valid.");
    }/*from  w  ww.  j  a  v  a 2s . c o  m*/

    setDataInternally(fileInfo, data);
}

From source file:org.pentaho.reporting.libraries.pensol.vfs.XmlSolutionFileModel.java

public void createFolder(final FileName file) throws FileSystemException {
    throw new FileSystemException("CreateFolder is not implemented");
}

From source file:org.pentaho.repositoryvfs.vfs.RepositoryVfsFileObject.java

@Override
public void createFolder() throws FileSystemException {
    try {//from  www .  j ava  2 s  .c  o m
        provider.getRepo().createRepositoryDirectory(provider.getRepo().loadRepositoryDirectoryTree(), path);
        type = FileType.FOLDER;
    } catch (KettleException ex) {
        throw new FileSystemException(ex);
    }
}

From source file:org.pentaho.repositoryvfs.vfs.RepositoryVfsFileObject.java

@Override
public FileObject[] getChildren() throws FileSystemException {
    try {//from w w  w . ja  va  2 s.  c om
        RepositoryDirectoryInterface dir = provider.getRepo().findDirectory(path);
        if (dir == null) {
            return null;
        }
        List<RepositoryObjectInterface> ch = new ArrayList<>();
        ch.addAll(dir.getChildren());
        ch.addAll(dir.getRepositoryObjects());

        FileObject[] result = new RepositoryVfsFileObject[ch.size()];
        for (int i = 0; i < ch.size(); i++) {
            result[i] = new RepositoryVfsFileObject(provider, path + '/' + ch.get(i).getName());
        }
        return result;
    } catch (Exception ex) {
        throw new FileSystemException(ex);
    }
}

From source file:org.pentaho.repositoryvfs.vfs.RepositoryVfsFileObject.java

@Override
public URL getURL() throws FileSystemException {
    try {/*  ww  w .  j  a  v a  2s.  c om*/
        return new URL(getPublicURIString());
    } catch (Exception ex) {
        throw new FileSystemException(ex);
    }
}

From source file:org.pentaho.repositoryvfs.vfs.RepositoryVfsProvider.java

@Override
public FileObject findFile(FileObject baseFile, String uri, FileSystemOptions fileSystemOptions)
        throws FileSystemException {

    if (!uri.startsWith("repo://")) {
        throw new FileSystemException("WRONG_URL");
    }//from w ww. j  av a2 s .c o  m
    String path = '/' + uri.substring(7);
    return new RepositoryVfsFileObject(this, path);
}

From source file:org.pentaho.vfs.util.VfsHelper.java

public FileObject saveFile(String uri, InputStream is) throws IOException {
    if (fsManager != null) {
        FileObject savedFile = fsManager.resolveFile(uri);
        if (!savedFile.exists()) {
            throw new FileSystemException(Messages.getString("VfsHelper.fileDoesNotExist")); //$NON-NLS-1$
        }//from w  w w .  j  a  v  a 2s  . co m
        IOUtils.copy(is, savedFile.getContent().getOutputStream());
        return savedFile;
    }
    throw new FileSystemException(Messages.getString("VfsHelper.operationFailed")); //$NON-NLS-1$
}

From source file:org.pentaho.vfs.util.VfsHelper.java

public FileObject saveFileAs(String uri, InputStream is) throws FileSystemException, IOException {
    if (fsManager != null) {
        FileObject savedFile = fsManager.resolveFile(uri);
        if (!savedFile.exists()) {
            savedFile.createFile();/*from  ww  w .j ava 2  s .co  m*/
        }
        IOUtils.copy(is, savedFile.getContent().getOutputStream());
        return savedFile;
    }
    throw new FileSystemException(Messages.getString("VfsHelper.operationFailed")); //$NON-NLS-1$
}

From source file:org.pentaho.vfs.util.VfsHelper.java

public FileObject getFileObject(String uri) throws FileSystemException {
    if (fsManager != null) {
        FileObject file = fsManager.resolveFile(uri);
        if (!file.exists()) {
            throw new FileSystemException(Messages.getString("VfsHelper.fileDoesNotExist")); //$NON-NLS-1$
        }//from www .  j ava 2  s .  c  om
        return file;
    }
    throw new FileSystemException(Messages.getString("VfsHelper.operationFailed")); //$NON-NLS-1$
}

From source file:org.pentaho.vfs.util.VfsHelper.java

public byte[] getFileContentAsByteArray(FileObject fileObject) throws IOException {
    if (fileObject != null && fileObject.exists()) {
        IOUtils.toByteArray(fileObject.getContent().getInputStream());
    }/*from  ww w . j ava 2s. c o  m*/
    throw new FileSystemException(Messages.getString("VfsHelper.operationFailed")); //$NON-NLS-1$
}