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
.DispatchXml
;
9 import com
.google
.apphosting
.utils
.config
.DosXml
;
10 import com
.google
.apphosting
.utils
.config
.IndexesXml
;
11 import com
.google
.apphosting
.utils
.config
.QueueXml
;
14 import java
.io
.IOException
;
15 import java
.io
.PrintWriter
;
16 import java
.util
.List
;
19 * An App Engine application (may be Java/Python).
22 public interface GenericApplication
{
25 * Returns the application identifier
26 * @return application identifier
31 * Returns the application version
32 * @return application version
37 * Returns the application source-language or null if not specified.
39 String
getSourceLanguage();
42 * Returns the application module name or null if not specified.
47 * Returns the application instance class name or null if not specified.
49 String
getInstanceClass();
52 * Returns whether precompilation is enabled for this application
53 * @return precompilation setting
55 boolean isPrecompilationEnabled();
58 * Returns the list of error handlers for this application
59 * @return error handlers
61 List
<ErrorHandler
> getErrorHandlers();
64 * Returns the mime-type if path corresponds to static content, {@code null} otherwise.
65 * @return mime-type, possibly {@code null}
67 String
getMimeTypeIfStatic(String path
);
70 * Returns the CronXml describing the applications' cron jobs.
71 * @return a cron descriptor, possibly empty or {@code null}
76 * Returns the QueueXml describing the applications' task queues.
77 * @return a queue descriptor, possibly empty or {@code null}
79 QueueXml
getQueueXml();
82 * Returns the possibly empty {@link DispatchXml} descriptor for this
83 * application or null if none is configured.
85 DispatchXml
getDispatchXml();
88 * Returns the DosXml describing the applications' DoS entries.
89 * @return a dos descriptor, possibly empty or {@code null}
94 * Returns a string containing the applications' pagespeed.yaml configuration.
95 * @return a pagespeed.yaml config, possibly empty or {@code null}
97 String
getPagespeedYaml();
100 * Returns the IndexesXml describing the applications' indexes.
101 * @return an indexes descriptor, possibly empty or {@code null}
103 IndexesXml
getIndexesXml();
106 * Returns the BackendsXml describing the applications' backends.
107 * @return a backends descriptor, possibly empty or {@code null}
109 BackendsXml
getBackendsXml();
112 * Returns the desired API version for the current application, or
113 * {@code "none"} if no API version was used.
115 * @throws IllegalStateException if createStagingDirectory has not been called.
117 String
getApiVersion();
120 * Returns a path to an exploded WAR directory for the application.
121 * This may be a temporary directory.
123 * @return a not {@code null} path pointing to a directory
128 * Returns the staging directory, or {@code null} if none has been created.
130 File
getStagingDir();
132 void resetProgress();
135 * Creates a new staging directory, if needed, or returns the existing one
136 * if already created.
138 * @param opts User-specified options for processing the application.
139 * @param resourceLimits Various resource limits provided by the cloud.
140 * @return staging directory
141 * @throws IOException
143 File
createStagingDirectory(ApplicationProcessingOptions opts
,
144 ResourceLimits resourceLimits
) throws IOException
;
147 * Creates (if necessary) and populates a user specified staging directory
149 * @param opts User-specified options for processing the application.
150 * @param resourceLimits Various resource limits provided by the cloud.
151 * @param stagingDir User-specified staging directory (must be empty or not exist)
152 * @return staging directory
153 * @throws IOException if an error occurs trying to create or populate the staging directory
155 File
createStagingDirectory(ApplicationProcessingOptions opts
,
156 ResourceLimits resourceLimits
, File stagingDir
) throws IOException
;
158 /** deletes the staging directory, if one was created. */
159 void cleanStagingDirectory();
161 void setListener(UpdateListener l
);
163 void setDetailsWriter(PrintWriter detailsWriter
);
165 void statusUpdate(String message
, int amount
);
167 void statusUpdate(String message
);
170 * Returns the yaml string describing this application's configuration.
171 * @return application configuration yaml string
176 * Interface describing the application's error handlers.
178 public interface ErrorHandler
{
179 /** Returns the not {@code null} error handler file name. */
181 /** Returns the error code, possibly {@code null}. */
182 String
getErrorCode();
183 /** Returns the not {@code null} error handler mime-type. */
184 String
getMimeType();