Class AdvancedFSOps
java.lang.Object
org.apache.storm.daemon.supervisor.AdvancedFSOps
- All Implemented Interfaces:
- IAdvancedFSOps
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidcopyDirectory(File fromDir, File toDir) Copy a directory.voidcreateSymlink(File link, File target) Create a symbolic link pointing at target.voiddeleteIfExists(File path) Delete a file or a directory and all of the children.voiddeleteIfExists(File path, String user, String logPrefix) Delete a file or a directory and all of the children.booleandoRequiredTopoFilesExist(Map<String, Object> conf, String topologyId) Sanity check if everything the topology needs is there for it to run.voidDump a string to a file.booleanfileExists(File path) Check if a file exists or not.booleanfileExists(Path path) Check if a file exists or not.voidforceMkdir(File path) Makes a directory, including any necessary but nonexistent parent directories.voidforceMkdir(Path path) Makes a directory, including any necessary but nonexistent parent directories.getOutputStream(File file) Get an output stream to write to a given file.Get a writer for the given location.static AdvancedFSOpsFactory to create a new AdvancedFSOps.voidmoveDirectoryPreferAtomic(File fromDir, File toDir) Move fromDir to toDir, and try to make it an atomic move if possible.voidMoves a file to a given destination.newDirectoryStream(Path dir) List the contents of a directory.newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) List the contents of a directory.voidSet directory permissions to (OWNER)RWX (GROUP)R-X (OTHER)--- On some systems that do not support this, it may become a noop.voidsetupBlobPermissions(File path, String user) Setup permissions properly for an internal blob store path.voidsetupStormCodeDir(String user, File path) Setup the permissions for the storm code dir.voidsetupWorkerArtifactsDir(String user, File path) Setup the permissions for the worker artifacts dirs.byte[]Read the contents of a file into a byte array.slurpString(File location) Read the contents of a file into a String.booleanCheck whether supports atomic directory move.
- 
Field Details- 
symlinksDisabledprotected final boolean symlinksDisabled
 
- 
- 
Constructor Details- 
AdvancedFSOps
 
- 
- 
Method Details- 
makeFactory to create a new AdvancedFSOps.- Parameters:
- conf- the configuration of the process
- Returns:
- the appropriate instance of the class for this config and environment.
 
- 
restrictDirectoryPermissionsSet directory permissions to (OWNER)RWX (GROUP)R-X (OTHER)--- On some systems that do not support this, it may become a noop.- Specified by:
- restrictDirectoryPermissionsin interface- IAdvancedFSOps
- Parameters:
- dir- the directory to change permissions on
- Throws:
- IOException- on any error
 
- 
moveDirectoryPreferAtomicMove fromDir to toDir, and try to make it an atomic move if possible.- Specified by:
- moveDirectoryPreferAtomicin interface- IAdvancedFSOps
- Parameters:
- fromDir- what to move
- toDir- where to move it from
- Throws:
- IOException- on any error
 
- 
moveFileMoves a file to a given destination.- Specified by:
- moveFilein interface- IAdvancedFSOps
- Parameters:
- fromFile- file to move
- toFile- where to move it
- Throws:
- IOException- on any error
 
- 
supportsAtomicDirectoryMovepublic boolean supportsAtomicDirectoryMove()Check whether supports atomic directory move.- Specified by:
- supportsAtomicDirectoryMovein interface- IAdvancedFSOps
- Returns:
- true if an atomic directory move works, else false
 
- 
copyDirectoryCopy a directory.- Specified by:
- copyDirectoryin interface- IAdvancedFSOps
- Parameters:
- fromDir- from where
- toDir- to where
- Throws:
- IOException- on any error
 
- 
setupBlobPermissionsSetup permissions properly for an internal blob store path.- Specified by:
- setupBlobPermissionsin interface- IAdvancedFSOps
- Parameters:
- path- the path to set the permissions on
- user- the user to change the permissions for
- Throws:
- IOException- on any error
 
- 
deleteIfExistsDelete a file or a directory and all of the children. If it exists.- Specified by:
- deleteIfExistsin interface- IAdvancedFSOps
- Parameters:
- path- what to delete
- user- who to delete it as if doing it as someone else is supported
- logPrefix- if an external process needs to be launched to delete the object what prefix to include in the logs
- Throws:
- IOException- on any error.
 
