throw new Exception(parcelxml.getName() + " not found and language " +
"not specified");
}
if (language != null && parcelxml.exists() == true) {
ParcelDescriptor desc;
String desclang = "";
desc = new ParcelDescriptor(parcelxml);
desclang = desc.getLanguage().toLowerCase();
if (!desclang.equals(language.toLowerCase()))
throw new Exception(parcelxml.getName() + " already exists, " +
"and has a different language attribute: " +
desc.getLanguage());
}
if (language != null && scripts == null) {
if (finder == null)
throw new Exception("Extension list not specified for this language");
log("Searching for " + language + " scripts");
ScriptEntry[] entries = finder.findMethods(contents);
for (int i = 0; i < entries.length; i++) {
addScript(entries[i]);
log("Found: " + entries[i].getLogicalName());
}
}
if (scripts != null) {
if (scripts.size() == 0)
throw new Exception("No valid scripts found");
ParcelDescriptor desc = new ParcelDescriptor(parcelxml, language);
desc.setScriptEntries((ScriptEntry[])scripts.toArray(new ScriptEntry[0]));
if (properties.size() != 0) {
Enumeration enumer = properties.keys();
while (enumer.hasMoreElements()) {
String name = (String)enumer.nextElement();
String value = (String)properties.get(name);
log("Setting property: " + name + " to " + value);
desc.setLanguageProperty(name, value);
}
}
desc.write();
}
else {
if (parcelxml.exists() == false)
throw new Exception("No valid scripts found");
}