java.lang.Object jwrapper.jwutils.JWSystem
public class JWSystem
Utility APIs for virtual apps running inside JWrapper All methods in this class will run without using or requiring a graphical user interface (they will work OK in a headless system)
Constructor Summary | |
---|---|
JWSystem()
|
Method Summary | |
---|---|
static void |
addAppSpecificProxy(java.net.Proxy proxy)
Include a proxy specified in the application in the list of proxies to be used when updating. |
static void |
addAppSpecificProxy(java.net.Proxy proxy,
java.lang.String username,
java.lang.String password)
Include a proxy specified in the application in the list of proxies to be used when updating, and use the provided credentials when authenticating. |
static void |
clearPreparedFork()
Remove any pre-prepared virtual app for quick launch (for example if the required version has changed) |
static boolean |
detectAndSetProxyFor(java.net.URL url,
int timeoutMS)
Call this method to redetect the proxy settings for a given URL. |
static void |
forkVirtualApp(java.lang.String virtualAppName)
Launch a defined virtual app by name |
static void |
forkVirtualApp(java.lang.String virtualAppName,
java.util.Properties launchProperties,
java.lang.String[] commandLineArgs)
Launch a defined virtual app by name |
static void |
forkVirtualApp(java.lang.String virtualAppName,
java.util.Properties launchProperties,
java.lang.String[] commandLineArgs,
boolean elevateToAdmin,
boolean checkForUpdateFirst)
Launch a defined virtual app by name |
static void |
forkVirtualApp(java.lang.String virtualAppName,
java.lang.String staticUpdateURL,
java.util.Properties launchProperties,
java.lang.String[] commandLineArgs,
boolean elevateToAdmin,
boolean checkForUpdateFirst)
Launch a defined virtual app by name |
static java.io.File |
getAllAppLoggingFolder()
Get the shared folder where all versions of this app bundle can store and retrieve data |
static java.io.File |
getAllAppVersionsSharedFolder()
Get the shared folder where all versions of this app bundle can store and retrieve data |
static java.io.File |
getAllAppVersionsSharedFolder(java.io.File master)
Get the shared folder where all versions of this app bundle can store and retrieve data |
static java.lang.String |
getAppBundleName()
Get the name of this app bundle |
static byte[] |
getAppBundleSplashPNG()
Get the splash image in PNG form for this app bundle |
static byte[] |
getAppBundleUninstallerICO()
Get the uninstaller image in Windows ICO form for this app bundle |
static byte[] |
getAppBundleUninstallerPNG()
Get the uninstaller image in PNG form for this app bundle |
static java.lang.String |
getAppBundleVersion()
Get the JWrapper version number for this app bundle - NOTE app code should not depend on this as there may be cases where the version number is altered from the original to force a re-update. |
static java.io.File |
getAppFolder()
Get the app bundle's installation folder (all included files will be extracted to this folder) |
static java.lang.String |
getAppLaunchProperty(java.lang.String propertyName)
Get a launch property set for this app bundle |
static java.net.Proxy |
getDefaultDetectedProxy()
Returns the current default proxy as detected by JWrapper. |
static java.lang.String |
getInstallType()
Get the install type as specified in the app bundle XML (NoInstall/CurrentUser/AllUsers) |
static java.net.Proxy |
getJWrapperProxy()
Returns the proxy details used. |
static JWProxyCredentials.Credentials |
getJWrapperProxyCredentials()
Return the proxy credentials for the default JWrapper detected proxy. |
static java.io.File |
getLauncherLocationForVirtualApp(java.io.File dir,
java.lang.String shortcutName)
|
static byte[] |
getMyAppLogoICO()
Get the logo in Windows ICO form for this virtual app |
static byte[] |
getMyAppLogoPNG()
Get the logo in PNG form for this virtual app |
static java.lang.String |
getMyAppName()
Get the name of this virtual app |
static java.io.File |
getMyJreHome()
Get the current JRE home folder |
static java.io.File |
getMyLogFile()
Get the JW log file associated with this virtual app run |
static java.io.File |
getNativeJavaLauncher()
Return the JWrapper native Java launcher which can be used to spawn Java processes. |
static java.lang.String |
getOsxAppDomainName()
Get the OSX App Domain used for this app bundle. |
static java.util.Properties |
getPreparedForkProperties()
|
static java.lang.String |
getSourceLauncherUpdateURL()
Get the update URL from the launcher that launched this app, this is only to pick up overrides mid-app run |
static java.lang.String[] |
getSupportedLanguages()
Get all supported languages as an array of language codes |
static java.lang.String |
getUpdateURL()
Get the update URL for this app bundle |
static void |
loadJWrapperProxies()
|
static void |
main(java.lang.String[] args)
|
static boolean |
matchingClientToServerVersion()
Check to see if this app bundle version is matched to the server (update URL) version |
static void |
overrideAppBundleUpdateURL(java.net.URL url)
Set the update URL for this app bundle, note this will override any other settings from the original app bundle download or configuration |
static void |
overrideSourceLauncherUpdateURL(java.net.URL url)
Set the update URL for the launcher that launched this particular run. |
static void |
prepareForkVirtualApp(java.lang.String virtualAppName,
java.util.Properties launchProperties,
java.lang.String[] commandLineArgs)
Prepare to quickly launch a defined virtual app by name |
static void |
prepareForkVirtualApp(java.lang.String virtualAppName,
java.lang.String staticUpdateURL,
java.util.Properties launchProperties,
java.lang.String[] commandLineArgs,
boolean elevateToAdmin,
boolean checkForUpdateFirst)
Prepare a virtual app for quick launch |
static void |
removeOverrideAppBundleUpdateURL()
Remove the override update URL for this app bundle |
static java.io.File |
saveLauncherShortcutForVirtualApp(java.io.File dir,
java.lang.String shortcutName,
java.lang.String virtualAppName,
java.util.Properties launchProperties,
boolean elevateToAdmin)
Save a JWrapper launcher (OS-native executable app) to launch a virtual app or the chooser with any set of preconfigured launch properties |
static void |
setCircularLogAreaBytes(long b)
Set the number of recent bytes this virtual app should log before wrapping, these will be retained at the end of the log file in a circular log format |
static void |
setInitialLogAreaBytes(long b)
Set the number of initial bytes this virtual app should log before curtailing, these will be retained at the top of the log file |
static void |
setLastUsedProxyAsDefault()
If the JWrapper build is configured with a valid update URL then JWrapper will automatically attempt to detect a proxy with which to access the update server. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JWSystem()
Method Detail |
---|
public static void addAppSpecificProxy(java.net.Proxy proxy) throws java.io.IOException
proxy
- the proxy to be added for this application.
java.io.IOException
public static void addAppSpecificProxy(java.net.Proxy proxy, java.lang.String username, java.lang.String password) throws java.io.IOException
proxy
- the proxy to be added for this application.username
- the proxy credential usernamepassword
- the proxy credential password
java.io.IOException
public static void clearPreparedFork()
public static boolean detectAndSetProxyFor(java.net.URL url, int timeoutMS)
url
- the URL for which a proxy is required.timeoutMS
- the timeout period, in milliseconds, after which proxy detection should terminate.
public static void forkVirtualApp(java.lang.String virtualAppName) throws java.lang.Exception
virtualAppName
- the name of the virtual app in this bundle to launch
java.lang.Exception
public static void forkVirtualApp(java.lang.String virtualAppName, java.util.Properties launchProperties, java.lang.String[] commandLineArgs) throws java.lang.Exception
virtualAppName
- the name of the virtual app in this bundle to launchlaunchProperties
- the launch properties for the virtual appcommandLineArgs
- any additional command line args for the virtual app
java.lang.Exception
public static void forkVirtualApp(java.lang.String virtualAppName, java.util.Properties launchProperties, java.lang.String[] commandLineArgs, boolean elevateToAdmin, boolean checkForUpdateFirst) throws java.lang.Exception
virtualAppName
- the name of the virtual app in this bundle to launchlaunchProperties
- the launch properties for the virtual appcommandLineArgs
- any additional command line args for the virtual appelevateToAdmin
- launch the app with elevated privileges (e.g. sudo on Linux/MacOS, elevated to admin on Windows)
java.lang.Exception
public static void forkVirtualApp(java.lang.String virtualAppName, java.lang.String staticUpdateURL, java.util.Properties launchProperties, java.lang.String[] commandLineArgs, boolean elevateToAdmin, boolean checkForUpdateFirst) throws java.lang.Exception
virtualAppName
- the name of the virtual app in this bundle to launchstaticUpdateURL
- the static update URL for this launch, set to "D" to allow dynamic update URLs (in the launch properties)launchProperties
- the launch properties for the virtual appcommandLineArgs
- any additional command line args for the virtual appelevateToAdmin
- launch the app with elevated privileges (e.g. sudo on Linux/MacOS, elevated to admin on Windows)
java.lang.Exception
public static java.io.File getAllAppLoggingFolder()
public static java.io.File getAllAppVersionsSharedFolder()
public static java.io.File getAllAppVersionsSharedFolder(java.io.File master)
public static java.lang.String getAppBundleName()
public static byte[] getAppBundleSplashPNG() throws java.io.IOException
java.io.IOException
public static byte[] getAppBundleUninstallerICO() throws java.io.IOException
java.io.IOException
public static byte[] getAppBundleUninstallerPNG() throws java.io.IOException
java.io.IOException
public static java.lang.String getAppBundleVersion()
public static java.io.File getAppFolder()
public static java.lang.String getAppLaunchProperty(java.lang.String propertyName)
propertyName
- the name of the property to fetchpublic static java.net.Proxy getDefaultDetectedProxy()
public static java.lang.String getInstallType()
public static java.net.Proxy getJWrapperProxy()
public static JWProxyCredentials.Credentials getJWrapperProxyCredentials()
public static java.io.File getLauncherLocationForVirtualApp(java.io.File dir, java.lang.String shortcutName)
public static byte[] getMyAppLogoICO() throws java.io.IOException
java.io.IOException
public static byte[] getMyAppLogoPNG() throws java.io.IOException
java.io.IOException
public static java.lang.String getMyAppName()
public static java.io.File getMyJreHome()
public static java.io.File getMyLogFile()
public static java.io.File getNativeJavaLauncher()
public static java.lang.String getOsxAppDomainName()
public static java.util.Properties getPreparedForkProperties()
public static java.lang.String getSourceLauncherUpdateURL() throws java.io.IOException
java.io.IOException
public static java.lang.String[] getSupportedLanguages()
public static java.lang.String getUpdateURL()
public static void loadJWrapperProxies()
public static void main(java.lang.String[] args)
public static boolean matchingClientToServerVersion()
public static void overrideAppBundleUpdateURL(java.net.URL url) throws java.io.IOException
java.io.IOException
public static void overrideSourceLauncherUpdateURL(java.net.URL url) throws java.io.IOException
java.io.IOException
public static void prepareForkVirtualApp(java.lang.String virtualAppName, java.util.Properties launchProperties, java.lang.String[] commandLineArgs) throws java.lang.Exception
virtualAppName
- the name of the virtual app in this bundle to launchlaunchProperties
- the launch properties for the virtual appcommandLineArgs
- any additional command line args for the virtual app
java.lang.Exception
public static void prepareForkVirtualApp(java.lang.String virtualAppName, java.lang.String staticUpdateURL, java.util.Properties launchProperties, java.lang.String[] commandLineArgs, boolean elevateToAdmin, boolean checkForUpdateFirst) throws java.lang.Exception
virtualAppName
- staticUpdateURL
- launchProperties
- commandLineArgs
- elevateToAdmin
- checkForUpdateFirst
-
java.lang.Exception
public static void removeOverrideAppBundleUpdateURL()
public static java.io.File saveLauncherShortcutForVirtualApp(java.io.File dir, java.lang.String shortcutName, java.lang.String virtualAppName, java.util.Properties launchProperties, boolean elevateToAdmin) throws java.io.IOException
dir
- the folder to save the launcher inshortcutName
- the name of the app to save (excluding any extension)virtualAppName
- the virtual app to run or null if the launcher is to run the default or chooserlaunchProperties
- the launch properties to run the virtual app withelevateToAdmin
- whether the launcher should elevate before running the virtual app
java.io.IOException
public static void setCircularLogAreaBytes(long b)
b
- public static void setInitialLogAreaBytes(long b)
b
- public static void setLastUsedProxyAsDefault()