Package net.shibboleth.idp.installer
Class InstallerSupport
- java.lang.Object
-
- net.shibboleth.idp.installer.InstallerSupport
-
public final class InstallerSupport extends Object
General common names and helper functions for the Installer. This is not intended for general use.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.tools.ant.ProjectANT_PROJECTA psuedo ant-project as parent.private static org.slf4j.LoggerlogLog.static StringPREVIOUS_VERSION_NAMEThe name of the file and the property with the previous installation value.static StringVERSION_NAMEThe name of the file and the property with the current V4 installation value.
-
Constructor Summary
Constructors Modifier Constructor Description privateInstallerSupport()Private Constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopyDirIfNotPresent(Path from, Path to)Populate a with all the missing files.static voidcreateDirectory(Path dir)Method to create a directory and log same.static org.apache.tools.ant.taskdefs.JarcreateJarTask(Path baseDir, Path destFile)Return aJartask.static voiddeleteTree(Path where)Delete the tree.static voiddeleteTree(Path where, String excludes)Delete the tree.static org.apache.tools.ant.taskdefs.CopygetCopyTask(Path from, Path to)Copy files.static voidsetGroup(Path directory, String group, String includes)On Non Windows sets the files (only) group.static voidsetMode(Path directory, String permissions, String includes)On Non Windows sets the file mode.static voidsetReadOnly(Path path, boolean readOnly)On Windows sets the readOnly attribute on a file or recursively on a directory.static voidsetReadOnlyDir(Path directory, boolean readOnly)On Windows sets the readOnly attribute recursively on a directory.private static voidsetReadOnlyFile(Path file, boolean readOnly)On Windows sets the readOnly attribute on a file.
-
-
-
Field Detail
-
VERSION_NAME
public static final String VERSION_NAME
The name of the file and the property with the current V4 installation value.- See Also:
- Constant Field Values
-
PREVIOUS_VERSION_NAME
public static final String PREVIOUS_VERSION_NAME
The name of the file and the property with the previous installation value.- See Also:
- Constant Field Values
-
ANT_PROJECT
private static final org.apache.tools.ant.Project ANT_PROJECT
A psuedo ant-project as parent.
-
log
private static org.slf4j.Logger log
Log.
-
-
Method Detail
-
createDirectory
public static void createDirectory(Path dir) throws org.apache.tools.ant.BuildException
Method to create a directory and log same.- Parameters:
dir- what to create- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
getCopyTask
public static org.apache.tools.ant.taskdefs.Copy getCopyTask(Path from, Path to)
Copy files. We use ant rather thanFiles.copy(Path, Path, java.nio.file.CopyOption...)because the latter has issues with the Windows ReadOnly Attribute, and the former is tried and tested technology.- Parameters:
from- where to copy fromto- where to copy to- Returns:
- a partially populated
Copytask
-
copyDirIfNotPresent
public static void copyDirIfNotPresent(Path from, Path to) throws org.apache.tools.ant.BuildException
Populate a with all the missing files.- Parameters:
from- where to go fromto- where to go to- Throws:
org.apache.tools.ant.BuildException- if badness occurrs Based on (for instance the following ant<!-- flows: copy from dist if not already present --> <mkdir dir="${idp.target.dir}/flows" /> <copy todir="${idp.target.dir}/flows"> <fileset dir="${idp.target.dir}/dist/flows" includes="**\/*"> <present present="srconly" targetdir="${idp.target.dir}/flows" /> </fileset > </copy>
-
setReadOnlyFile
private static void setReadOnlyFile(Path file, boolean readOnly) throws org.apache.tools.ant.BuildException
On Windows sets the readOnly attribute on a file.- Parameters:
file- wherereadOnly- what to set it as- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
setReadOnlyDir
public static void setReadOnlyDir(Path directory, boolean readOnly) throws org.apache.tools.ant.BuildException
On Windows sets the readOnly attribute recursively on a directory.- Parameters:
directory- wherereadOnly- what to set it as- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
setReadOnly
public static void setReadOnly(Path path, boolean readOnly) throws org.apache.tools.ant.BuildException
On Windows sets the readOnly attribute on a file or recursively on a directory.- Parameters:
path- wherereadOnly- what to set it as- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
setMode
public static void setMode(Path directory, String permissions, String includes) throws org.apache.tools.ant.BuildException
On Non Windows sets the file mode.- Parameters:
directory- wherepermissions- what to setincludes- what to include- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
setGroup
public static void setGroup(Path directory, String group, String includes) throws org.apache.tools.ant.BuildException
On Non Windows sets the files (only) group.- Parameters:
directory- wheregroup- what to setincludes- what to include- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
deleteTree
public static void deleteTree(Path where) throws org.apache.tools.ant.BuildException
Delete the tree.- Parameters:
where- where- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
deleteTree
public static void deleteTree(Path where, String excludes) throws org.apache.tools.ant.BuildException
Delete the tree.- Parameters:
where- whereexcludes- wildcards to exclude- Throws:
org.apache.tools.ant.BuildException- if badness occurs
-
-