Class PluginInstallerSupport
- java.lang.Object
-
- net.shibboleth.idp.installer.plugin.impl.PluginInstallerSupport
-
public final class PluginInstallerSupport extends Object
Support for copying files during plugin manipulation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPluginInstallerSupport.DeletingVisitorA @{linkFileVisitorwhich deletes files.private static classPluginInstallerSupport.NameClashVisitorA @{linkFileVisitorwhich detects (and logs) whether a copy would overwrite.
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.LoggerLOGClass logger.
-
Constructor Summary
Constructors Modifier Constructor Description privatePluginInstallerSupport()Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description (package private) static PathcanonicalPath(Path from)Return the canonical path.static voidcopyWithLogging(Path from, Path to, List<Path> pathsCopied)Copy a directory tree and keep a log of what has changed.static voiddeleteTree(Path directory)Delete a directory tree.static booleandetectDuplicates(Path from, Path to)Traverse "from" looking to see if any of the files are already in "to".static voidrenameToTree(Path fromBase, Path toBase, List<Path> fromFiles, List<Pair<Path,Path>> renames)Rename Files into the provided tree.
-
-
-
Method Detail
-
canonicalPath
static Path canonicalPath(Path from) throws IOException
Return the canonical path.- Parameters:
from- the path we get given- Returns:
- the canonicalized one
- Throws:
IOException- as fromFile.getCanonicalFile()
-
deleteTree
public static void deleteTree(@Nullable Path directory)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
-
-