String gadgetURL = getGadgetURL();
GadgetSpec spec = new GadgetSpec(Uri.parse(gadgetURL), gadget);
ModulePrefs prefs = spec.getModulePrefs();
//
GadgetDefinition def = registry.addGadget(name);
//
String description = prefs.getDescription();
String thumbnail = prefs.getThumbnail().toString();
String title = getGadgetTitle(prefs, name);
String referenceURL = prefs.getTitleUrl().toString();
//
log.info("Importing gadget name=" + name + " description=" + description + " thumbnail=" + thumbnail + " title=" +
thumbnail + " title=" + title);
//
def.setDescription(description);
def.setThumbnail(thumbnail); // Do something better than that
def.setTitle(title);
def.setReferenceURL(referenceURL);
def.setLocal(local);
//
if (local)
{
LocalGadgetData data = (LocalGadgetData)def.getData();
//
String fileName = getName(gadgetPath);
data.setFileName(fileName);
// Import resource
folder = data.getResources();
String folderPath = getParent(gadgetPath);
visitChildren(folderPath);
folder = null;
}
else
{
RemoteGadgetData data = (RemoteGadgetData)def.getData();
// Set remote URL
data.setURL(gadgetPath);
}
}