@Test public void addAsset() { StorageAsset newAsset = fsStorage.addAsset("dir2/test", false); Assert.assertNotNull(newAsset); Assert.assertFalse(newAsset.isContainer()); Assert.assertFalse(newAsset.exists()); StorageAsset newDirAsset = fsStorage.addAsset("/dir2/testdir2", true); Assert.assertNotNull(newDirAsset); Assert.assertTrue(newDirAsset.isContainer()); Assert.assertFalse(newDirAsset.exists()); }
@Override public StorageAsset addAsset( String path, boolean container ) { try { return new FilesystemAsset(this, path, getAssetPath(path), basePath, container); } catch (IOException e) { throw new IllegalArgumentException("Path navigates outside of base directory "+path); } }
FilesystemStorage implements RepositoryStorage { @Override public StorageAsset addAsset( String path, boolean container ) { try { return new FilesystemAsset(this, path, getAssetPath(path), basePath, container); } catch (IOException e) { throw new IllegalArgumentException("Path navigates outside of base directory "+path); } } }
FilesystemStorage implements RepositoryStorage { @Override public StorageAsset addAsset( String path, boolean container ) { try { return new FilesystemAsset(this, path, getAssetPath(path), basePath, container); } catch (IOException e) { throw new IllegalArgumentException("Path navigates outside of base directory "+path); } } FilesystemStorage(Path basePath, FileLockManager fileLockManager); }
FilesystemStorage implements RepositoryStorage { @Override public StorageAsset addAsset( String path, boolean container ) { try { return new FilesystemAsset(this, path, getAssetPath(path), basePath, container); } catch (IOException e) { throw new IllegalArgumentException("Path navigates outside of base directory "+path); } } FilesystemStorage(Path basePath, FileLockManager fileLockManager); @Override void consumeData( StorageAsset asset, Consumer<InputStream> consumerFunction, boolean readLock ); @Override void consumeDataFromChannel( StorageAsset asset, Consumer<ReadableByteChannel> consumerFunction, boolean readLock ); @Override void writeData( StorageAsset asset, Consumer<OutputStream> consumerFunction, boolean writeLock ); @Override void writeDataToChannel( StorageAsset asset, Consumer<WritableByteChannel> consumerFunction, boolean writeLock ); @Override URI getLocation(); @Override void updateLocation(URI newLocation); @Override StorageAsset getAsset( String path ); @Override StorageAsset getRoot( ); @Override StorageAsset addAsset( String path, boolean container ); @Override void removeAsset( StorageAsset asset ); @Override StorageAsset moveAsset( StorageAsset origin, String destination, CopyOption... copyOptions ); @Override void moveAsset( StorageAsset origin, StorageAsset destination, CopyOption... copyOptions ); @Override StorageAsset copyAsset( StorageAsset origin, String destination, CopyOption... copyOptions ); @Override void copyAsset( StorageAsset origin, StorageAsset destination, CopyOption... copyOptions ); FileLockManager getFileLockManager(); }
FilesystemStorage implements RepositoryStorage { @Override public StorageAsset addAsset( String path, boolean container ) { try { return new FilesystemAsset(this, path, getAssetPath(path), basePath, container); } catch (IOException e) { throw new IllegalArgumentException("Path navigates outside of base directory "+path); } } FilesystemStorage(Path basePath, FileLockManager fileLockManager); @Override void consumeData( StorageAsset asset, Consumer<InputStream> consumerFunction, boolean readLock ); @Override void consumeDataFromChannel( StorageAsset asset, Consumer<ReadableByteChannel> consumerFunction, boolean readLock ); @Override void writeData( StorageAsset asset, Consumer<OutputStream> consumerFunction, boolean writeLock ); @Override void writeDataToChannel( StorageAsset asset, Consumer<WritableByteChannel> consumerFunction, boolean writeLock ); @Override URI getLocation(); @Override void updateLocation(URI newLocation); @Override StorageAsset getAsset( String path ); @Override StorageAsset getRoot( ); @Override StorageAsset addAsset( String path, boolean container ); @Override void removeAsset( StorageAsset asset ); @Override StorageAsset moveAsset( StorageAsset origin, String destination, CopyOption... copyOptions ); @Override void moveAsset( StorageAsset origin, StorageAsset destination, CopyOption... copyOptions ); @Override StorageAsset copyAsset( StorageAsset origin, String destination, CopyOption... copyOptions ); @Override void copyAsset( StorageAsset origin, StorageAsset destination, CopyOption... copyOptions ); FileLockManager getFileLockManager();  }