public class Application extends Object implements GenericApplication
GenericApplication.ErrorHandler| Modifier | Constructor and Description |
|---|---|
protected |
Application() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanStagingDirectory()
deletes the staging directory, if one was created.
|
File |
createStagingDirectory(ApplicationProcessingOptions opts)
Creates a new staging directory, if needed, or returns the existing one if already created.
|
File |
createStagingDirectory(ApplicationProcessingOptions opts,
File stagingDir)
Populates and creates (if necessary) a user specified, staging directory
|
void |
exportRepoInfoFile()
Generates source context file in the staging directory.
|
String |
getApiVersion()
Returns the desired API version for the current application, or
"none" if no API
version was used. |
com.google.apphosting.utils.config.AppEngineWebXml |
getAppEngineWebXml()
Returns the AppEngineWebXml describing the application.
|
String |
getAppId()
Returns the application identifier, from the AppEngineWebXml config
|
String |
getAppYaml()
Returns the app.yaml string.
|
com.google.apphosting.utils.config.BackendsXml |
getBackendsXml()
Returns the BackendsXml describing the applications' backends.
|
com.google.apphosting.utils.config.CronXml |
getCronXml()
Returns the CronXml describing the applications' cron jobs.
|
com.google.apphosting.utils.config.DispatchXml |
getDispatchXml()
Returns the possibly empty
DispatchXml descriptor for this
application or null if none is configured. |
com.google.apphosting.utils.config.DosXml |
getDosXml()
Returns the DosXml describing the applications' DoS entries.
|
List<GenericApplication.ErrorHandler> |
getErrorHandlers()
Returns the list of error handlers for this application
|
com.google.apphosting.utils.config.IndexesXml |
getIndexesXml()
Returns the IndexesXml describing the applications' indexes.
|
String |
getInstanceClass()
Returns the application instance class name or null if not specified.
|
String |
getMimeTypeIfStatic(String path)
Returns the mime-type if path corresponds to static content,
null otherwise. |
String |
getModule()
Returns the application module name or null if not specified.
|
String |
getPath()
Returns a path to an exploded WAR directory for the application.
|
com.google.apphosting.utils.config.QueueXml |
getQueueXml()
Returns the QueueXml describing the applications' task queues.
|
String |
getRuntime()
Returns the desired runtime for the current application.
|
com.google.apphosting.utils.config.AppEngineWebXml |
getScrubbedAppEngineWebXml()
Modified app.yaml for Cloud SDK deployment.
|
static File |
getSdkDocsDir() |
static com.google.appengine.tools.info.Version |
getSdkVersion() |
File |
getStagingDir()
Returns the staging directory, or
null if none has been created. |
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.
|
String |
getVersion()
Returns the application version, from the AppEngineWebXml config
|
com.google.apphosting.utils.config.WebXml |
getWebXml()
Returns the WebXml describing the applications' servlets and generic web application
information.
|
static String |
guessContentTypeFromName(String fileName) |
boolean |
isPrecompilationEnabled()
Returns whether precompilation is enabled for this application
|
static Application |
readApplication(String path)
Reads the App Engine application from
path. |
static Application |
readApplication(String path,
com.google.appengine.tools.admin.RepoInfo.SourceContext sourceContext)
Reads the App Engine application from
path. |
static Application |
readApplication(String path,
String appId,
String module,
String appVersion)
Reads the App Engine application from
path. |
static void |
recursiveDelete(File dead)
Recursive directory deletion.
|
void |
resetProgress() |
void |
setDetailsWriter(PrintWriter detailsWriter) |
void |
setExternalResourceDir(String path)
Sets the external resource directory.
|
void |
setListener(UpdateListener l) |
void |
statusUpdate(String message) |
void |
statusUpdate(String message,
int amount) |
public static File getSdkDocsDir()
public static com.google.appengine.tools.info.Version getSdkVersion()
public static Application readApplication(String path) throws IOException
path. The path may either be a WAR file or the
root of an exploded WAR directory.path - a not null path.IOException - if an error occurs while trying to read the Application.com.google.apphosting.utils.config.AppEngineConfigException - if the Application's appengine-web.xml file is malformed.public static Application readApplication(String path, com.google.appengine.tools.admin.RepoInfo.SourceContext sourceContext) throws IOException
path. The path may either be a WAR file or the
root of an exploded WAR directory.path - a not null path.sourceContext - an explicit RepoInfo.SourceContext. If null, the source context
will be inferred from the current directory.IOException - if an error occurs while trying to read the Application.com.google.apphosting.utils.config.AppEngineConfigException - if the Application's appengine-web.xml file is malformed.public void setExternalResourceDir(String path)
createStagingDirectory(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.
path - a not null path to an existing directory.IllegalArgumentException - If path does not refer to an existing directory.public static Application readApplication(String path, String appId, String module, String appVersion) throws IOException
path. The path may either be a WAR file or the
root of an exploded WAR directory.path - a not null path.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.IOException - if an error occurs while trying to read the Application.com.google.apphosting.utils.config.AppEngineConfigException - if the Application's appengine-web.xml file is malformed.public String getAppId()
getAppId in interface GenericApplicationpublic String getVersion()
getVersion in interface GenericApplicationpublic String getModule()
GenericApplicationgetModule in interface GenericApplicationpublic String getInstanceClass()
GenericApplicationgetInstanceClass in interface GenericApplicationpublic boolean isPrecompilationEnabled()
GenericApplicationisPrecompilationEnabled in interface GenericApplicationpublic List<GenericApplication.ErrorHandler> getErrorHandlers()
GenericApplicationgetErrorHandlers in interface GenericApplicationpublic String getMimeTypeIfStatic(String path)
GenericApplicationnull otherwise.getMimeTypeIfStatic in interface GenericApplicationnullpublic static String guessContentTypeFromName(String fileName)
fileName - path of a file with extensionpublic com.google.apphosting.utils.config.AppEngineWebXml getAppEngineWebXml()
null deployment descriptorpublic com.google.apphosting.utils.config.AppEngineWebXml getScrubbedAppEngineWebXml()
null deployment descriptorpublic com.google.apphosting.utils.config.CronXml getCronXml()
getCronXml in interface GenericApplicationnullpublic com.google.apphosting.utils.config.QueueXml getQueueXml()
getQueueXml in interface GenericApplicationnullpublic com.google.apphosting.utils.config.DispatchXml getDispatchXml()
GenericApplicationDispatchXml descriptor for this
application or null if none is configured.getDispatchXml in interface GenericApplicationpublic com.google.apphosting.utils.config.DosXml getDosXml()
getDosXml in interface GenericApplicationnullpublic com.google.apphosting.utils.config.IndexesXml getIndexesXml()
getIndexesXml in interface GenericApplicationnullpublic com.google.apphosting.utils.config.WebXml getWebXml()
nullpublic com.google.apphosting.utils.config.BackendsXml getBackendsXml()
GenericApplicationgetBackendsXml in interface GenericApplicationnullpublic String getApiVersion()
"none" if no API
version was used.getApiVersion in interface GenericApplicationIllegalStateException - if createStagingDirectory has not been called.public String getRuntime()
getRuntime in interface GenericApplicationIllegalStateException - if createStagingDirectory has not been called.public String getPath()
getPath in interface GenericApplicationnull path pointing to a directorypublic File getStagingDir()
null if none has been created.getStagingDir in interface GenericApplicationpublic void resetProgress()
resetProgress in interface GenericApplicationpublic com.google.apphosting.utils.config.StagingOptions getStagingOptions(ApplicationProcessingOptions opts)
opts - User-specified options for processing the application.public File createStagingDirectory(ApplicationProcessingOptions opts) throws IOException
createStagingDirectory in interface GenericApplicationopts - User-specified options for processing the application.IOExceptionpublic File createStagingDirectory(ApplicationProcessingOptions opts, File stagingDir) throws IOException
createStagingDirectory in interface GenericApplicationopts - User-specified options for processing the application.stagingDir - User-specified staging directory (must be empty or not exist)IOException - if an error occurs trying to create or populate the staging directorypublic void exportRepoInfoFile()
GenericApplicationDoes 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.
exportRepoInfoFile in interface GenericApplicationpublic void cleanStagingDirectory()
cleanStagingDirectory in interface GenericApplicationpublic static void recursiveDelete(File dead)
public void setListener(UpdateListener l)
setListener in interface GenericApplicationpublic void setDetailsWriter(PrintWriter detailsWriter)
setDetailsWriter in interface GenericApplicationpublic void statusUpdate(String message, int amount)
statusUpdate in interface GenericApplicationpublic void statusUpdate(String message)
statusUpdate in interface GenericApplicationpublic String getAppYaml()
getAppYaml in interface GenericApplicationIllegalStateException - if createStagingDirectory has not been called.Copyright © 2022. All rights reserved.