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 the application instance class name or null if not specified.
48 public abstract String
getInstanceClass();
51 * Returns whether precompilation is enabled for this application
52 * @return precompilation setting
54 public abstract boolean isPrecompilationEnabled();
57 * Returns the list of error handlers for this application
58 * @return error handlers
60 public abstract List
<ErrorHandler
> getErrorHandlers();
63 * Returns the mime-type if path corresponds to static content, {@code null} otherwise.
64 * @return mime-type, possibly {@code null}
66 public abstract String
getMimeTypeIfStatic(String path
);
69 * Returns the CronXml describing the applications' cron jobs.
70 * @return a cron descriptor, possibly empty or {@code null}
72 public abstract CronXml
getCronXml();
75 * Returns the QueueXml describing the applications' task queues.
76 * @return a queue descriptor, possibly empty or {@code null}
78 public abstract QueueXml
getQueueXml();
81 * Returns the DosXml describing the applications' DoS entries.
82 * @return a dos descriptor, possibly empty or {@code null}
84 public abstract DosXml
getDosXml();
87 * Returns a string containing the applications' pagespeed.yaml configuration.
88 * @return a pagespeed.yaml config, possibly empty or {@code null}
90 public abstract String
getPagespeedYaml();
93 * Returns the IndexesXml describing the applications' indexes.
94 * @return an indexes descriptor, possibly empty or {@code null}
96 public abstract IndexesXml
getIndexesXml();
99 * Returns the BackendsXml describing the applications' backends.
100 * @return a backends descriptor, possibly empty or {@code null}
102 public abstract BackendsXml
getBackendsXml();
105 * Returns the desired API version for the current application, or
106 * {@code "none"} if no API version was used.
108 * @throws IllegalStateException if createStagingDirectory has not been called.
110 public abstract String
getApiVersion();
113 * Returns a path to an exploded WAR directory for the application.
114 * This may be a temporary directory.
116 * @return a not {@code null} path pointing to a directory
118 public abstract String
getPath();
121 * Returns the staging directory, or {@code null} if none has been created.
123 public abstract File
getStagingDir();
125 public abstract void resetProgress();
128 * Creates a new staging directory, if needed, or returns the existing one
129 * if already created.
131 * @param opts User-specified options for processing the application.
132 * @param resourceLimits Various resource limits provided by the cloud.
133 * @return staging directory
134 * @throws IOException
136 public abstract File
createStagingDirectory(ApplicationProcessingOptions opts
,
137 ResourceLimits resourceLimits
) throws IOException
;
139 /** deletes the staging directory, if one was created. */
140 public abstract void cleanStagingDirectory();
142 public abstract void setListener(UpdateListener l
);
144 public abstract void setDetailsWriter(PrintWriter detailsWriter
);
146 public abstract void statusUpdate(String message
, int amount
);
148 public abstract void statusUpdate(String message
);
151 * Returns the yaml string describing this application's configuration.
152 * @return application configuration yaml string
154 public abstract String
getAppYaml();
157 * Interface describing the application's error handlers.
159 public interface ErrorHandler
{
160 /** Returns the not {@code null} error handler file name. */
161 public abstract String
getFile();
162 /** Returns the error code, possibly {@code null}. */
163 public abstract String
getErrorCode();
164 /** Returns the not {@code null} error handler mime-type. */
165 public abstract String
getMimeType();