Package com.google.appengine.tools.admin
Class Application
java.lang.Object
com.google.appengine.tools.admin.Application
- All Implemented Interfaces:
GenericApplication
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.appengine.tools.admin.GenericApplication
GenericApplication.ErrorHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeletes the staging directory, if one was created.Creates a new staging directory, if needed, or returns the existing one if already created.createStagingDirectory(ApplicationProcessingOptions opts, File stagingDir) Populates and creates (if necessary) a user specified, staging directoryvoidGenerates source context file in the staging directory.Returns the desired API version for the current application, or"none"if no API version was used.com.google.apphosting.utils.config.AppEngineWebXmlReturns the AppEngineWebXml describing the application.getAppId()Returns the application identifier, from the AppEngineWebXml configReturns the app.yaml string.com.google.apphosting.utils.config.BackendsXmlReturns the BackendsXml describing the applications' backends.com.google.apphosting.utils.config.CronXmlReturns the CronXml describing the applications' cron jobs.com.google.apphosting.utils.config.DispatchXmlReturns the possibly emptyDispatchXmldescriptor for this application or null if none is configured.com.google.apphosting.utils.config.DosXmlReturns the DosXml describing the applications' DoS entries.Returns the list of error handlers for this applicationcom.google.apphosting.utils.config.IndexesXmlReturns the IndexesXml describing the applications' indexes.Returns the application instance class name or null if not specified.getMimeTypeIfStatic(String path) Returns the mime-type if path corresponds to static content,nullotherwise.Returns the application module name or null if not specified.getPath()Returns a path to an exploded WAR directory for the application.com.google.apphosting.utils.config.QueueXmlReturns the QueueXml describing the applications' task queues.Returns the desired runtime for the current application.com.google.apphosting.utils.config.AppEngineWebXmlModified app.yaml for Cloud SDK deployment.static FileReturns the staging directory, ornullif none has been created.com.google.apphosting.utils.config.StagingOptionsGets the effective staging options from global defaults, appengine-web.xml and flags, in ascending order of precedence.Returns the application version, from the AppEngineWebXml configcom.google.apphosting.utils.config.WebXmlReturns the WebXml describing the applications' servlets and generic web application information.static StringguessContentTypeFromName(String fileName) booleanReturns whether precompilation is enabled for this applicationstatic ApplicationreadApplication(String path) Reads the App Engine application frompath.static ApplicationreadApplication(String path, com.google.appengine.tools.admin.RepoInfo.SourceContext sourceContext) Reads the App Engine application frompath.static ApplicationreadApplication(String path, String appId, String module, String appVersion) Reads the App Engine application frompath.static voidrecursiveDelete(File dead) Recursive directory deletion.voidvoidsetDetailsWriter(PrintWriter detailsWriter) voidsetExternalResourceDir(String path) Sets the external resource directory.voidvoidstatusUpdate(String message) voidstatusUpdate(String message, int amount)
-
Constructor Details
-
Application
protected Application()
-
-
Method Details
-
getSdkDocsDir
-
readApplication
Reads the App Engine application frompath. The path may either be a WAR file or the root of an exploded WAR directory.- Parameters:
path- a notnullpath.- Throws:
IOException- if an error occurs while trying to read theApplication.com.google.apphosting.utils.config.AppEngineConfigException- if theApplication'sappengine-web.xml file is malformed.
-
readApplication
public static Application readApplication(String path, com.google.appengine.tools.admin.RepoInfo.SourceContext sourceContext) throws IOException Reads the App Engine application frompath. The path may either be a WAR file or the root of an exploded WAR directory.- Parameters:
path- a notnullpath.sourceContext- an explicit RepoInfo.SourceContext. Ifnull, the source context will be inferred from the current directory.- Throws:
IOException- if an error occurs while trying to read theApplication.com.google.apphosting.utils.config.AppEngineConfigException- if theApplication'sappengine-web.xml file is malformed.
-
setExternalResourceDir
Sets the external resource directory. Call this method before invokingcreateStagingDirectory(ApplicationProcessingOptions).The external resource directory is a directory outside of the war directory where additional files live. These files will be copied into the staging directory during an upload, after the war directory is copied there. Consequently if there are any name collisions the files in the external resource directory will win.
- Parameters:
path- a notnullpath to an existing directory.- Throws:
IllegalArgumentException- Ifpathdoes not refer to an existing directory.
-
readApplication
public static Application readApplication(String path, String appId, String module, String appVersion) throws IOException Reads the App Engine application frompath. The path may either be a WAR file or the root of an exploded WAR directory.- Parameters:
path- a notnullpath.appId- if non-null, use this as an application id override.module- if non-null, use this as a module id override.appVersion- if non-null, use this as an application version override.- Throws:
IOException- if an error occurs while trying to read theApplication.com.google.apphosting.utils.config.AppEngineConfigException- if theApplication'sappengine-web.xml file is malformed.
-
getAppId
Returns the application identifier, from the AppEngineWebXml config- Specified by:
getAppIdin interfaceGenericApplication- Returns:
- application identifier
-
getVersion
Returns the application version, from the AppEngineWebXml config- Specified by:
getVersionin interfaceGenericApplication- Returns:
- application version
-
getModule
Description copied from interface:GenericApplicationReturns the application module name or null if not specified.- Specified by:
getModulein interfaceGenericApplication
-
getInstanceClass
Description copied from interface:GenericApplicationReturns the application instance class name or null if not specified.- Specified by:
getInstanceClassin interfaceGenericApplication
-
isPrecompilationEnabled
public boolean isPrecompilationEnabled()Description copied from interface:GenericApplicationReturns whether precompilation is enabled for this application- Specified by:
isPrecompilationEnabledin interfaceGenericApplication- Returns:
- precompilation setting
-
getErrorHandlers
Description copied from interface:GenericApplicationReturns the list of error handlers for this application- Specified by:
getErrorHandlersin interfaceGenericApplication- Returns:
- error handlers
-
getMimeTypeIfStatic
Description copied from interface:GenericApplicationReturns the mime-type if path corresponds to static content,nullotherwise.- Specified by:
getMimeTypeIfStaticin interfaceGenericApplication- Returns:
- mime-type, possibly
null
-
guessContentTypeFromName
- Parameters:
fileName- path of a file with extension- Returns:
- the mimetype of the file (or application/octect-stream if not recognized)
-
getAppEngineWebXml
public com.google.apphosting.utils.config.AppEngineWebXml getAppEngineWebXml()Returns the AppEngineWebXml describing the application.- Returns:
- a not
nulldeployment descriptor
-
getScrubbedAppEngineWebXml
public com.google.apphosting.utils.config.AppEngineWebXml getScrubbedAppEngineWebXml()Modified app.yaml for Cloud SDK deployment. This method is not called for App Engine Classic deployment, and called only for the "stage" command. Replaces module to service and clears out the application/version params.- Returns:
- a not
nulldeployment descriptor
-
getCronXml
public com.google.apphosting.utils.config.CronXml getCronXml()Returns the CronXml describing the applications' cron jobs.- Specified by:
getCronXmlin interfaceGenericApplication- Returns:
- a cron descriptor, possibly empty or
null
-
getQueueXml
public com.google.apphosting.utils.config.QueueXml getQueueXml()Returns the QueueXml describing the applications' task queues.- Specified by:
getQueueXmlin interfaceGenericApplication- Returns:
- a queue descriptor, possibly empty or
null
-
getDispatchXml
public com.google.apphosting.utils.config.DispatchXml getDispatchXml()Description copied from interface:GenericApplicationReturns the possibly emptyDispatchXmldescriptor for this application or null if none is configured.- Specified by:
getDispatchXmlin interfaceGenericApplication
-
getDosXml
public com.google.apphosting.utils.config.DosXml getDosXml()Returns the DosXml describing the applications' DoS entries.- Specified by:
getDosXmlin interfaceGenericApplication- Returns:
- a dos descriptor, possibly empty or
null
-
getIndexesXml
public com.google.apphosting.utils.config.IndexesXml getIndexesXml()Returns the IndexesXml describing the applications' indexes.- Specified by:
getIndexesXmlin interfaceGenericApplication- Returns:
- a index descriptor, possibly empty or
null
-
getWebXml
public com.google.apphosting.utils.config.WebXml getWebXml()Returns the WebXml describing the applications' servlets and generic web application information.- Returns:
- a WebXml descriptor, possibly empty but not
null
-
getBackendsXml
public com.google.apphosting.utils.config.BackendsXml getBackendsXml()Description copied from interface:GenericApplicationReturns the BackendsXml describing the applications' backends.- Specified by:
getBackendsXmlin interfaceGenericApplication- Returns:
- a backends descriptor, possibly empty or
null
-
getApiVersion
Returns the desired API version for the current application, or"none"if no API version was used.- Specified by:
getApiVersionin interfaceGenericApplication- Throws:
IllegalStateException- if createStagingDirectory has not been called.
-
getRuntime
Returns the desired runtime for the current application.- Specified by:
getRuntimein interfaceGenericApplication- Throws:
IllegalStateException- if createStagingDirectory has not been called.
-
getPath
Returns a path to an exploded WAR directory for the application. This may be a temporary directory.- Specified by:
getPathin interfaceGenericApplication- Returns:
- a not
nullpath pointing to a directory
-
getStagingDir
Returns the staging directory, ornullif none has been created.- Specified by:
getStagingDirin interfaceGenericApplication
-
resetProgress
public void resetProgress()- Specified by:
resetProgressin interfaceGenericApplication
-
getStagingOptions
public com.google.apphosting.utils.config.StagingOptions getStagingOptions(ApplicationProcessingOptions opts) Gets the effective staging options from global defaults, appengine-web.xml and flags, in ascending order of precedence. For instance, a flag overrides a value of appengine-web.xml.- Parameters:
opts- User-specified options for processing the application.- Returns:
- StagingOptions a complete object respecting the precedence in assignment
-
createStagingDirectory
Creates a new staging directory, if needed, or returns the existing one if already created.- Specified by:
createStagingDirectoryin interfaceGenericApplication- Parameters:
opts- User-specified options for processing the application.- Returns:
- staging directory
- Throws:
IOException
-
createStagingDirectory
public File createStagingDirectory(ApplicationProcessingOptions opts, File stagingDir) throws IOException Populates and creates (if necessary) a user specified, staging directory- Specified by:
createStagingDirectoryin interfaceGenericApplication- Parameters:
opts- User-specified options for processing the application.stagingDir- User-specified staging directory (must be empty or not exist)- Returns:
- staging directory
- Throws:
IOException- if an error occurs trying to create or populate the staging directory
-
exportRepoInfoFile
public void exportRepoInfoFile()Description copied from interface:GenericApplicationGenerates source context file in the staging directory.Does nothing if the source directory is not in a Git repo or if the source context file already exists. If the operation fails, this function logs and continues. The deployment is never blocked if we can't generate the source context file.
- Specified by:
exportRepoInfoFilein interfaceGenericApplication
-
cleanStagingDirectory
public void cleanStagingDirectory()deletes the staging directory, if one was created.- Specified by:
cleanStagingDirectoryin interfaceGenericApplication
-
recursiveDelete
Recursive directory deletion. -
setListener
- Specified by:
setListenerin interfaceGenericApplication
-
setDetailsWriter
- Specified by:
setDetailsWriterin interfaceGenericApplication
-
statusUpdate
- Specified by:
statusUpdatein interfaceGenericApplication
-
statusUpdate
- Specified by:
statusUpdatein interfaceGenericApplication
-
getAppYaml
Returns the app.yaml string.- Specified by:
getAppYamlin interfaceGenericApplication- Returns:
- application configuration yaml string
- Throws:
IllegalStateException- if createStagingDirectory has not been called.
-