List of usage examples for org.apache.commons.vfs.util FileObjectUtils getAbstractFileObject
public static AbstractFileObject getAbstractFileObject(final FileObject fileObject) throws FileSystemException
From source file:org.jclouds.vfs.provider.blobstore.BlobStoreFileObject.java
@Override protected FileObject[] doListChildrenResolved() throws Exception { // if metadata is null, then the path does not exist, as doAttach would have certainly set // this./* w ww . java 2 s. c o m*/ doAttach(); if (metadata == null) throw new FileNotFolderException(getName()); ListContainerOptions options = new ListContainerOptions(); String name = getNameTrimLeadingSlashes(); if (!name.equals("") && !name.equals("/")) { options.inDirectory(name + "/"); logger.info(String.format(">> list: %s[%s]", getContainer(), name)); } else { logger.info(String.format(">> list: %s", getContainer())); } Iterable<? extends StorageMetadata> list = lister.execute(getContainer(), options); Set<BlobStoreFileObject> children = Sets.newHashSet(); loop: for (StorageMetadata md : list) { if (!md.getName().equals("")) { if (name.equals(md.getName()) && md.getType() != StorageType.BLOB) { continue loop; } String childName = Utils.replaceAll(md.getName(), UNDESCRIBED, ""); BlobStoreFileObject fo = (BlobStoreFileObject) FileObjectUtils .getAbstractFileObject(getFileSystem().resolveFile(getFileSystem().getFileSystemManager() .resolveName(getName(), childName, NameScope.CHILD))); children.add(fo); } } logger.info(String.format("<< list: %s", children)); return children.toArray(new BlobStoreFileObject[] {}); }