Class LaunchContextImpl
- java.lang.Object
-
- com.inductiveautomation.ignition.client.launch.LaunchContextImpl
-
- All Implemented Interfaces:
LaunchContext
public class LaunchContextImpl extends java.lang.Object implements LaunchContext
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.client.launch.LaunchContext
LaunchContext.WritableProject
-
-
Field Summary
-
Fields inherited from interface com.inductiveautomation.ignition.client.launch.LaunchContext
FRAMEWORK_ATTRIBUTE, SSO_PASSWORD, SSO_USERNAME
-
-
Constructor Summary
Constructors Constructor Description LaunchContextImpl(java.util.ResourceBundle bundle, LaunchSpec spec, java.io.File cacheDir, LaunchParent parent, java.util.Map<java.lang.String,java.lang.Object> attributes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
getAttribute(java.lang.String key)
A free-for-all map of objects that clients can use to communicate between launches.<T> T
getAttribute(java.lang.String key, T defaultValue)
java.util.Map<java.lang.String,java.lang.Object>
getAttributes()
Retrieves the raw attribute mapjava.util.ResourceBundle
getBundle()
java.io.File
getCacheDir()
The base of the cache dirs: %USER_HOME%/.ignition/cache/LaunchManifest
getDownloadRequiredManifest()
java.util.List<java.lang.String>
getEdgeFlags()
Currently should return an empty list if edition is not edge.GatewayAddress
getGatewayAddress()
java.util.List<GatewayAddress>
getGatewayAddresses()
java.io.File
getGwCacheDir()
The actual cache directory for the specific gateway that we ended up connecting to.LaunchManifest
getLaunchManifest()
This LaunchManifest is downloaded from the gateway during ConnectStep.java.io.PrintWriter
getLog()
A PrintWriter that steps can use to log their progress.java.lang.String
getLogContents()
java.lang.String
getMainClass()
The name of the class that should be started during StartupStepLaunchParent
getParent()
java.lang.String
getPlatformEdition()
The platform edition.java.io.File
getProjectCacheChkFile()
java.io.File
getProjectCacheFile()
java.io.File
getProjectCacheSignatureFile()
This is the project snapshot that we can send to the gw to get changes.java.lang.String
getProjectName()
The name of the project.java.io.File
getResourceDir()
The base of the cached resources: %USER_HOME%/.ignition/cache/resources/java.lang.String
getScopeCode()
java.io.File
getTranslationDBLocation()
Returns the location of the cached translation term db file.byte[]
getUserObject()
Returns a serialized user object (if any) that was passed as part of a restartvoid
log(java.lang.String message, java.lang.Object... args)
A shortcut for:void
setAttribute(java.lang.String key, java.lang.Object value)
void
setDownloadRequiredManifest(LaunchManifest downloadRequiredManifest)
void
setGatewayAddress(GatewayAddress gatewayAddress)
void
setGatewayAddresses(java.util.List<GatewayAddress> gatewayAddresses)
void
setGwCacheDir(java.io.File gwCacheDir)
void
setLaunchManifest(LaunchManifest launchManifest)
void
setTranDBLocation(java.io.File tranDBLocation)
void
updateGatewayAddressListCache(java.util.List<GatewayAddress> addrs)
Updates the cache with a list of gateway addresses that will be available for use next time this project is loaded.void
updateProjectCache(LaunchContext.WritableProject project)
This overload of updateProjectCache takes a WriteableProject, which lets the project be streamed.
-
-
-
Constructor Detail
-
LaunchContextImpl
public LaunchContextImpl(java.util.ResourceBundle bundle, LaunchSpec spec, java.io.File cacheDir, LaunchParent parent, java.util.Map<java.lang.String,java.lang.Object> attributes) throws LaunchException
- Throws:
LaunchException
-
-
Method Detail
-
getScopeCode
public java.lang.String getScopeCode()
- Specified by:
getScopeCode
in interfaceLaunchContext
-
getBundle
public java.util.ResourceBundle getBundle()
-
getCacheDir
public java.io.File getCacheDir()
Description copied from interface:LaunchContext
The base of the cache dirs: %USER_HOME%/.ignition/cache/- Specified by:
getCacheDir
in interfaceLaunchContext
-
getResourceDir
public java.io.File getResourceDir()
Description copied from interface:LaunchContext
The base of the cached resources: %USER_HOME%/.ignition/cache/resources/- Specified by:
getResourceDir
in interfaceLaunchContext
-
log
public void log(java.lang.String message, java.lang.Object... args)
Description copied from interface:LaunchContext
A shortcut for:getLog().printf(message, args); getLog().println();
- Specified by:
log
in interfaceLaunchContext
-
getLog
public java.io.PrintWriter getLog()
Description copied from interface:LaunchContext
A PrintWriter that steps can use to log their progress. Under normal conditions, this log is echoed to System.out. However, if an error ever occurs during the launch procedure, the entire contents of the log will be written to a launch crash file under the user's cache dir.- Specified by:
getLog
in interfaceLaunchContext
-
getLogContents
public java.lang.String getLogContents()
-
getTranslationDBLocation
public java.io.File getTranslationDBLocation()
Description copied from interface:LaunchContext
Returns the location of the cached translation term db file. The file will be in the form of "XXX_e{d}_v{d}.dat". The "e{d}" is the edit version, the "v{d}" is the serialization version.- Specified by:
getTranslationDBLocation
in interfaceLaunchContext
-
setTranDBLocation
public void setTranDBLocation(java.io.File tranDBLocation)
-
getLaunchManifest
public LaunchManifest getLaunchManifest()
Description copied from interface:LaunchContext
This LaunchManifest is downloaded from the gateway during ConnectStep. It describes all JAR files that will we'll need to start up the app of this context, including their CRC32 checksums. Will only be set after ConnectStep finishes.- Specified by:
getLaunchManifest
in interfaceLaunchContext
-
setLaunchManifest
public void setLaunchManifest(LaunchManifest launchManifest)
-
getDownloadRequiredManifest
public LaunchManifest getDownloadRequiredManifest()
-
setDownloadRequiredManifest
public void setDownloadRequiredManifest(LaunchManifest downloadRequiredManifest)
-
getGwCacheDir
public java.io.File getGwCacheDir()
Description copied from interface:LaunchContext
The actual cache directory for the specific gateway that we ended up connecting to. Only set after CacheStep runs. %USER_HOME%/.ignition/cache/gwHOST_HTTP_HTTPS_CONTEXT/Cx where "x" is the client ID that this JVM has claimed. Each JVM gets its own cache dir so that the they don't step on each other's toes when downloading/modifying jar files.- Specified by:
getGwCacheDir
in interfaceLaunchContext
-
setGwCacheDir
public void setGwCacheDir(java.io.File gwCacheDir)
-
getMainClass
public java.lang.String getMainClass()
Description copied from interface:LaunchContext
The name of the class that should be started during StartupStep- Specified by:
getMainClass
in interfaceLaunchContext
-
getGatewayAddresses
public java.util.List<GatewayAddress> getGatewayAddresses()
- Specified by:
getGatewayAddresses
in interfaceLaunchContext
-
setGatewayAddresses
public void setGatewayAddresses(java.util.List<GatewayAddress> gatewayAddresses)
-
updateGatewayAddressListCache
public void updateGatewayAddressListCache(java.util.List<GatewayAddress> addrs)
Description copied from interface:LaunchContext
Updates the cache with a list of gateway addresses that will be available for use next time this project is loaded. Should be update when the client receives notification that new cluster gateways have been added- Specified by:
updateGatewayAddressListCache
in interfaceLaunchContext
-
getGatewayAddress
public GatewayAddress getGatewayAddress()
- Specified by:
getGatewayAddress
in interfaceLaunchContext
-
setGatewayAddress
public void setGatewayAddress(GatewayAddress gatewayAddress)
-
getProjectName
public java.lang.String getProjectName()
Description copied from interface:LaunchContext
The name of the project. May not be used in all scopes- Specified by:
getProjectName
in interfaceLaunchContext
-
getPlatformEdition
public java.lang.String getPlatformEdition()
Description copied from interface:LaunchContext
The platform edition. Standard edition = "", Edge edition = "edge"- Specified by:
getPlatformEdition
in interfaceLaunchContext
-
getEdgeFlags
public java.util.List<java.lang.String> getEdgeFlags()
Description copied from interface:LaunchContext
Currently should return an empty list if edition is not edge.- Specified by:
getEdgeFlags
in interfaceLaunchContext
-
getProjectCacheFile
public java.io.File getProjectCacheFile()
- Specified by:
getProjectCacheFile
in interfaceLaunchContext
-
getProjectCacheChkFile
public java.io.File getProjectCacheChkFile()
- Specified by:
getProjectCacheChkFile
in interfaceLaunchContext
-
getProjectCacheSignatureFile
public java.io.File getProjectCacheSignatureFile()
This is the project snapshot that we can send to the gw to get changes.
-
updateProjectCache
public void updateProjectCache(LaunchContext.WritableProject project) throws java.io.IOException
Description copied from interface:LaunchContext
This overload of updateProjectCache takes a WriteableProject, which lets the project be streamed. We cannot remove the old byte[] version, because of re-targeting compatibility.- Specified by:
updateProjectCache
in interfaceLaunchContext
- Throws:
java.io.IOException
-
getParent
public LaunchParent getParent()
- Specified by:
getParent
in interfaceLaunchContext
-
getUserObject
public byte[] getUserObject()
Description copied from interface:LaunchContext
Returns a serialized user object (if any) that was passed as part of a restart- Specified by:
getUserObject
in interfaceLaunchContext
-
getAttribute
public <T> T getAttribute(java.lang.String key)
Description copied from interface:LaunchContext
A free-for-all map of objects that clients can use to communicate between launches. Beware that one should only store types is this map that are loaded by the system classloader - not custom objects. Any custom objects should be serialized to a byte[] first.- Specified by:
getAttribute
in interfaceLaunchContext
-
getAttribute
public <T> T getAttribute(java.lang.String key, T defaultValue)
- Specified by:
getAttribute
in interfaceLaunchContext
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.Object value)
- Specified by:
setAttribute
in interfaceLaunchContext
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Description copied from interface:LaunchContext
Retrieves the raw attribute map- Specified by:
getAttributes
in interfaceLaunchContext
-
-