/** * Attaches a child to this file. The parent IsoFileSystem calls this method when building the file index. */ void attachChild(final FileName childName) { this.children.add(childName.getBaseName()); }
/** * Attaches a child */ protected void attachChild(FileName childName) { children.add(childName.getBaseName()); }
/** * Attaches a child */ public void attachChild(FileName childName) { children.add(childName.getBaseName()); }
/** * Attaches a child to this file. The parent IsoFileSystem calls this method when building the file index. */ void attachChild(final FileName childName) { this.children.add(childName.getBaseName()); }
protected CompressedFileFileObject(FileName name, FileObject container, CompressedFileFileSystem fs) { super(name, fs); this.container = container; // todo, add getBaseName(String) to FileName String basename = container.getName().getBaseName(); int pos = basename.lastIndexOf('.'); basename = basename.substring(0, pos); children = new String[] { basename }; }
String[] listChildren(final FileName name) throws FileSystemException { assert name != null; MetaData data = registry.lookupData(name); Collection<MetaData> children = data.getChildren(); List<String> names = new ArrayList<String>(children.size()); for (MetaData child : children) { names.add(child.getName().getBaseName()); } return names.toArray(new String[names.size()]); }
String[] listChildren(final FileName name) throws FileSystemException { assert name != null; MetaData data = registry.lookupData(name); Collection<MetaData> children = data.getChildren(); List<String> names = new ArrayList<String>(children.size()); for (MetaData child : children) { names.add(child.getName().getBaseName()); } return names.toArray(new String[names.size()]); }
public int compare(FileObject a, FileObject b) { AlphanumComparator alphanumComparator = new AlphanumComparator(); try { return alphanumComparator.compare(a.getName().getBaseName(), b.getName().getBaseName()); } catch (Exception e) { System.out.println("ERROR IN COMPARISON"); return 0; } } }
/** * Adds a child to this file. */ public void attachChild(final FileName baseName, final FileType type) throws Exception { final FileType oldType = doGetType(); if (children.add(baseName.getBaseName())) { childrenChanged(baseName, type); } maybeTypeChanged(oldType); }
private String detectLanguage(final FileObject file) throws Exception { assert file != null; return BSFManager.getLangFromFilename(file.getName().getBaseName()); }
public boolean accept(final FileSelectInfo selection) { assert selection != null; if (log.isTraceEnabled()) { log.trace("Filtering selection: {}", selection.getFile().getName()); } return selection.getFile().getName().getBaseName().startsWith(search); } };
public boolean accept(final FileSelectInfo selection) { assert selection != null; if (log.isTraceEnabled()) { log.trace("Filtering selection: {}", selection.getFile().getName()); } return selection.getFile().getName().getBaseName().startsWith(search); } };
/** * @see org.apache.commons.vfs.FileSelector#includeFile(org.apache.commons.vfs.FileSelectInfo) */ public boolean includeFile( FileSelectInfo fileInfo ) { String fileName = fileInfo.getFile().getName().getBaseName(); return matcher.matches( fileName, pattern ); }
public boolean includeFile(final FileSelectInfo selection) throws Exception { assert selection != null; return matcher.matches(selection.getFile().getName().getBaseName(), pattern); }
protected void keep(FileObject remoteDir, Set<String> names) throws TinkException, IOException { for (FileObject child : remoteDir.getChildren()) { if (!names.contains(child.getName().getBaseName())) { child.delete(new AllFileSelector()); } } }
public boolean includeFile(final FileSelectInfo selection) throws Exception { assert selection != null; return matcher.matches(selection.getFile().getName().getBaseName(), pattern); }
private AliasCommand createAliasCommand(final FileObject file) throws FileSystemException { assert file != null; String name = file.getName().getBaseName(); log.trace("Creating command for alias: {}", name); AliasCommand command = container.getBean(AliasCommand.class); String alias = (String) file.getContent().getAttribute("ALIAS"); if (alias == null) { throw new IllegalStateException("Alias meta-file does not contain 'ALIAS' attribute: " + file); } command.setName(name); command.setAlias(alias); return command; }
public FileContentInfo create(FileContent fileContent) { String contentType = null; String name = fileContent.getFile().getName().getBaseName(); if (name != null) { FileNameMap fileNameMap = URLConnection.getFileNameMap(); contentType = fileNameMap.getContentTypeFor(name); } return new DefaultFileContentInfo(contentType, null); } }
/** * Creates a local copy of the file, and all its descendents. */ public File replicateFile(final FileObject srcFile, final FileSelector selector) throws FileSystemException { final String basename = srcFile.getName().getBaseName(); final File file = allocateFile(basename); // Copy from the source file final FileObject destFile = getContext().toFileObject(file); destFile.copyFrom(srcFile, selector); return file; } }
public Object execute(final CommandContext context) throws Exception { assert context != null; IO io = context.getIo(); FileObject source = resolveFile(context, sourcePath); FileObject target = resolveFile(context, targetPath); ensureFileExists(source); // TODO: Validate more if (target.exists() && target.getType().hasChildren()) { target = target.resolveFile(source.getName().getBaseName()); } log.info("Copying {} -> {}", source, target); target.copyFrom(source, Selectors.SELECT_ALL); FileObjects.closeAll(source, target); return Result.SUCCESS; } }