Package org.apache.xmlrpc

Examples of org.apache.xmlrpc.XmlRpcClient$XmlRpcClientAsyncThread


    }

    private void deleteComment(String commentid) throws XmlRpcException, IOException {
      log.debug("deleting junit created comment");
      XmlRpcClient client = new XmlRpcClient("http://" + confSettings.url + "/rpc/xmlrpc");
      String loginToken = RemoteWikiBroker.getInstance().getLoginToken(confSettings);
      Vector paramsVector = new Vector();
      paramsVector.add(loginToken);
      paramsVector.add(commentid);

      client.execute("confluence1.removeComment", paramsVector);
    }
View Full Code Here


      confSettings.spaceKey = sslSpace;
      confSettings.trustallcerts = "true";
      confSettings.truststore = "log4j.properties"; //valid file, but not a valid truststore
      confSettings.trustpass = "";
      String connectionURL = "https://" + sslUrl + "/rpc/xmlrpc";
      XmlRpcClient client = null;
      try {
        client = new XmlRpcClient(connectionURL);
      } catch (MalformedURLException e) {
        e.printStackTrace();
        fail();
      }
      assertNotNull(client);

      Vector loginParams = new Vector(2);
      loginParams.add(confSettings.login);
      loginParams.add(confSettings.password);
      String loginToken;

      //and here's what a proper ssl connection looks like
      tester.addSSLSettings(confSettings);
      try {
        loginToken = (String) client.execute("confluence1.login", loginParams);
        assertNotNull(loginToken);
        assertTrue(!"".equals(loginToken));
      } catch (Exception e) {
        e.printStackTrace();
        fail();
View Full Code Here

    /* Helper Methods */

    private void deletePage(String id, ConfluenceServerSettings confSettings) {
      confSettings.url = confSettings.url.replaceFirst("https?://", "");
      RemoteWikiBroker rwb = RemoteWikiBroker.getInstance();
      XmlRpcClient client = getXmlRpcClient(confSettings);
      Vector paramsVector = new Vector();
      try {
        paramsVector.add(RemoteWikiBroker.getInstance().getLoginToken(confSettings));
      } catch (Exception e1) {
        e1.printStackTrace();
      }
      paramsVector.add(id);
      try {
        client.execute("confluence1.removePage", paramsVector );
      } catch (XmlRpcException e) {
      } catch (IOException e) {
        fail("Shouldn't have IO exception");
      }
    }
View Full Code Here

        fail("Shouldn't have IO exception");
      }
    }
    private XmlRpcClient getXmlRpcClient(ConfluenceServerSettings confSettings) {
      String connectionURL = "http://" + confSettings.url + "/rpc/xmlrpc";
      XmlRpcClient clientConnection = null;
      try {
        clientConnection = new XmlRpcClient(connectionURL);
      } catch (MalformedURLException e) {
        e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
      }
      return clientConnection;
    }
View Full Code Here

        Vector paramsVector = new Vector();
        String loginToken = getLoginToken(confSettings);
        paramsVector.add(loginToken);
        paramsVector.add(space);
        paramsVector.add(pageTitle);
        XmlRpcClient client = getXMLRPCClient(confSettings);
        try {
            page.setPageParams(client.execute(CONFLUENCE_REMOTE_API_VERSION + ".getPage", paramsVector));
        } catch (XmlRpcException e) {
            // page may already exist or getPage is deprecated > 3 versions of confluence
            throw e;
        }
        return page;
View Full Code Here

                                              String spaceKey,
                                              PageForXmlRpc page) throws IOException, XmlRpcException {
        // get a handle to the XMLRPC client obj, this method should be called
        // to manage the connection and make sure it's live even though there
        // is a class var.  This is actually called here for coding clarity.
        XmlRpcClient client = getXMLRPCClient(confSettings);

        // make sure loginToken is up to date
        String loginToken = getLoginToken(confSettings);

        Vector paramsVector = new Vector();
        // add the login token
        paramsVector.add(loginToken);

        // add the page  ---------------------
        page.setSpace(spaceKey);
        paramsVector.add(page.getPageParams());

        PageForXmlRpc resultPage = new PageForXmlRpc();
        // write the page  ---------------------
        try {
            resultPage.setPageParams(client.execute(CONFLUENCE_REMOTE_API_VERSION + ".storePage", paramsVector));
            return resultPage;
        } catch (XmlRpcException e) {
            // page may already exist - have to get more info on page
            log.debug("page added may already exist");
        }
        // page may already exist, get more info on page  ---------------------
        try {
            resultPage = populatePageXmlRpcData(confSettings, spaceKey, page.getTitle());
        } catch (XmlRpcException e) {
            if (isConfluence4OrMore(confSettings)) {
                resultPage = getPageSummary(confSettings, spaceKey, page.getTitle());
            }
        }
        // write the page ---------------------
        loginToken = getLoginToken(confSettings);

        paramsVector = new Vector();
        // add the login token
        paramsVector.add(loginToken);
        page.setSpace(spaceKey);
        resultPage.setContent(page.getContent());
        paramsVector.add(resultPage.getPageParams());

        // write the page
        resultPage.setPageParams(client.execute(CONFLUENCE_REMOTE_API_VERSION + ".storePage", paramsVector));

        return resultPage;

    }
