Class BootstrapUtilities
java.lang.Object
com.inductiveautomation.ignition.client.launch.BootstrapUtilities
Created by carl.gould on 1/29/2015.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classStores a subset of information for a gateway which will be launched after a restart or retarget.static final class
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidcleanDirectory(File directory) Cleans a directory without deleting it.static voidstatic longstatic voiddeleteDirectory(File directory) Deletes a directory recursively.static longdownloadFile(URL url, int readTimeout, File destination) Downloads the file that exists at the url and saves it to the supplied destination file.static voidforceDelete(File file) gatewayInfo(GatewayAddress target) Retrieves the target gateway addresses gw info from the GatewayInfoServlet.static FilegetJarParentFolder(File resourcesDir, LaunchManifest.Module m, LaunchManifest.Jar j) Given the root of the cache/resources/ folder, returns the correct parent folder for a given jar file, right before the specific CRC subfolders.static StringgetStringResponse(URL url, int readTimeout) launchJarCompatible(GatewayAddress target, File launchJar) Checks if the supplied launch jar matches in length and crc32 checksum by getting the required length and checksum from the target gateway and comparing against the file.static Stringstatic HttpURLConnectionnewConnection(URL url, int readTimeout) Returns a new "GET" HttpURLConnection with the default connect timeout of 15 seconds and a read timeout based on the supplied value.static StringreadFileAsString(File file) static StringSanitizes a string to be compatible with filename / foldername requirements by replacing illegal chars with underscores.static FileReturns a subdir and tries to create it if necessary.static Filestatic Filestatic voidwriteStringToFile(String string, File file) 
- 
Method Details- 
subdirReturns a subdir and tries to create it if necessary. Throws an error if the dir can't be created- Throws:
- Exception
 
- 
getJarParentFolderpublic static File getJarParentFolder(File resourcesDir, LaunchManifest.Module m, LaunchManifest.Jar j) throws Exception Given the root of the cache/resources/ folder, returns the correct parent folder for a given jar file, right before the specific CRC subfolders.- Throws:
- Exception
 
- 
sanitizeSanitizes a string to be compatible with filename / foldername requirements by replacing illegal chars with underscores.
- 
crc- Throws:
- IOException
 
- 
md5- Throws:
- IOException
 
- 
deleteDirectoryDeletes a directory recursively.- Parameters:
- directory- directory to delete
- Throws:
- IOException- in case deletion is unsuccessful
 
- 
cleanDirectoryCleans a directory without deleting it.- Parameters:
- directory- directory to clean
- Throws:
- IOException- in case cleaning is unsuccessful
 
- 
forceDelete- Throws:
- IOException
 
- 
subfile
- 
subfile
- 
copyFile- Throws:
- IOException
 
- 
readFileAsString- Throws:
- IOException
 
- 
writeStringToFile- Throws:
- IOException
 
- 
gatewayInfopublic static BootstrapUtilities.GatewayInfoResults gatewayInfo(GatewayAddress target) throws IOException Retrieves the target gateway addresses gw info from the GatewayInfoServlet. This is useful for retrieving details which are required very early in the bootstrap process or details needed at the very beginning of starting a new process or client. A Basic check is used to ensure the response is what would be expected from the GatewayInfoServlet and a small subset of values are returned which are very lenient to accommodate gateways which might not provide those details.- Throws:
- IOException
 
- 
launchJarCompatiblepublic static BootstrapUtilities.LaunchJarResults launchJarCompatible(GatewayAddress target, File launchJar) throws IOException Checks if the supplied launch jar matches in length and crc32 checksum by getting the required length and checksum from the target gateway and comparing against the file. A LaunchJarResults is returned which wraps a boolean stating if its matches along with the checksum and length.- Throws:
- IOException
 
- 
getStringResponse- Throws:
- IOException
 
- 
downloadFileDownloads the file that exists at the url and saves it to the supplied destination file. Returns the CRC32 checksum of the file. No locking of the destination file is performed.- Throws:
- IOException
 
- 
newConnectionReturns a new "GET" HttpURLConnection with the default connect timeout of 15 seconds and a read timeout based on the supplied value. Be sure to close the connection!- Throws:
- IOException
 
 
-