CookieSetting cS = drupal.parseCookie(loginJson);
String userid = drupal.parseUid(loginJson);
if (cS != null) {
//first try to retrieve the plugin from the drupal site
System.out.println("Retrieving " + nodeid + " from the marketplace");
MarketPlacePlugin2 plugin = (MarketPlacePlugin2) DrupalRestHelper.retrievePluginPackage("http://www.freedomotic.com/rest/node/" + nodeid);
if (plugin != null) {
try {
File marketDirectory = new File(attachment);
File fileToUpload = findFileToUpload(marketDirectory);
if (fileToUpload != null) {
MarketPlaceFile pluginFile = drupal.postFile(cS, userid, marketDirectory.getAbsolutePath(), fileToUpload.getName());
plugin.addFile(pluginFile);
drupal.putPlugin(cS, nodeid, plugin);
} else {
throw new BuildException("No marketplace files in folder " + marketDirectory);
}