- 
deleteIfExistsDelete a file or a directory and all of the children. If it exists.- Specified by:
- deleteIfExistsin interface- IAdvancedFSOps
- Parameters:
- path- what to delete
- Throws:
- IOException- on any error.
 
- 
setupStormCodeDirSetup the permissions for the storm code dir.- Specified by:
- setupStormCodeDirin interface- IAdvancedFSOps
- Parameters:
- user- the user that owns the topology
- path- the directory to set the permissions on
- Throws:
- IOException- on any error
 
- 
setupWorkerArtifactsDirSetup the permissions for the worker artifacts dirs.- Specified by:
- setupWorkerArtifactsDirin interface- IAdvancedFSOps
- Parameters:
- user- the user that owns the topology
- path- the directory to set the permissions on
- Throws:
- IOException- on any error
 
- 
doRequiredTopoFilesExistpublic boolean doRequiredTopoFilesExist(Map<String, Object> conf, String topologyId) throws IOExceptionSanity check if everything the topology needs is there for it to run.- Specified by:
- doRequiredTopoFilesExistin interface- IAdvancedFSOps
- Parameters:
- conf- the config of the supervisor
- topologyId- the ID of the topology
- Returns:
- true if everything is there, else false
- Throws:
- IOException- on any error
 
- 
forceMkdirMakes a directory, including any necessary but nonexistent parent directories.- Specified by:
- forceMkdirin interface- IAdvancedFSOps
- Parameters:
- path- the directory to create
- Throws:
- IOException- on any error
 
- 
forceMkdirMakes a directory, including any necessary but nonexistent parent directories.- Specified by:
- forceMkdirin interface- IAdvancedFSOps
- Parameters:
- path- the directory to create
- Throws:
- IOException- on any error
 
- 
newDirectoryStreampublic DirectoryStream<Path> newDirectoryStream(Path dir, DirectoryStream.Filter<? super Path> filter) throws IOException Description copied from interface:IAdvancedFSOpsList the contents of a directory.- Specified by:
- newDirectoryStreamin interface- IAdvancedFSOps
- Parameters:
- dir- the driectory to list the contents of
- filter- a filter to decide if it should be included or not
- Returns:
- A stream of directory entries
- Throws:
- IOException- on any error
 
- 
newDirectoryStreamDescription copied from interface:IAdvancedFSOpsList the contents of a directory.- Specified by:
- newDirectoryStreamin interface- IAdvancedFSOps
- Parameters:
- dir- the driectory to list the contents of
- Returns:
- A stream of directory entries
- Throws:
- IOException- on any error
 
- 
fileExistsCheck if a file exists or not.- Specified by:
- fileExistsin interface- IAdvancedFSOps
- Parameters:
- path- the path to check
- Returns:
- true if it exists else false
- Throws:
- IOException- on any error.
 
- 
fileExistsCheck if a file exists or not.- Specified by:
- fileExistsin interface- IAdvancedFSOps
- Parameters:
- path- the path to check
- Returns:
- true if it exists else false
- Throws:
- IOException- on any error.
 
- 
getWriterGet a writer for the given location.- Specified by:
- getWriterin interface- IAdvancedFSOps
- Parameters:
- file- the file to write to
- Returns:
- the Writer to use.
- Throws:
- IOException- on any error
 
- 
getOutputStreamGet an output stream to write to a given file.- Specified by:
- getOutputStreamin interface- IAdvancedFSOps
- Parameters:
- file- the file to write to
- Returns:
- an OutputStream for that file
- Throws:
- IOException- on any error
 
- 
dumpDump a string to a file.- Specified by:
- dumpin interface- IAdvancedFSOps
- Parameters:
- location- where to write to
- data- the data to write
- Throws:
- IOException- on any error
 
- 
slurpStringRead the contents of a file into a String.- Specified by:
- slurpStringin interface- IAdvancedFSOps
- Parameters:
- location- the file to read
- Returns:
- the contents of the file
- Throws:
- IOException- on any error
 
- 
slurpRead the contents of a file into a byte array.- Specified by:
- slurpin interface- IAdvancedFSOps
- Parameters:
- location- the file to read
- Returns:
- the contents of the file
- Throws:
- IOException- on any error
 
- 
createSymlinkCreate a symbolic link pointing at target.- Specified by:
- createSymlinkin interface- IAdvancedFSOps
- Parameters:
- link- the link to create
- target- where it should point to
- Throws:
- IOException- on any error.
 
 
-