Package org.oa4mp.server.admin.install
Class Installer
- java.lang.Object
-
- org.oa4mp.server.admin.install.Installer
-
public class Installer extends Object
Really simple installer. This basically just copies stuff that has been set up in the create_installer.sh script, so chances are excellent if you need to change the installer, you should be looking there.
This gets copied to your jar and will just copy everything in the jar to a given directory (including sub directories). So make the tree you want, jar it up with this class and run it.Caveat for changing this class
This is a completely standalone class -- no dependencies but plain Old Java -- because otherwise you have to manage dependencies (might involve writing your own class loader!) for this installer program which can get very hard. The idea is that this is a lean, single class. Even inheritance doesn't work.Created by Jeff Gaynor
on 3/30/20 at 7:23 AM
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
ALL_FLAG
protected static String
DEBUG_FLAG
protected static String
DIR_ARG
protected static String
HELP_FLAG
protected static String
HELP_OPTION
protected String
host
protected static String
HOST_FLAG
protected static String
INSTALL_OPTION
protected static String
LIST_OPTION
static String
NO_PORT
protected static String
OA4MP_FLAG
String
operationKey
protected int
port
protected static String
PORT_FLAG
protected static String
REMOVE_OPTION
static String
SHEBANG
protected static String
UPGRADE_FLAG
protected static String
UPGRADE_OPTION
-
Constructor Summary
Constructors Constructor Description Installer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected File
checkRootDir(File rootDir, boolean upgrade)
Prompts for the right directory, if missing, and then it will check if various directories exist.protected boolean
checkUpgradeDir(File dir)
For upgrades.protected void
cp(String resourceName, File target)
gets the resourceName as a stream and copies it to the physical target file.protected void
doInstall()
protected void
doListFiles()
protected void
doRemove()
protected String
doReplace(String currentLine)
Does all of the template replacements in a line.protected void
doUpgrade()
protected void
download(URL url, File targetFile)
protected BufferedReader
getBufferedReader()
protected String
getHost()
String
getOperation()
protected int
getPort()
File
getRootDir()
protected File
getUserHome()
protected boolean
hasPort()
boolean
hasRootDir()
protected void
installOA4MP(File rootDir)
Boolean
is(String key)
Checks that the key is a booleanboolean
isAll()
boolean
isDebugOn()
boolean
isInstall()
boolean
isList()
boolean
isOA4MP()
boolean
isRemove()
boolean
isShowHelp()
protected List<String>
isToList(InputStream inputStream)
boolean
isUpgrade()
static void
main(String[] args)
protected void
nukeDir(File dir)
Remove the contents of the directory.String
readline(String prompt)
protected void
runnit2(String[] args)
protected void
say(String x)
void
setDebugOn(boolean debugOn)
protected void
setupArgMap(String[] args)
protected void
setupTemplates()
Sets up the templates for replacement.protected void
trace(String message)
protected void
uninstallOA4MP(File rootDir)
protected void
upgradeOA4MP(File rootDir)
Overwrites (but does not delete) files and will make more complex paths.
-
-
-
Field Detail
-
UPGRADE_FLAG
protected static final String UPGRADE_FLAG
- See Also:
- Constant Field Values
-
UPGRADE_OPTION
protected static final String UPGRADE_OPTION
- See Also:
- Constant Field Values
-
HELP_FLAG
protected static final String HELP_FLAG
- See Also:
- Constant Field Values
-
HELP_OPTION
protected static final String HELP_OPTION
- See Also:
- Constant Field Values
-
DIR_ARG
protected static final String DIR_ARG
- See Also:
- Constant Field Values
-
DEBUG_FLAG
protected static final String DEBUG_FLAG
- See Also:
- Constant Field Values
-
INSTALL_OPTION
protected static final String INSTALL_OPTION
- See Also:
- Constant Field Values
-
LIST_OPTION
protected static final String LIST_OPTION
- See Also:
- Constant Field Values
-
REMOVE_OPTION
protected static final String REMOVE_OPTION
- See Also:
- Constant Field Values
-
OA4MP_FLAG
protected static final String OA4MP_FLAG
- See Also:
- Constant Field Values
-
ALL_FLAG
protected static final String ALL_FLAG
- See Also:
- Constant Field Values
-
HOST_FLAG
protected static final String HOST_FLAG
- See Also:
- Constant Field Values
-
PORT_FLAG
protected static final String PORT_FLAG
- See Also:
- Constant Field Values
-
host
protected String host
-
port
protected int port
-
SHEBANG
public static String SHEBANG
-
operationKey
public String operationKey
-
NO_PORT
public static String NO_PORT
-
-
Method Detail
-
trace
protected void trace(String message)
-
isDebugOn
public boolean isDebugOn()
-
setDebugOn
public void setDebugOn(boolean debugOn)
-
main
public static void main(String[] args)
-
doRemove
protected void doRemove() throws IOException
- Throws:
IOException
-
uninstallOA4MP
protected void uninstallOA4MP(File rootDir)
-
setupTemplates
protected void setupTemplates() throws IOException
Sets up the templates for replacement. Run this aftersetupArgMap(String[])
.- Throws:
IOException
-
getUserHome
protected File getUserHome()
-
checkUpgradeDir
protected boolean checkUpgradeDir(File dir)
For upgrades. If the directory does not exist, create it. Return false if the directory does not exist.- Parameters:
dir
-- Returns:
-
nukeDir
protected void nukeDir(File dir)
Remove the contents of the directory. At the end of this, the directory is empty. It does not delete the directory, however- Parameters:
dir
-
-
isToList
protected List<String> isToList(InputStream inputStream) throws IOException
- Throws:
IOException
-
upgradeOA4MP
protected void upgradeOA4MP(File rootDir) throws Exception
Overwrites (but does not delete) files and will make more complex paths. This allows for upgrading much older QDL installs that might have different or missing (e.g. vim support) directories.- Throws:
Exception
-
cp
protected void cp(String resourceName, File target) throws IOException
gets the resourceName as a stream and copies it to the physical target file.- Parameters:
resourceName
-target
-- Throws:
IOException
-
doReplace
protected String doReplace(String currentLine)
Does all of the template replacements in a line.- Parameters:
currentLine
-- Returns:
-
checkRootDir
protected File checkRootDir(File rootDir, boolean upgrade) throws Exception
Prompts for the right directory, if missing, and then it will check if various directories exist. If this returns false, then the install cannot proceed, because, e.g., they request an upgrade but no base install exists.- Returns:
- Throws:
Exception
-
getBufferedReader
protected BufferedReader getBufferedReader()
-
say
protected void say(String x)
-
setupArgMap
protected void setupArgMap(String[] args)
-
hasPort
protected boolean hasPort()
-
getHost
protected String getHost()
-
getPort
protected int getPort()
-
getRootDir
public File getRootDir()
-
isInstall
public boolean isInstall()
-
isRemove
public boolean isRemove()
-
isUpgrade
public boolean isUpgrade()
-
isShowHelp
public boolean isShowHelp()
-
isList
public boolean isList()
-
hasRootDir
public boolean hasRootDir()
-
getOperation
public String getOperation()
-
isAll
public boolean isAll()
-
isOA4MP
public boolean isOA4MP()
-
download
protected void download(URL url, File targetFile) throws IOException
- Throws:
IOException
-
-