Class PluginInstallerSupport
java.lang.Object
net.shibboleth.idp.installer.plugin.impl.PluginInstallerSupport
Support for copying files during plugin manipulation.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
A @{linkFileVisitor
which deletes files.private static final class
A @{linkFileVisitor
which detects (and logs) whether a copy would overwrite. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Path
canonicalPath
(Path from) Return the canonical path.static void
copyWithLogging
(Path from, Path to, List<Path> pathsCopied) Copy a directory tree and keep a log of what has changed.static void
deleteTree
(Path directory) Delete a directory tree.static boolean
detectDuplicates
(Path from, Path to) Traverse "from" looking to see if any of the files are already in "to".static void
Rename Files into the provided tree.
-
Field Details
-
LOG
@Nonnull private static final org.slf4j.Logger LOGClass logger.
-
-
Constructor Details
-
PluginInstallerSupport
private PluginInstallerSupport()Constructor.
-
-
Method Details
-
canonicalPath
Return the canonical path.- Parameters:
from
- the path we get given- Returns:
- the canonicalized one
- Throws:
IOException
- as fromFile.getCanonicalFile()
-
deleteTree
Delete a directory tree.- Parameters:
directory
- what to delete
-
detectDuplicates
public static boolean detectDuplicates(Path from, Path to) throws org.apache.tools.ant.BuildException Traverse "from" looking to see if any of the files are already in "to".- Parameters:
from
- source directoryto
- target directory- Returns:
- true if there was a match
- Throws:
org.apache.tools.ant.BuildException
- if anything threw andIOException
-
copyWithLogging
public static void copyWithLogging(Path from, Path to, @Live List<Path> pathsCopied) throws org.apache.tools.ant.BuildException Copy a directory tree and keep a log of what has changed.- Parameters:
from
- source directoryto
- target directorypathsCopied
- the list of files copied up (including if there was a failure)- Throws:
org.apache.tools.ant.BuildException
- from the copy
-
renameToTree
public static void renameToTree(@Nonnull Path fromBase, @Nonnull Path toBase, @Nonnull List<Path> fromFiles, @Nonnull @Live List<Pair<Path, Path>> renames) throws IOExceptionRename Files into the provided tree.- Parameters:
fromBase
- The root directory of the from filestoBase
- The root directory to rename tofromFiles
- The list of files (inside fromBase) to renamerenames
- All the work as it is done- Throws:
IOException
- If any of the file operations fail
-