/** * Returns an attribute of the package containing the resource. */ public String getPackageAttribute(final Attributes.Name attrName) throws FileSystemException { return (String) packageFolder.getContent().getAttribute(attrName.toString()); }
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; }
private Command createCommand(FileObject file) throws FileSystemException, CommandException { assert file != null; // HACK: Must dereference to avoid problems with the DelegateFileObject impl file = fileSystemAccess.dereference(file); log.trace("Creating command for file: {} ({})", file, file.getClass()); Command command = null; if (file.exists()) { FileContent content = file.getContent(); command = (Command)content.getAttribute("COMMAND"); if (command == null) { if (file.getType().hasChildren()) { command = createGroupCommand(file); content.setAttribute("COMMAND", command); } // TODO: Try to construct AliasCommand? } } if (command == null) { throw new CommandException("Unable to create command for file: " + file.getName()); } return command; }