@Override public boolean accept(final Path path) { if (!Files.isRegularFile(path)) { return false; } if (next != null) { return next.accept(path); } return true; }
@Override public boolean accept(final Path path) { if (!Files.isRegularFile(path)) { return false; } if (next != null) { return next.accept(path); } return true; }
@Override public boolean isRegularFile(final String uri) { return Files.isRegularFile(ioService.get(URI.create(uri))); }
@Override public boolean isRegularFile(final Path path) { return Files.isRegularFile(Paths.convert(path)); }
@Override public boolean accept(final org.uberfire.java.nio.file.Path path) { boolean accept = super.accept(path); if (accept) { return false; } if (!Files.isRegularFile(path)) { return false; } final String uri = path.toUri().toString(); if (uri.substring(uri.length() - extension.length()).equals(extension)) { return true; } return false; } }
@Override public boolean accept(final org.uberfire.java.nio.file.Path path) { boolean accept = super.accept(path); if (accept) { return false; } if (!Files.isRegularFile(path)) { return false; } final String uri = path.toUri().toString(); if (uri.substring(uri.length() - extension.length()).equals(extension)) { return true; } return false; } }
@Override public boolean accept(final org.uberfire.java.nio.file.Path path) { //Check with super class first boolean accept = super.accept(path); if (accept) { return false; } //Only match files if (!Files.isRegularFile(path)) { return false; } //Assume the Path does not match by default accept = false; final String uri = path.toUri().toString(); for (String extension : extensions) { if (uri.substring(uri.length() - extension.length()).equals(extension)) { accept = true; break; } } return accept; } }
@Override public boolean accept(final org.uberfire.java.nio.file.Path path) { //Check with super class first boolean accept = super.accept(path); if (accept) { return false; } //Only match files if (!Files.isRegularFile(path)) { return false; } //Assume the Path does not match by default accept = false; final String uri = path.toUri().toString(); for (String extension : extensions) { if (uri.substring(uri.length() - extension.length()).equals(extension)) { accept = true; break; } } return accept; } }
public static String probeContentType(final Path path) throws UnsupportedOperationException, IOException, SecurityException { checkNotNull("path", path); if (notExists(path)) { throw new NoSuchFileException(path.toString()); } if (!isRegularFile(path)) { throw new NoSuchFileException(path.toString()); } throw new UnsupportedOperationException("feature not available"); }
public static String probeContentType(final Path path) throws UnsupportedOperationException, IOException, SecurityException { checkNotNull("path", path); if (notExists(path)) { throw new NoSuchFileException(path.toString()); } if (!isRegularFile(path)) { throw new NoSuchFileException(path.toString()); } throw new UnsupportedOperationException("feature not available"); }
public static String probeContentType(final Path path) throws UnsupportedOperationException, IOException, SecurityException { checkNotNull("path", path); if (notExists(path)) { throw new NoSuchFileException(path.toString()); } if (!isRegularFile(path)) { throw new NoSuchFileException(path.toString()); } throw new UnsupportedOperationException("feature not available"); }
@Test public void isRegularFileNull() { assertThatThrownBy(() -> Files.isRegularFile(null)) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Parameter named 'path' should be not null!"); }
private Collection<DriverDefInfo> resolveDrivers(final Path path) { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); final List<DriverDefInfo> result = new ArrayList<>(); try { final DirectoryStream<org.uberfire.java.nio.file.Path> stream = ioService.newDirectoryStream(nioPath, entry -> Files.isRegularFile(entry) && !entry.getFileName().toString().startsWith(".") && entry.getFileName().toString().endsWith(DRIVER_FILE_TYPE)); stream.forEach(file -> { result.add(createDriverInfo(file)); }); stream.close(); return result; } catch (Exception e) { logger.error("It was not possible read drivers info from: " + path, e); throw ExceptionUtilities.handleException(e); } }
private Collection<DataSourceDefInfo> resolveDataSources(final Path path) { final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path); final List<DataSourceDefInfo> result = new ArrayList<>(); try { final DirectoryStream<org.uberfire.java.nio.file.Path> stream = ioService.newDirectoryStream(nioPath, entry -> Files.isRegularFile(entry) && !entry.getFileName().toString().startsWith(".") && entry.getFileName().toString().endsWith(DS_FILE_TYPE)); stream.forEach(file -> { result.add(createDataSourceDefInfo(file)); }); stream.close(); return result; } catch (Exception e) { logger.error("It was not possible read data sources info from: " + path, e); throw ExceptionUtilities.handleException(e); } }
@Override public String getTemplateContent(String url) { String pluginTemplateContent = getRuntimePluginTemplateContent(url); if (isAJarPluginTemplate(pluginTemplateContent)) { return pluginTemplateContent; } String realPath = PluginUtils.getRealPath("plugins"); if (realPath == null) { LOGGER.info("Not fetching template content for " + url + " because getRealPath() is" + " returning null. (This app is probably deployed in an unexploded .war)"); return ""; } final Path template; if (url.startsWith("/")) { template = Paths.get(URI.create("file://" + realPath + url)); } else { template = Paths.get(URI.create("file://" + realPath + "/" + url)); } if (Files.isRegularFile(template)) { return new String(Files.readAllBytes(template)); } return ""; }
@Test public void isRegularFile() { final Path path = Files.createTempFile("foo", "bar"); assertThat(Files.isRegularFile(path)).isTrue(); assertThat(Files.isRegularFile(newTempDir())).isFalse(); assertThat(Files.isRegularFile(Paths.get("/some/file"))).isFalse(); }
public FolderItem toFolderItem(final org.uberfire.java.nio.file.Path path) { if (Files.isRegularFile(path)) { final org.uberfire.backend.vfs.Path p = Paths.convert(path); return new FolderItem(p, p.getFileName(), FolderItemType.FILE, false, Paths.readLockedBy(p), Collections.<String>emptyList(), getRestrictedOperations(p)); } else if (Files.isDirectory(path)) { final org.uberfire.backend.vfs.Path p = Paths.convert(path); return new FolderItem(p, p.getFileName(), FolderItemType.FOLDER); } return null; }
private IncrementalBuildResults addResource(final Path resource, final InputStream inputStream) { checkNotNull("resource", resource); //Only files can be processed if (!Files.isRegularFile(resource)) { return new IncrementalBuildResults(projectGAV); } checkAFullBuildHasBeenPerformed(); //Resource Type might require "external" validation (i.e. it's not covered by Kie) final IncrementalBuildResults results = new IncrementalBuildResults(projectGAV); final BuildValidationHelper validator = getBuildValidationHelper(resource); if (validator != null) { final List<ValidationMessage> addedValidationMessages = validator.validate(Paths.convert(resource)); results.addAllAddedMessages(convertValidationMessages(addedValidationMessages)); results.addAllRemovedMessages(convertValidationMessages(nonKieResourceValidationHelperMessages.remove(resource))); nonKieResourceValidationHelpers.put(resource, validator); nonKieResourceValidationHelperMessages.put(resource, addedValidationMessages); } synchronized (kieFileSystem) { addNewResource(resource, inputStream); buildIncrementally(results, destinationPath(resource)); } return results; }
for (final org.uberfire.java.nio.file.Path p : directoryStream) { if (filter.accept(p) && fileExtensionFilter.accept(p)) { if (Files.isRegularFile(p)) { items.add(Paths.convert(p)); } else if (Files.isDirectory(p)) {
if (Files.isRegularFile(path)) { path = path.getParent();