List of usage examples for org.apache.commons.vfs2 Selectors SELECT_SELF_AND_CHILDREN
FileSelector SELECT_SELF_AND_CHILDREN
To view the source code for org.apache.commons.vfs2 Selectors SELECT_SELF_AND_CHILDREN.
Click Source Link
From source file:org.apache.zeppelin.notebook.repo.OldVFSNotebookRepo.java
@Override public void remove(String noteId, AuthenticationInfo subject) throws IOException { FileObject rootDir = fsManager.resolveFile(getPath("/")); FileObject noteDir = rootDir.resolveFile(noteId, NameScope.CHILD); if (!noteDir.exists()) { // nothing to do return;/*from w w w . j a va 2s.c o m*/ } if (!isDirectory(noteDir)) { // it is not look like zeppelin note savings throw new IOException("Can not remove " + noteDir.getName().toString()); } noteDir.delete(Selectors.SELECT_SELF_AND_CHILDREN); }
From source file:org.apache.zeppelin.notebook.repo.VFSNotebookRepo.java
@Override public void remove(String noteId) throws IOException { FileObject rootDir = fsManager.resolveFile(getPath("/")); FileObject noteDir = rootDir.resolveFile(noteId, NameScope.CHILD); if (!noteDir.exists()) { // nothing to do return;//from www . j av a 2 s. co m } if (!isDirectory(noteDir)) { // it is not look like zeppelin note savings throw new IOException("Can not remove " + noteDir.getName().toString()); } noteDir.delete(Selectors.SELECT_SELF_AND_CHILDREN); }
From source file:org.wso2.carbon.connector.FileRename.java
/** * Rename the files//from ww w .j a v a 2 s. com * * @param fileLocation * @param filename * @param newFileName * @param filebeforepprocess * @return */ private boolean renameFile(String fileLocation, String filename, String newFileName, String filebeforepprocess) throws FileSystemException { boolean resultStatus = false; FileSystemManager manager = VFS.getManager(); if (manager != null) { // Create remote object FileObject remoteFile = manager.resolveFile(fileLocation.toString() + filename.toString(), FTPSiteUtils.createDefaultOptions()); FileObject reNameFile = manager.resolveFile(fileLocation.toString() + newFileName.toString(), FTPSiteUtils.createDefaultOptions()); if (remoteFile.exists()) { if (!filebeforepprocess.equals("")) { FileObject fBeforeProcess = manager.resolveFile(filebeforepprocess + filename); fBeforeProcess.copyFrom(remoteFile, Selectors.SELECT_SELF_AND_CHILDREN); } remoteFile.moveTo(reNameFile); resultStatus = true; if (log.isDebugEnabled()) { log.info("Rename remote file success"); } } } return resultStatus; }
From source file:se.kth.hopsworks.zeppelin.notebook.repo.FSNotebookRepo.java
@Override public void remove(String noteId) throws IOException { FileObject rootDir = fsManager.resolveFile(getPath("/")); FileObject projectDir = rootDir.resolveFile(this.project.getName(), NameScope.CHILD); if (!projectDir.exists() || !isDirectory(projectDir)) { // no project dir return;//from ww w. j ava 2s . com } FileObject noteDir = projectDir.resolveFile(noteId, NameScope.CHILD); if (!noteDir.exists()) { // nothing to do return; } if (!isDirectory(noteDir)) { // it is not look like zeppelin note savings throw new IOException("Can not remove " + noteDir.getName().toString()); } noteDir.delete(Selectors.SELECT_SELF_AND_CHILDREN); }