/******************************************************************************************************************* * * Swaps the repositories. * * @throws IOException in case of error * @throws PropertyVetoException in case of error * ******************************************************************************************************************/ private void swapRepositories() throws IOException, PropertyVetoException { exposedRepository = repositories[repositorySelector]; repositorySelector = (repositorySelector + 1) % 2; alternateRepository = repositories[repositorySelector]; fileSystemDelegate.setRootDirectory(exposedRepository.getWorkArea().toFile()); swapCounter++; log.info("New exposed repository: {}", exposedRepository.getWorkArea()); log.info("New alternate repository: {}", alternateRepository.getWorkArea()); }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public synchronized FileSystem getFileSystem() throws IOException { if (fileSystem == null) { try { fileSystem = new LocalFileSystem(); fileSystem.setRootDirectory(new File(rootPath)); final FileObject rootFolder = fileSystem.getRoot(); if (rootFolder == null) { throw new FileNotFoundException(rootPath); } } catch (PropertyVetoException e) { throw new FileNotFoundException(e.toString()); } } return fileSystem; } }
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public synchronized ResourceFileSystem getFileSystem() throws IOException { if (fileSystem == null) { try { fileSystemDelegate = new LocalFileSystem(); fileSystemDelegate.setRootDirectory(new File(rootPath)); final FileObject rootFolder = fileSystemDelegate.getRoot(); if (rootFolder == null) { throw new FileNotFoundException(rootPath); } fileSystem = new ResourceFileSystemNetBeansPlatform(fileSystemDelegate); } catch (PropertyVetoException e) { throw new FileNotFoundException(e.toString()); } } return fileSystem; } }
private static FileObject getFileObjectFromFile(File file) { File parent = file.getParentFile(); LocalFileSystem lfs = new LocalFileSystem(); try { lfs.setRootDirectory(parent); } catch(java.beans.PropertyVetoException pve) { // ?? ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, pve); return null; } catch(java.io.IOException ioe) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioe); return null; } return lfs.findResource(file.getName()); }