1 // Copyright 2011 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.tools
.admin
;
5 import com
.google
.appengine
.tools
.admin
.AppAdminFactory
.ApplicationProcessingOptions
;
6 import com
.google
.apphosting
.utils
.config
.BackendsXml
;
7 import com
.google
.apphosting
.utils
.config
.CronXml
;
8 import com
.google
.apphosting
.utils
.config
.DosXml
;
9 import com
.google
.apphosting
.utils
.config
.IndexesXml
;
10 import com
.google
.apphosting
.utils
.config
.QueueXml
;
13 import java
.io
.IOException
;
14 import java
.io
.PrintWriter
;
15 import java
.util
.List
;
18 * An App Engine application (may be Java/Python).
21 public interface GenericApplication
{
24 * Returns the application identifier
25 * @return application identifier
27 public abstract String
getAppId();
30 * Returns the application version
31 * @return application version
33 public abstract String
getVersion();
36 * Returns the application source-language or null if not specified.
38 public abstract String
getSourceLanguage();
41 * Returns the application server name or null if not specified.
43 public abstract String
getServer();
46 * Returns whether precompilation is enabled for this application
47 * @return precompilation setting
49 public abstract boolean isPrecompilationEnabled();
52 * Returns the list of error handlers for this application
53 * @return error handlers
55 public abstract List
<ErrorHandler
> getErrorHandlers();
58 * Returns the mime-type if path corresponds to static content, {@code null} otherwise.
59 * @return mime-type, possibly {@code null}
61 public abstract String
getMimeTypeIfStatic(String path
);
64 * Returns the CronXml describing the applications' cron jobs.
65 * @return a cron descriptor, possibly empty or {@code null}
67 public abstract CronXml
getCronXml();
70 * Returns the QueueXml describing the applications' task queues.
71 * @return a queue descriptor, possibly empty or {@code null}
73 public abstract QueueXml
getQueueXml();
76 * Returns the DosXml describing the applications' DoS entries.
77 * @return a dos descriptor, possibly empty or {@code null}
79 public abstract DosXml
getDosXml();
82 * Returns a string containing the applications' pagespeed.yaml configuration.
83 * @return a pagespeed.yaml config, possibly empty or {@code null}
85 public abstract String
getPagespeedYaml();
88 * Returns the IndexesXml describing the applications' indexes.
89 * @return an indexes descriptor, possibly empty or {@code null}
91 public abstract IndexesXml
getIndexesXml();
94 * Returns the BackendsXml describing the applications' backends.
95 * @return a backends descriptor, possibly empty or {@code null}
97 public abstract BackendsXml
getBackendsXml();
100 * Returns the desired API version for the current application, or
101 * {@code "none"} if no API version was used.
103 * @throws IllegalStateException if createStagingDirectory has not been called.
105 public abstract String
getApiVersion();
108 * Returns a path to an exploded WAR directory for the application.
109 * This may be a temporary directory.
111 * @return a not {@code null} path pointing to a directory
113 public abstract String
getPath();
116 * Returns the staging directory, or {@code null} if none has been created.
118 public abstract File
getStagingDir();
120 public abstract void resetProgress();
123 * Creates a new staging directory, if needed, or returns the existing one
124 * if already created.
126 * @param opts User-specified options for processing the application.
127 * @param resourceLimits Various resource limits provided by the cloud.
128 * @return staging directory
129 * @throws IOException
131 public abstract File
createStagingDirectory(ApplicationProcessingOptions opts
,
132 ResourceLimits resourceLimits
) throws IOException
;
134 /** deletes the staging directory, if one was created. */
135 public abstract void cleanStagingDirectory();
137 public abstract void setListener(UpdateListener l
);
139 public abstract void setDetailsWriter(PrintWriter detailsWriter
);
141 public abstract void statusUpdate(String message
, int amount
);
143 public abstract void statusUpdate(String message
);
146 * Returns the yaml string describing this application's configuration.
147 * @return application configuration yaml string
149 public abstract String
getAppYaml();
152 * Interface describing the application's error handlers.
154 public interface ErrorHandler
{
155 /** Returns the not {@code null} error handler file name. */
156 public abstract String
getFile();
157 /** Returns the error code, possibly {@code null}. */
158 public abstract String
getErrorCode();
159 /** Returns the not {@code null} error handler mime-type. */
160 public abstract String
getMimeType();