@PostConstruct public void init() { this.root = fileSystem.getRootDirectories().iterator().next(); }
@PostConstruct public void init() { this.root = fileSystem.getRootDirectories().iterator().next(); }
public String[] listUsers() { //TODO: a temporary hack to retrieve user list. Root dirs are branches and every user has it's own branch final List<String> userList = new ArrayList<String>(); for ( final Path path : bootstrapFS.getRootDirectories() ) { final String value = path.toUri().getUserInfo(); if ( value != null && value.endsWith( "-uf-user" ) ) { userList.add( value.substring( 0, value.indexOf( "-uf-user" ) ) ); } } return userList.toArray( new String[ userList.size() ] ); }
private org.uberfire.backend.vfs.Path getDefaultRoot(final FileSystem fileSystem, final Map<String, org.uberfire.backend.vfs.Path> branches) { org.uberfire.backend.vfs.Path defaultRoot; if (branches.containsKey("master")) { defaultRoot = branches.get("master"); } else { defaultRoot = convert(fileSystem.getRootDirectories().iterator().next()); } return defaultRoot; }
private org.uberfire.backend.vfs.Path getDefaultRoot( final FileSystem fs, final Map<String, org.uberfire.backend.vfs.Path> branches ) { if ( branches.containsKey( "master" ) ) { return branches.get( "master" ); } else { return convert( fs.getRootDirectories().iterator().next() ); } }
public FileSystemMetadata(FileSystem fs) { if (fs.getRootDirectories().iterator().hasNext()) { Path root = fs.getRootDirectories().iterator().next(); final FileSystem realFS = root.getFileSystem(); isAFileSystemID = fs instanceof FileSystemId; if (isAFileSystemID) { id = ((FileSystemId) realFS).id(); } else { id = fs.toString(); } this.scheme = root.toUri().getScheme(); } this.uri = fs.toString(); }
public List<String> getAllBranches() { FileSystem _fileSystem = getFileSystem(); final List<String> branches = new ArrayList<String>(); for (Iterator it = _fileSystem.getRootDirectories().iterator(); it.hasNext(); ) { AbstractPath path = (AbstractPath) it.next(); branches.add(path.getHost()); } return branches; }
public List<String> getAllBranches() { FileSystem _fileSystem = getFileSystem(); final List<String> branches = new ArrayList<String>(); for ( Iterator it = _fileSystem.getRootDirectories().iterator(); it.hasNext(); ) { AbstractPath path = (AbstractPath) it.next(); branches.add( path.getHost() ); } return branches; }
public List<String> getAllBranches() { FileSystem _fileSystem = getFileSystem(); final List<String> branches = new ArrayList<String>(); for (Iterator it = _fileSystem.getRootDirectories().iterator(); it.hasNext(); ) { AbstractPath path = (AbstractPath) it.next(); branches.add(path.getHost()); } return branches; }
private List<String> getBranches(final org.uberfire.java.nio.file.Path rootPath, final Path projectPath) { final FileSystem fs = rootPath.getFileSystem(); final String exampleRootPath = pathUtil.stripRepoNameAndSpace(pathUtil.stripProtocolAndBranch(projectPath.toURI())); return StreamSupport.stream(fs.getRootDirectories().spliterator(), false) .filter(root -> exists(root.resolve(exampleRootPath))) .map(pathUtil::convert) .map(root -> pathUtil.extractBranch(root.toURI())) .flatMap(oBranch -> oBranch.map(Stream::of).orElse(Stream.empty())) .collect(toList()); }
private Path getFirstRootDirectory(FileSystem fs) { checkNotNull("fs", fs); Iterable<Path> rootDirectories = checkNotNull("fs.getRootDirectories()", fs.getRootDirectories()); Iterator<Path> iterator = checkNotNull("fs.getRootDirectories().iterator()", rootDirectories.iterator()); return iterator.next(); }
@PostConstruct public void setup() { log.info( "mailbox service is up" ); try { ioService.startBatch( bootstrapFS.getRootDirectories().iterator().next().getFileSystem() ); processOutgoing(); } finally { ioService.endBatch(); } }
private void cleanupDeletedFS(FileSystem fs) { WatchService ws = watchServicesByFS.remove(fs.getName()); if (ws != null && !ws.isClose()) { ws.close(); } fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath))); }
private void cleanupDeletedFS(FileSystem fs) { WatchService ws = watchServicesByFS.remove(fs.getName()); if (ws != null && !ws.isClose()) { ws.close(); } fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath))); }
@Test public void testInit() throws Exception { when(iterable.iterator()).thenReturn(iterator); when(fileSystem.getRootDirectories()).thenReturn(iterable); when(config.getInitParameter(anyString())).thenReturn("/fake"); when(ioService.newFileSystem(any(URI.class), anyMapOf(String.class, Class.class))).thenReturn(fileSystem); servlet.init(config); verify(mediaServletURI).setURI(eq("fake/")); }
@Test public void testInit() throws Exception { when(iterable.iterator()).thenReturn(iterator); when(fileSystem.getRootDirectories()).thenReturn(iterable); when(config.getInitParameter(anyString())).thenReturn("/fake"); when(ioService.newFileSystem(any(URI.class), anyMapOf(String.class, Class.class))).thenReturn(fileSystem); servlet.init(config); verify(mediaServletURI).setURI(eq("fake/")); }
public void recordOpeningEvent( @Observes final ResourceOpenedEvent event ) { checkNotNull( "event", event ); final org.uberfire.backend.vfs.Path resourcePath = event.getPath(); try { ioService.startBatch( bootstrapFS.getRootDirectories().iterator().next().getFileSystem() ); recordOpeningEvent( resourcePath.toURI(), resourcePath.getFileName().toString(), event.getSessionInfo().getIdentity().getIdentifier() ); } finally { ioService.endBatch(); } }
@Test public void deleteBranchTest() throws Exception { final FileSystem fileSystem = getFileSystem(); final Path branchPath = fileSystem.getRootDirectories().iterator().next(); ioService.delete(branchPath); InOrder inOrder = Mockito.inOrder(ioService, indexEngine, fileSystem); inOrder.verify(indexEngine).delete(any(KCluster.class)); inOrder.verify(ioService).deleteRepositoryFiles(eq(branchPath), any()); }
@Test public void deleteBranchTest() throws Exception { final FileSystem fileSystem = getFileSystem(); final Path branchPath = fileSystem.getRootDirectories().iterator().next(); ioService.delete(branchPath); InOrder inOrder = Mockito.inOrder(ioService, indexEngine, fileSystem); inOrder.verify(indexEngine).delete(any(KCluster.class)); inOrder.verify(ioService).deleteRepositoryFiles(eq(branchPath), any()); }
public void recordUserEditEvent( @Observes final ResourceUpdatedEvent event ) { checkNotNull( "event", event ); try { ioService.startBatch( bootstrapFS.getRootDirectories().iterator().next().getFileSystem() ); recordUserEditEvent( event.getPath().toURI(), event.getPath().getFileName(), event.getSessionInfo().getIdentity().getIdentifier() ); } finally { ioService.endBatch(); } }