* <configuration>, <platform> or <src> is not specified correctly
* @throws Exception
*/
private Hashtable<String, ExtensionInfo> parseFeaturesInLibraryXML(
File libraryXML, boolean allowBackwardCompatibility) throws Exception {
Library lib = parseLibraryXML(libraryXML);
if (lib == null) {
return null;
}
ArrayList<WidgetFeature> features = lib.getFeatures();
HashSet<String> javaPaths = new HashSet<String>();
HashSet<String> jsPaths = new HashSet<String>();
Hashtable<String, ExtensionInfo> availableFeatures = new Hashtable<String, ExtensionInfo>();
if (allowBackwardCompatibility) {
// have to work for library.xml that doesn't contain configuration and platform elements
File[] files = _temporaryDirectory.listFiles();
for (File f : files) {
javaPaths.add(f.getAbsolutePath());
}
} else {
ExtensionInfo info = new ExtensionInfo(lib, javaPaths, jsPaths);
boolean extensionIdFound = false;
if (lib.getExtension() != null) {
Extension extension = lib.getExtension();
String id = extension.getId();
if (id != null && !id.isEmpty()) {
if (_extensionLookupTable.contains(id)) {
// more than one library.xml contain the same extension id
Logger.logMessage(LogType.WARNING,
"VALIDATION_EXTENSION_DEFINED_MORE_THAN_ONCE",
new String[] { id });
}
_extensionLookupTable.put(id, info);
info.setExtensionFolder(libraryXML.getParentFile());
extensionIdFound = true;
}
}
if (!extensionIdFound) {
// not considered an error, this extension might not be used
// by the app being compiled
Logger.logMessage(LogType.WARNING,
"VALIDATION_LIBRARYXML_EXTENSION_ID_NOT_DEFINED",
new String[] { libraryXML.getAbsolutePath() });
}
Configuration config = getTargetConfiguration(lib);
if (config == null) {
Logger.logMessage(LogType.WARNING, "VALIDATION_LIBRARYXML_NO_CONFIG",
new String[] { libraryXML.getAbsolutePath() });
return null;
}
ArrayList<Src> src = config.getSrc();
if (src == null || src.isEmpty()) {
Logger.logMessage(LogType.WARNING, "VALIDATION_LIBRARYXML_NO_SRC",
new String[] { libraryXML.getAbsolutePath() });
return null;
}
File extensionDir = libraryXML.getParentFile();
for (Src s : src) {
String path = s.getPath();
if (s.getType().equalsIgnoreCase("text/java")) {
javaPaths.add(extensionDir.getAbsolutePath() + File.separator
+ path);
} else if (s.getType().equalsIgnoreCase("text/javascript")) {
jsPaths.add(extensionDir.getAbsolutePath() + File.separator
+ path);
}
}
}
ExtensionInfo info = new ExtensionInfo(lib, javaPaths, jsPaths);
for (WidgetFeature feature : features) {
availableFeatures.put(feature.getID(), info);
}
if (lib.getCompiledJARDependencies() != null) {
for (Jar j : lib.getCompiledJARDependencies()) {
String path = j.getPath();
File temp = new File(path);
if (temp.isAbsolute()) {
info.addCompiledJARPath(path);