List of usage examples for org.apache.commons.vfs FileSystemException FileSystemException
public FileSystemException(final Throwable throwable)
From source file:com.thinkberg.moxo.vfs.s3.jets3t.Jets3tFileSystem.java
public Jets3tFileSystem(S3FileName fileName, FileSystemOptions fileSystemOptions) throws FileSystemException { super(fileName, null, fileSystemOptions); String bucketId = fileName.getRootFile(); try {//from w ww.ja v a 2 s . c o m service = Jets3tConnector.getInstance().getService(); bucket = new S3Bucket(bucketId); if (!service.isBucketAccessible(bucketId)) { bucket = service.createBucket(bucketId); } System.err.println("Created new S3 FileSystem: " + bucketId); } catch (S3ServiceException e) { throw new FileSystemException(e); } }
From source file:com.jaspersoft.jasperserver.api.metadata.common.util.RepositoryFileNameParser.java
public FileName parseUri(final VfsComponentContext context, final FileName base, final String filename) throws FileSystemException { final StringBuffer name = new StringBuffer(); // Extract the scheme final String foundScheme = UriParser.extractScheme(filename, name); if (!scheme.equals(foundScheme)) { throw new FileSystemException("invalid scheme: " + foundScheme); }//from w w w . j a va2 s . c om // Decode and normalise the path UriParser.canonicalizePath(name, 0, name.length(), this); UriParser.fixSeparators(name); FileType fileType = UriParser.normalisePath(name); final String path = name.toString(); return new RepositoryFileName(scheme, path, fileType); }
From source file:com.thinkberg.vfs.s3.jets3t.Jets3tFileSystem.java
public Jets3tFileSystem(S3Service service, S3FileName fileName, FileSystemOptions fileSystemOptions) throws FileSystemException { super(fileName, null, fileSystemOptions); this.service = service; try {/*from w w w . ja v a 2 s . c om*/ String bucketId = fileName.getRootFile(); if (!service.isBucketAccessible(bucketId)) { LOG.info(String.format("creating new S3 bucket '%s' for file system root", bucketId)); bucket = service.createBucket(bucketId); } else { LOG.info(String.format("using existing S3 bucket '%s' for file system root", bucketId)); bucket = new S3Bucket(bucketId); } } catch (S3ServiceException e) { throw new FileSystemException(e); } }
From source file:egovframework.rte.fdl.filehandling.EgovFileUtil.java
/** * <p>//from w ww.j a v a 2s . c o m * ? ? ? . * </p> * @param cmd * <code>String</code> * @return * @throws FileSystemException */ public static int rm(final String cmd) throws FileSystemException { int result = -1; try { final FileObject file = manager.resolveFile(basefile, cmd); result = file.delete(Selectors.SELECT_SELF_AND_CHILDREN); log.debug("result is " + result); } catch (FileSystemException e) { log.error(e.toString()); throw new FileSystemException(e); } return result; }
From source file:egovframework.rte.fdl.filehandling.EgovFileUtil.java
/** * <p>/*from w w w . j a v a2s.c o m*/ * ? ?? ? . * </p> * @param source * <code>String</code> * @param target * <code>String</code> * @throws Exception */ public static void cp(String source, String target) throws Exception { try { final FileObject src = manager.resolveFile(basefile, source); FileObject dest = manager.resolveFile(basefile, target); if (dest.exists() && dest.getType() == FileType.FOLDER) { dest = dest.resolveFile(src.getName().getBaseName()); } dest.copyFrom(src, Selectors.SELECT_ALL); } catch (FileSystemException fse) { log.error(fse.toString()); ; throw new FileSystemException(fse); } }
From source file:com.newatlanta.appengine.vfs.provider.GaeFileSystemManager.java
/** * Sets the base file to use when resolving relative URI. Base file must * be a sub-directory of the root path; set equal to the root path if null. * /* w w w.jav a 2s .c o m*/ * @param baseFile The new base FileObject. * @throws FileSystemException if an error occurs. */ @Override public void setBaseFile(FileObject baseFile) throws FileSystemException { if (baseFile == null) { baseFile = rootObject; } else if (!rootObject.getName().isDescendent(baseFile.getName())) { throw new FileSystemException("Base file must be a descendent of root."); } super.setBaseFile(baseFile); }
From source file:com.newatlanta.appengine.vfs.provider.GaeFileObject.java
public void setBlockSize(int size) throws FileSystemException { if (exists()) { throw new FileSystemException( "Could not set the block size of \"" + getName() + "\" because it already exists."); }// w w w. ja va 2s.com // exists() guarantees that metadata != null metadata.setUnindexedProperty(BLOCK_SIZE, Long.valueOf(checkBlockSize(size))); }
From source file:egovframework.rte.fdl.filehandling.EgovFileUtil.java
/** * <p>/* ww w . jav a 2 s . c om*/ * ? ?? ? ??. * </p> * @param source * <code>String</code> * @param target * <code>String</code> * @throws Exception */ public static void mv(String source, String target) throws Exception { try { final FileObject src = manager.resolveFile(basefile, source); FileObject dest = manager.resolveFile(basefile, target); if (dest.exists() && dest.getType() == FileType.FOLDER) { dest = dest.resolveFile(src.getName().getBaseName()); } src.moveTo(dest); } catch (FileSystemException fse) { log.error(fse.toString()); ; throw new FileSystemException(fse); } }
From source file:com.newatlanta.appengine.vfs.provider.GaeFileContent.java
public void removeAttribute(String attrName) throws FileSystemException { throw new FileSystemException("vfs.provider/remove-attribute-not-supported.error"); }
From source file:com.newatlanta.appengine.vfs.provider.GaeFileContent.java
public void setAttribute(String attrName, Object value) throws FileSystemException { throw new FileSystemException("vfs.provider/set-attribute-not-supported.error"); }