// get persistence manager for this thread
IPersistenceManager persistenceManager = PersistenceManagerFactory.getPersistenceManager();
try{
persistenceManager.begin();
File upload = WidgetFileUtils.dealWithDroppedFile(UPLOADFOLDER, f);
W3CWidgetFactory fac = new W3CWidgetFactory();
fac.setLocales(locales);
fac.setLocalPath(contextPath+localWidgetFolderPath);
fac.setOutputDirectory(WIDGETFOLDER);
fac.setFeatures(Features.getFeatureNames());
fac.setStartPageProcessor(new StartPageProcessor());
W3CWidget model = fac.parse(upload);
WidgetJavascriptSyntaxAnalyzer jsa = new WidgetJavascriptSyntaxAnalyzer(fac.getUnzippedWidgetDirectory());
if(persistenceManager.findWidgetByGuid(model.getIdentifier()) == null) {
WidgetFactory.addNewWidget(model, null, upload, true);
String message = model.getLocalName("en") +"' - " + localizedMessages.getString("WidgetAdminServlet.19");
_logger.info(message);
FlashMessage.getInstance().message(message);