private Application(String explodedPath, String appId, String module, String appVersion) {
this.baseDir = new File(explodedPath);
explodedPath = buildNormalizedPath(baseDir);
File webinf = new File(baseDir, "WEB-INF");
if (!webinf.getName().equals("WEB-INF")) {
throw new AppEngineConfigException("WEB-INF directory must be capitalized.");
}
String webinfPath = webinf.getPath();
AppEngineWebXmlReader aewebReader = new AppEngineWebXmlReader(explodedPath);
WebXmlReader webXmlReader = new WebXmlReader(explodedPath);
AppYamlProcessor.convert(webinf, aewebReader.getFilename(), webXmlReader.getFilename());
validateXml(aewebReader.getFilename(), new File(getSdkDocsDir(), "appengine-web.xsd"));
appEngineWebXml = aewebReader.readAppEngineWebXml();
appEngineWebXml.setSourcePrefix(explodedPath);
if (appId == null) {
if (appEngineWebXml.getAppId() == null) {
throw new AppEngineConfigException(
"No app id supplied and XML files have no <application> element");
}
} else {
appEngineWebXml.setAppId(appId);
}