@Override public Path getPath(String first, String... paths) { return this.fileSystem.getPath(first, paths); }
public Path buildPath(final String serviceType, final String relativePath) { FileSystem _fileSystem = getFileSystem(); if (relativePath != null && !"".equals(relativePath)) { return _fileSystem.getPath("social", serviceType, relativePath); } else { return _fileSystem.getPath("social", serviceType); } }
public Path buildPath( final String serviceType, final String relativePath ) { FileSystem _fileSystem = getFileSystem(); if ( relativePath != null && !"".equals( relativePath ) ) { return _fileSystem.getPath( "social", serviceType, relativePath ); } else { return _fileSystem.getPath( "social", serviceType ); } }
private Path resolvePerspectivePath( String perspectiveFile ) { Path perspectivePath = fileSystem.getPath( PERSPECTIVE_EDITOR ); return perspectivePath.resolve( perspectiveFile ); }
@Override public boolean exists(final String path) { Path fsPath = fileSystem.getPath(path); try { return ioService.exists(fsPath); } catch (final Exception e) { throw new RuntimeException(e); } }
@Override public Path getPath(final URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException { checkNotNull("uri", uri); checkCondition("uri scheme not supported", uri.getScheme().equals(getScheme()) || uri.getScheme().equals("default")); return getDefaultFileSystem().getPath(uri.getPath()); }
@Override public Path getPath(final URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException { checkNotNull("uri", uri); checkCondition("uri scheme not supported", uri.getScheme().equals(getScheme()) || uri.getScheme().equals("default")); return getDefaultFileSystem().getPath(uri.getPath()); }
@Override public Path getPath(final URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException { checkNotNull("uri", uri); checkCondition("uri scheme not supported", uri.getScheme().equals(getScheme()) || uri.getScheme().equals("default")); try { return getDefaultFileSystem().getPath(URIUtil.decode(uri.getPath())); } catch (final URIException e) { return null; } }
@Override public boolean endsWith(final String other) throws InvalidPathException { checkNotNull("other", other); return endsWith(getFileSystem().getPath(other)); }
@Override public boolean startsWith(final String other) throws InvalidPathException { checkNotNull("other", other); return startsWith(getFileSystem().getPath(other)); }
@Override public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException { final FileSystem fs = service.newFileSystem(uri, env); if (!authManager.authorize(toResource(fs), getUser())) { service.delete(fs.getPath(null)); throw new SecurityException(); } return fs; }
private void removeSpaceDirectory(final Space space) { final URI configPathURI = URI.create(SpacesAPI.resolveConfigFileSystemPath(SpacesAPI.Scheme.DEFAULT, space.getName())); final Path configPath = ioService.get(configPathURI); final JGitPathImpl configGitPath = (JGitPathImpl) configPath; final File spacePath = configGitPath.getFileSystem().getGit().getRepository().getDirectory().getParentFile().getParentFile(); ioService.delete(configPath.getFileSystem().getPath("")); spacePath.delete(); }
@Override public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException { final FileSystem fs = service.newFileSystem(uri, env); if (!authManager.authorize(toResource(fs), getUser())) { service.delete(fs.getPath(null)); throw new SecurityException(); } return fs; }
@Test public void simpleRootTests() throws URISyntaxException { final SimpleFileSystemProvider fs = new SimpleFileSystemProvider(); final FileSystem fileSystem = new SimpleUnixFileSystem(fsProvider, "/"); assertThat(fileSystem.getPath("/")).isEqualTo(fileSystem.getPath("/path").getParent()); final URL parentUrl = this.getClass().getResource("/"); final Path parentNioPath = fs.getPath(parentUrl.toURI()); final URL childUrl = this.getClass().getResource("/Folder"); final Path childNioPath = fs.getPath(childUrl.toURI()); final Path childParentNioPath = childNioPath.getParent(); assertThat(parentNioPath).isEqualTo(childParentNioPath); }
@Test public void testValidateWhenTheresNoProject() throws Exception { final URI originRepo = URI.create("git://repo"); final FileSystem origin = fileSystemTestingUtils.getIoService().newFileSystem(originRepo, Collections.singletonMap("init", Boolean.TRUE)); Path path = Paths.convert(origin.getPath("/META-INF/beans.xml")); URL urlToValidate = this.getClass().getResource("/META-INF/beans.xml"); List<ValidationMessage> errors = validator.validate(path, Resources.toString(urlToValidate, Charsets.UTF_8)); assertTrue(errors.isEmpty()); }
@After public void clean() { fileSystemTestingUtils.cleanup(); try { ioService.delete(fileSystem.getPath(storage.getStoragePath())); } catch (Exception ex) { } } }
@After public void clean() { fileSystemTestingUtils.cleanup(); try { ioService.delete(fileSystem.getPath(storage.getStoragePath())); } catch (Exception ex) { } } }