Package org.jboss.vfs.util.automount
Class Automounter
- java.lang.Object
-
- org.jboss.vfs.util.automount.Automounter
-
public class Automounter extends java.lang.ObjectUtility used to manage mounting Virtual FileSystems.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classAutomounter.RegistryEntry
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ConcurrentMap<MountOwner,java.util.Set<Automounter.RegistryEntry>>ownerReferencesprivate static Automounter.RegistryEntryrootEntryprivate static TempFileProvidertempFileProvider
-
Constructor Summary
Constructors Modifier Constructor Description privateAutomounter()Private constructor
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanaddHandle(VirtualFile owner, java.io.Closeable handle)Add handle to owner, to be auto closed.static voidcleanup(java.lang.Object owner)Cleanup all references from the owner.static voidcleanup(MountOwner owner)Cleanup all references from theMountOwner.static voidcleanup(VirtualFile owner)Cleanup all references from the owner.(package private) static Automounter.RegistryEntrygetEntry(VirtualFile virtualFile)Get the entry from the tree creating the entry if not present.private static MountConfiggetMountConfig(MountOption[] mountOptions)Creates a MountConfig and applies the provided mount optionsprivate static TempFileProvidergetTempFileProvider()static booleanisMounted(VirtualFile target)Determines whether a targetVirtualFileis mounted.static voidmount(java.lang.Object owner, VirtualFile target, MountOption... mountOptions)Mount providedVirtualFile(if not mounted) and add an owner entry.static voidmount(MountOwner owner, VirtualFile target, MountOption... mountOptions)Mount providedVirtualFile(if not mounted) and add an owner entry.static voidmount(VirtualFile target, MountOption... mountOptions)Mount providedVirtualFile(if not mounted) and set the owner to be the provided target.static voidmount(VirtualFile owner, VirtualFile target, MountOption... mountOptions)Mount providedVirtualFile(if not mounted) and add an owner entry.static booleanremoveHandle(VirtualFile owner, java.io.Closeable handle)Remove handle from owner.
-
-
-
Field Detail
-
rootEntry
private static final Automounter.RegistryEntry rootEntry
-
ownerReferences
private static final java.util.concurrent.ConcurrentMap<MountOwner,java.util.Set<Automounter.RegistryEntry>> ownerReferences
-
tempFileProvider
private static TempFileProvider tempFileProvider
-
-
Method Detail
-
mount
public static void mount(VirtualFile target, MountOption... mountOptions) throws java.io.IOException
Mount providedVirtualFile(if not mounted) and set the owner to be the provided target. (Self owned mount)- Parameters:
target- VirtualFile to mountmountOptions- optional configuration to use for mounting- Throws:
java.io.IOException- when the target can not be mounted.
-
mount
public static void mount(java.lang.Object owner, VirtualFile target, MountOption... mountOptions) throws java.io.IOExceptionMount providedVirtualFile(if not mounted) and add an owner entry. Also creates a back-reference to from the owner to the target.- Parameters:
owner- Object that owns the reference to the mounttarget- VirtualFile to mountmountOptions- optional configuration to use for mounting- Throws:
java.io.IOException- when the target can not be mounted.
-
mount
public static void mount(VirtualFile owner, VirtualFile target, MountOption... mountOptions) throws java.io.IOException
Mount providedVirtualFile(if not mounted) and add an owner entry. Also creates a back-reference to from the owner to the target.- Parameters:
owner- VirtualFile that owns the reference to the mounttarget- VirtualFile to mountmountOptions- optional configuration to use for mounting- Throws:
java.io.IOException- when the target can not be mounted.
-
mount
public static void mount(MountOwner owner, VirtualFile target, MountOption... mountOptions) throws java.io.IOException
Mount providedVirtualFile(if not mounted) and add an owner entry. Also creates a back-reference to from the owner to the target.- Parameters:
owner- MountOwner that owns the reference to the mounttarget- VirtualFile to mountmountOptions- optional configuration to use for mounting- Throws:
java.io.IOException- when the target can not be mounted
-
getMountConfig
private static MountConfig getMountConfig(MountOption[] mountOptions)
Creates a MountConfig and applies the provided mount options- Parameters:
mountOptions- options to use for mounting- Returns:
- a MountConfig
-
addHandle
public static boolean addHandle(VirtualFile owner, java.io.Closeable handle)
Add handle to owner, to be auto closed.- Parameters:
owner- the handle ownerhandle- the handle- Returns:
- add result
-
removeHandle
public static boolean removeHandle(VirtualFile owner, java.io.Closeable handle)
Remove handle from owner.- Parameters:
owner- the handle ownerhandle- the handle- Returns:
- remove result
-
cleanup
public static void cleanup(java.lang.Object owner)
Cleanup all references from the owner. Cleanup any mounted entries that become un-referenced in the process.- Parameters:
owner-Objectto cleanup references for
-
cleanup
public static void cleanup(VirtualFile owner)
Cleanup all references from the owner. Cleanup any mounted entries that become un-referenced in the process.- Parameters:
owner-Objectto cleanup references for
-
cleanup
public static void cleanup(MountOwner owner)
Cleanup all references from theMountOwner. Cleanup any mounted entries that become un-referenced in the process.- Parameters:
owner-MountOwnerto cleanup references for
-
isMounted
public static boolean isMounted(VirtualFile target)
Determines whether a targetVirtualFileis mounted.- Parameters:
target- target to check- Returns:
- true if mounted, false otherwise
-
getEntry
static Automounter.RegistryEntry getEntry(VirtualFile virtualFile)
Get the entry from the tree creating the entry if not present.- Parameters:
virtualFile- entry's owner file- Returns:
- registry entry
-
getTempFileProvider
private static TempFileProvider getTempFileProvider() throws java.io.IOException
- Throws:
java.io.IOException
-
-