Class ShrinkWrapFileSystemProvider
- java.lang.Object
-
- java.nio.file.spi.FileSystemProvider
-
- org.jboss.shrinkwrap.impl.nio.file.ShrinkWrapFileSystemProvider
-
public class ShrinkWrapFileSystemProvider extends java.nio.file.spi.FileSystemProvider
FileSystemProvider
implementation for ShrinkWrapArchive
s.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ConcurrentMap<java.lang.String,ShrinkWrapFileSystem>
createdFileSystems
Open file systems, keyed by theArchive.getId()
private java.util.concurrent.locks.ReentrantLock
createNewFsLock
Lock for creation of a new filesystem and other tasks which should block until this op has completedprivate static java.lang.String
ENV_KEY_ARCHIVE
Environment key for creating a newFileSystem
denoting the archiveprivate static java.util.logging.Logger
log
Loggerprivate static java.lang.String
SCHEME
Scheme
-
Constructor Summary
Constructors Constructor Description ShrinkWrapFileSystemProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkAccess(java.nio.file.Path path, java.nio.file.AccessMode... modes)
private void
copy(java.io.InputStream in, java.nio.channels.SeekableByteChannel out)
Writes the contents of theInputStream
to theSeekableByteChannel
void
copy(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options)
void
createDirectory(java.nio.file.Path dir, java.nio.file.attribute.FileAttribute<?>... attrs)
void
delete(java.nio.file.Path path)
private Archive<?>
getArchive(java.nio.file.Path path)
Obtains the underlying archive associated with the specified Path<V extends java.nio.file.attribute.FileAttributeView>
VgetFileAttributeView(java.nio.file.Path path, java.lang.Class<V> type, java.nio.file.LinkOption... options)
java.nio.file.FileStore
getFileStore(java.nio.file.Path path)
java.nio.file.FileSystem
getFileSystem(java.net.URI uri)
java.nio.file.Path
getPath(java.net.URI uri)
java.lang.String
getScheme()
boolean
isHidden(java.nio.file.Path path)
boolean
isSameFile(java.nio.file.Path path1, java.nio.file.Path path2)
void
move(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options)
java.nio.channels.SeekableByteChannel
newByteChannel(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs)
java.nio.file.DirectoryStream<java.nio.file.Path>
newDirectoryStream(java.nio.file.Path dir, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter)
java.nio.channels.FileChannel
newFileChannel(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs)
java.nio.file.FileSystem
newFileSystem(java.net.URI uri, java.util.Map<java.lang.String,?> env)
<A extends java.nio.file.attribute.BasicFileAttributes>
AreadAttributes(java.nio.file.Path path, java.lang.Class<A> type, java.nio.file.LinkOption... options)
java.util.Map<java.lang.String,java.lang.Object>
readAttributes(java.nio.file.Path path, java.lang.String attributes, java.nio.file.LinkOption... options)
void
setAttribute(java.nio.file.Path path, java.lang.String attribute, java.lang.Object value, java.nio.file.LinkOption... options)
-
-
-
Field Detail
-
log
private static final java.util.logging.Logger log
Logger
-
SCHEME
private static final java.lang.String SCHEME
Scheme- See Also:
- Constant Field Values
-
ENV_KEY_ARCHIVE
private static final java.lang.String ENV_KEY_ARCHIVE
Environment key for creating a newFileSystem
denoting the archive- See Also:
- Constant Field Values
-
createdFileSystems
private final java.util.concurrent.ConcurrentMap<java.lang.String,ShrinkWrapFileSystem> createdFileSystems
Open file systems, keyed by theArchive.getId()
-
createNewFsLock
private final java.util.concurrent.locks.ReentrantLock createNewFsLock
Lock for creation of a new filesystem and other tasks which should block until this op has completed
-
-
Method Detail
-
getScheme
public java.lang.String getScheme()
- Specified by:
getScheme
in classjava.nio.file.spi.FileSystemProvider
- See Also:
FileSystemProvider.getScheme()
-
newFileSystem
public java.nio.file.FileSystem newFileSystem(java.net.URI uri, java.util.Map<java.lang.String,?> env) throws java.io.IOException
- Specified by:
newFileSystem
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.newFileSystem(java.net.URI, java.util.Map)
-
getFileSystem
public java.nio.file.FileSystem getFileSystem(java.net.URI uri)
- Specified by:
getFileSystem
in classjava.nio.file.spi.FileSystemProvider
- See Also:
FileSystemProvider.getFileSystem(java.net.URI)
-
getPath
public java.nio.file.Path getPath(java.net.URI uri)
- Specified by:
getPath
in classjava.nio.file.spi.FileSystemProvider
- See Also:
FileSystemProvider.getPath(java.net.URI)
-
newFileChannel
public java.nio.channels.FileChannel newFileChannel(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs) throws java.io.IOException
- Overrides:
newFileChannel
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
java.nio.file.spi.FileSystemProvider#newFileChannel(java.nio.file.Path, java.util.Set, java.nio.file.attribute.FileAttribute>[])
-
newByteChannel
public java.nio.channels.SeekableByteChannel newByteChannel(java.nio.file.Path path, java.util.Set<? extends java.nio.file.OpenOption> options, java.nio.file.attribute.FileAttribute<?>... attrs) throws java.io.IOException
- Specified by:
newByteChannel
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
java.nio.file.spi.FileSystemProvider#newByteChannel(java.nio.file.Path, java.util.Set, java.nio.file.attribute.FileAttribute>[])
-
newDirectoryStream
public java.nio.file.DirectoryStream<java.nio.file.Path> newDirectoryStream(java.nio.file.Path dir, java.nio.file.DirectoryStream.Filter<? super java.nio.file.Path> filter) throws java.io.IOException
- Specified by:
newDirectoryStream
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.newDirectoryStream(java.nio.file.Path, java.nio.file.DirectoryStream.Filter)
-
createDirectory
public void createDirectory(java.nio.file.Path dir, java.nio.file.attribute.FileAttribute<?>... attrs) throws java.io.IOException
- Specified by:
createDirectory
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
java.nio.file.spi.FileSystemProvider#createDirectory(java.nio.file.Path, java.nio.file.attribute.FileAttribute>[])
-
delete
public void delete(java.nio.file.Path path) throws java.io.IOException
- Specified by:
delete
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.delete(java.nio.file.Path)
-
getArchive
private Archive<?> getArchive(java.nio.file.Path path)
Obtains the underlying archive associated with the specified Path- Parameters:
path
-- Returns:
-
copy
public void copy(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options) throws java.io.IOException
- Specified by:
copy
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
-
move
public void move(java.nio.file.Path source, java.nio.file.Path target, java.nio.file.CopyOption... options) throws java.io.IOException
- Specified by:
move
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.move(java.nio.file.Path, java.nio.file.Path, java.nio.file.CopyOption[])
-
isSameFile
public boolean isSameFile(java.nio.file.Path path1, java.nio.file.Path path2) throws java.io.IOException
- Specified by:
isSameFile
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.isSameFile(java.nio.file.Path, java.nio.file.Path)
-
isHidden
public boolean isHidden(java.nio.file.Path path) throws java.io.IOException
- Specified by:
isHidden
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.isHidden(java.nio.file.Path)
-
getFileStore
public java.nio.file.FileStore getFileStore(java.nio.file.Path path) throws java.io.IOException
- Specified by:
getFileStore
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.getFileStore(java.nio.file.Path)
-
checkAccess
public void checkAccess(java.nio.file.Path path, java.nio.file.AccessMode... modes) throws java.io.IOException
- Specified by:
checkAccess
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.checkAccess(java.nio.file.Path, java.nio.file.AccessMode[])
-
getFileAttributeView
public <V extends java.nio.file.attribute.FileAttributeView> V getFileAttributeView(java.nio.file.Path path, java.lang.Class<V> type, java.nio.file.LinkOption... options)
- Specified by:
getFileAttributeView
in classjava.nio.file.spi.FileSystemProvider
- See Also:
FileSystemProvider.getFileAttributeView(java.nio.file.Path, java.lang.Class, java.nio.file.LinkOption[])
-
readAttributes
public <A extends java.nio.file.attribute.BasicFileAttributes> A readAttributes(java.nio.file.Path path, java.lang.Class<A> type, java.nio.file.LinkOption... options) throws java.io.IOException
- Specified by:
readAttributes
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.readAttributes(java.nio.file.Path, java.lang.Class, java.nio.file.LinkOption[])
-
readAttributes
public java.util.Map<java.lang.String,java.lang.Object> readAttributes(java.nio.file.Path path, java.lang.String attributes, java.nio.file.LinkOption... options) throws java.io.IOException
- Specified by:
readAttributes
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.readAttributes(java.nio.file.Path, java.lang.String, java.nio.file.LinkOption[])
-
setAttribute
public void setAttribute(java.nio.file.Path path, java.lang.String attribute, java.lang.Object value, java.nio.file.LinkOption... options) throws java.io.IOException
- Specified by:
setAttribute
in classjava.nio.file.spi.FileSystemProvider
- Throws:
java.io.IOException
- See Also:
FileSystemProvider.setAttribute(java.nio.file.Path, java.lang.String, java.lang.Object, java.nio.file.LinkOption[])
-
copy
private void copy(java.io.InputStream in, java.nio.channels.SeekableByteChannel out) throws java.io.IOException
Writes the contents of theInputStream
to theSeekableByteChannel
- Parameters:
in
-out
-- Throws:
java.io.IOException
-
-