return null;
}
@SuppressWarnings("deprecation")
public Widget publishWidgetUrlToWookie(String widgetStrUrl){
Widget widget = null;
File tempWgtFile = null;
try {
if(adminUsername.equals(null) || adminUsername.equals("") || adminPassword.equals(null) || adminPassword.equals("")){
throw new WookieConnectorException("Either the wookie username or password is not defined in portal.properties", null);
}
connectorService = getWookieConnectorService(wookieServerUrl, wookieApiKey, "");
// TODO - replace code with line below when bundled with wookie 0.13.0
// wookie-0.13.0 can accept postWidget with a url parameter as well as file parameter
//org.apache.wookie.connector.framework.Widget wookieWidget = connectorService.postWidget(widgetUrl, adminUsername, adminPassword);
URL widgetUrl = new URL(widgetStrUrl);
String tempUploadFolder = System.getProperty("java.io.tmpdir");
String filename = normalizeFileName(widgetUrl);
tempWgtFile = new File(tempUploadFolder, filename);
FileUtils.copyURLToFile(widgetUrl, tempWgtFile, 10000, 10000);
org.apache.wookie.connector.framework.Widget wookieWidget = connectorService.postWidget(tempWgtFile, adminUsername, adminPassword);
widget = new W3CWidget();
widget.setUrl(wookieWidget.getIdentifier());
widget.setDescription(wookieWidget.getDescription());
widget.setTitle(wookieWidget.getTitle());
widget.setType("W3C");
widget.setThumbnailUrl(wookieWidget.getIcon().toString());
} catch (WookieConnectorException e){
logger.warn(e.getMessage());
return returnURLFromConfig(tempWgtFile);
} catch (MalformedURLException e) {
logger.error("Malformed url error. " + e.getMessage());