Package com.google.cloud.tools.appengine
Class AppEngineDescriptor
- java.lang.Object
-
- com.google.cloud.tools.appengine.AppEngineDescriptor
-
public class AppEngineDescriptor extends Object
Utilities to obtain information from appengine-web.xml.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AppEngineDescriptor(Document document)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
getEnvironment()
Given the following structure:String
getProjectId()
Returns project ID from the <application> element of the appengine-web.xml or null if it is missing.String
getProjectVersion()
Returns project version from the <version> element of the appengine-web.xml or null if it is missing.String
getRuntime()
Returns runtime from the <runtime> element of the appengine-web.xml or the default one when it is missing.String
getServiceId()
Returns service ID from the <service> element of the appengine-web.xml, or null if it is missing.boolean
isJava8()
Returns true if the runtime read from appengine-web.xml is Java8.boolean
isSandboxEnforced()
Returns true if the runtime needs to enforce original sandbox restrictions (for example, the Java7 runtime).static AppEngineDescriptor
parse(InputStream in)
Parses an appengine-web.xml file.
-
-
-
Constructor Detail
-
AppEngineDescriptor
protected AppEngineDescriptor(Document document)
-
-
Method Detail
-
parse
public static AppEngineDescriptor parse(InputStream in) throws IOException, SAXException
Parses an appengine-web.xml file.- Parameters:
in
- the contents of appengine-web.xml- Returns:
- a fully parsed object that can be queried
- Throws:
IOException
- if parsing fails due to I/O errorsSAXException
- malformed XML
-
getProjectId
@Nullable public String getProjectId() throws AppEngineException
Returns project ID from the <application> element of the appengine-web.xml or null if it is missing.- Throws:
AppEngineException
-
getRuntime
public String getRuntime() throws AppEngineException
Returns runtime from the <runtime> element of the appengine-web.xml or the default one when it is missing.- Throws:
AppEngineException
-
getProjectVersion
@Nullable public String getProjectVersion() throws AppEngineException
Returns project version from the <version> element of the appengine-web.xml or null if it is missing.- Throws:
AppEngineException
-
getServiceId
@Nullable public String getServiceId() throws AppEngineException
Returns service ID from the <service> element of the appengine-web.xml, or null if it is missing. Will also look at module ID.- Throws:
AppEngineException
-
isJava8
public boolean isJava8() throws AppEngineException
Returns true if the runtime read from appengine-web.xml is Java8.- Throws:
AppEngineException
-
isSandboxEnforced
public boolean isSandboxEnforced() throws AppEngineException
Returns true if the runtime needs to enforce original sandbox restrictions (for example, the Java7 runtime).- Throws:
AppEngineException
-
getEnvironment
public Map<String,String> getEnvironment() throws AppEngineException
Given the following structure:<env-variables> <env-var name="key" value="val" /> </env-variables>
This will construct a map of the form {[key, value], ...}.
- Returns:
- a map representing the environment variable settings in the appengine-web.xml
- Throws:
AppEngineException
-
-