Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / tools / admin / GenericApplication.java
blobcd62199e61fdceea36ee40e84e33290af74da3bb
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;
13 import java.io.File;
14 import java.io.IOException;
15 import java.io.PrintWriter;
16 import java.util.List;
18 /**
19 * An App Engine application (may be Java/Python).
22 public interface GenericApplication {
24 /**
25 * Returns the application identifier
26 * @return application identifier
28 String getAppId();
30 /**
31 * Returns the application version
32 * @return application version
34 String getVersion();
36 /**
37 * Returns the application source-language or null if not specified.
39 String getSourceLanguage();
41 /**
42 * Returns the application module name or null if not specified.
44 String getModule();
46 /**
47 * Returns the application instance class name or null if not specified.
49 String getInstanceClass();
51 /**
52 * Returns whether precompilation is enabled for this application
53 * @return precompilation setting
55 boolean isPrecompilationEnabled();
57 /**
58 * Returns the list of error handlers for this application
59 * @return error handlers
61 List<ErrorHandler> getErrorHandlers();
63 /**
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);
69 /**
70 * Returns the CronXml describing the applications' cron jobs.
71 * @return a cron descriptor, possibly empty or {@code null}
73 CronXml getCronXml();
75 /**
76 * Returns the QueueXml describing the applications' task queues.
77 * @return a queue descriptor, possibly empty or {@code null}
79 QueueXml getQueueXml();
81 /**
82 * Returns the possibly empty {@link DispatchXml} descriptor for this
83 * application or null if none is configured.
85 DispatchXml getDispatchXml();
87 /**
88 * Returns the DosXml describing the applications' DoS entries.
89 * @return a dos descriptor, possibly empty or {@code null}
91 DosXml getDosXml();
93 /**
94 * Returns a string containing the applications' pagespeed.yaml configuration.
95 * @return a pagespeed.yaml config, possibly empty or {@code null}
97 String getPagespeedYaml();
99 /**
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
125 String getPath();
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;
159 * Generates source context file in the staging directory.
161 * <p>Does nothing if the source directory is not in a Git repo or if the source context file
162 * already exists. If the operation fails, this function logs and continues. The deployment
163 * is never blocked if we can't generate the source context file.
165 void exportRepoInfoFile();
167 /** deletes the staging directory, if one was created. */
168 void cleanStagingDirectory();
170 void setListener(UpdateListener l);
172 void setDetailsWriter(PrintWriter detailsWriter);
174 void statusUpdate(String message, int amount);
176 void statusUpdate(String message);
179 * Returns the yaml string describing this application's configuration.
180 * @return application configuration yaml string
182 String getAppYaml();
185 * Interface describing the application's error handlers.
187 public interface ErrorHandler {
188 /** Returns the not {@code null} error handler file name. */
189 String getFile();
190 /** Returns the error code, possibly {@code null}. */
191 String getErrorCode();
192 /** Returns the not {@code null} error handler mime-type. */
193 String getMimeType();