Example usage for org.apache.commons.vfs2 FileName getParent

List of usage examples for org.apache.commons.vfs2 FileName getParent

Introduction

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

Prototype

FileName getParent();

Source Link

Document

Returns the file name of the parent of this file.

Usage

From source file:org.pentaho.reporting.libraries.pensol.JCRSolutionDirectFileModel.java

private FastStack<String> stackName(FileName fullName) {
    final FastStack<String> stack = new FastStack<String>();
    while (fullName != null) {
        final String name = fullName.getBaseName().trim();
        if (!name.equals("")) {
            stack.push(name);//  www  .j av  a 2s .  c  o  m
        }
        fullName = fullName.getParent();
    }
    return stack;
}

From source file:org.pentaho.reporting.libraries.pensol.JCRSolutionDirectFileModel.java

@Override
public void setData(final FileName fullName, final byte[] data) throws FileSystemException {
    /*//from w  w  w  .  ja v a  2s . c om
    /api/repo/files/import
    public Response doPostImport(
      @FormDataParam("importDir") String uploadDir,
      @FormDataParam("fileUpload") InputStream fileIS,
      @FormDataParam("overwriteFile") String overwriteFile,
      @FormDataParam("overwriteAclPermissions") String overwriteAclPermissions,
      @FormDataParam("applyAclPermissions") String applyAclPermission,
      @FormDataParam("retainOwnership") String retainOwnership,
      @FormDataParam("charSet") String charSet,
      @FormDataParam("logLevel") String logLevel,
      @FormDataParam("fileUpload") FormDataContentDisposition fileInfo,
      @FormDataParam("fileNameOverried) String fileNameOveride )
    */
    logger.debug("setData: " + fullName);

    final String name = fullName.getBaseName();
    final String parent = fullName.getParent().getPath();
    final ByteArrayInputStream stream = new ByteArrayInputStream(data);
    final FormDataContentDisposition fd = FormDataContentDisposition.name(name).fileName(name).build();
    Response response = this.importRes.doPostImport(parent, stream, "true", null, "true", "true", null, "WARN",
            fd, null);
    throwExceptionOnBadResponse(response);
}

From source file:org.pentaho.reporting.libraries.pensol.JCRSolutionFileModel.java

protected String[] computeFileNames(FileName file) {
    final FastStack<String> stack = new FastStack<String>();
    while (file != null) {
        String name;//from   w  w  w .  j  ava 2s.c  om
        try {
            name = URLDecoder.decode(file.getBaseName().trim().replaceAll("\\+", "%2B"), "UTF-8");
        } catch (UnsupportedEncodingException e) {
            name = file.getBaseName().trim();
        }
        if (!"".equals(name)) {
            stack.push(name);
        }
        file = file.getParent();
    }

    final int size = stack.size();
    final String[] result = new String[size];
    for (int i = 0; i < result.length; i++) {
        result[i] = stack.pop();
    }
    return result;
}

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

protected String[] computeFileNames(FileName file) {
    final FastStack stack = new FastStack();
    while (file != null) {
        final String name = file.getBaseName();
        stack.push(name);//from  w  w  w  .j a v  a 2  s . c  o m
        file = file.getParent();
    }

    final int size = stack.size();
    final String[] result = new String[size];
    for (int i = 0; i < result.length; i++) {
        result[i] = (String) stack.pop();
    }
    return result;
}