if (!configFile.exists()) {
File adaptrexFolder = new File(webapp.getFullPath() + "/src/main/webapp/adaptrex");
adaptrexFolder.mkdirs();
configFile.createNewFile();
}
Ini ini = new Ini();
ini.load(new FileReader(configFile));
Ini.Section settingsSection = ini.get(SETTINGS);
if (settingsSection == null) settingsSection = ini.add(SETTINGS);
settingsSection.put(NAME, webapp.getName());
settingsSection.put(BASE_PACKAGE, webapp.getBasePackage());
settingsSection.put(GLOBAL_NAMESPACE, webapp.getGlobalNamespace());
settingsSection.put(GLOBAL_FOLDER, webapp.getGlobalFolder());
Ini.Section frameworksSection = ini.get(FRAMEWORKS);
if (frameworksSection == null) frameworksSection = ini.add(FRAMEWORKS);
if (webapp.getAdaptrex() != null)
frameworksSection.put(ADAPTREXJS, webapp.getAdaptrex().getFolderName());
if (webapp.getExt() != null)
frameworksSection.put(EXTJS, webapp.getExt().getFolderName());
if (webapp.getSenchaTouch() != null)
frameworksSection.put(SENCHA_TOUCH, webapp.getSenchaTouch().getFolderName());
if (webapp.getOrm() != null)
frameworksSection.put(ORM, webapp.getOrm());
if (webapp.getPresentation() != null)
frameworksSection.put(PRESENTATION, webapp.getPresentation());
if (webapp.getDi() != null)
frameworksSection.put(DI, webapp.getDi());
Ini.Section pagesSection = ini.get(PAGES);
if (pagesSection == null) pagesSection = ini.add(PAGES);
pagesSection.clear();
Map<String,Page> pages = webapp.getPages();
for (String key : pages.keySet()) {
Page page = pages.get(key);
pagesSection.put(key, page.getNamespace() + "," + page.getFrameworkType());
}
ini.store(configFile);
}