Package it.freedomotic.marketplace.postplugin

Examples of it.freedomotic.marketplace.postplugin.JavaUploader


    String nodeid;
    String attachment;

    @Override
    public void execute() {
        JavaUploader drupal = new JavaUploader();
        //change this for real username and password
        String loginJson = drupal.login(username, password);
        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);
                    }
                } catch (IOException ex) {
View Full Code Here

TOP

Related Classes of it.freedomotic.marketplace.postplugin.JavaUploader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.