View Full Code Here

                                   String spaceKey,
                                   BlogForXmlRpc blog) throws IOException, XmlRpcException {
        // get a handle to the XMLRPC client obj, this method should be called
        // to manage the connection and make sure it's live even though there
        // is a class var.  This is actually called here for coding clarity.
        XmlRpcClient client = getXMLRPCClient(confSettings);

        // make sure loginToken is up to date
        String loginToken = getLoginToken(confSettings);

        Vector paramsVector = new Vector();
        // add the login token
        paramsVector.add(loginToken);

        // add the page  ---------------------
        blog.setSpace(spaceKey);
        paramsVector.add(blog.getblogParams());

        BlogForXmlRpc resultBlog = new BlogForXmlRpc();
        // write the page  ---------------------
        try {
            resultBlog.setblogParams(client.execute(CONFLUENCE_REMOTE_API_VERSION + ".storeBlogEntry", paramsVector));
            return resultBlog;
        } catch (XmlRpcException e) {
            // blog probably already exists - have to get more info on page
//           log.debug("blog added may already exist");
        }

        //updating blog -- needs id and version

        //get the latest version of the blog
        resultBlog = getBlog(confSettings, spaceKey, blog.getTitle());

        //update the paramVector with id and version
        //(since its associated with the blogs hashtable, we can just update the blog object)
        blog.setId(resultBlog.getId());
        blog.setVersion(Integer.parseInt(resultBlog.getVersion()) + 1 + "");

        // write the page
        resultBlog.setblogParams(client.execute(CONFLUENCE_REMOTE_API_VERSION + ".storeBlogEntry", paramsVector));

        return resultBlog;

    }
View Full Code Here

            return loginToken;

        Vector loginParams = new Vector(2);
        loginParams.add(confSettings.login);
        loginParams.add(confSettings.password);
        XmlRpcClient client = getXMLRPCClient(confSettings);
        loginToken = (String) client.execute(CONFLUENCE_REMOTE_API_VERSION + ".login", loginParams);
        loginTokenMap.put(loginTokenKey, loginToken);
        loginTokenMap.put(lastLoginTimeStampKey, String.valueOf(new Date().getTime()));
        return loginToken;
    }
View Full Code Here

     * @throws MalformedURLException
     * @throws {@link                IllegalArgumentException} If truststore is needed, and the
     *                               indicated location is not a valid file
     */
    protected XmlRpcClient getXMLRPCClient(ConfluenceServerSettings confSettings) throws MalformedURLException {
        XmlRpcClient clientConnection = (XmlRpcClient) connectionMap.get(confSettings.url);
        if (clientConnection != null) {
            return clientConnection;
        }
        String connectionURL = createConnectionUrl(confSettings.url);
        if (isSslUrl(connectionURL)) {
            addSSLSettings(confSettings);
        }
        clientConnection = new XmlRpcClient(connectionURL);
        connectionMap.put(confSettings.url, clientConnection);
        return clientConnection;
    }
View Full Code Here

        File file = new File(attachment.getFileLocation());
        byte fileBytes[] = FileUtils.getBytesFromFile(file);
        paramsVector.add(fileBytes);

        XmlRpcClient client = getXMLRPCClient(confSettings);
        attachment.setPageParams(client.execute(CONFLUENCE_REMOTE_API_VERSION + ".addAttachment", paramsVector));
        log.info("attachment written " + attachment.getFileName());
        return attachment;
    }
View Full Code Here

TOP

Related Classes of org.apache.xmlrpc.XmlRpcClient$XmlRpcClientAsyncThread

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.