
org.jasig.irclog.XmlRpcConfluenceServer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ConfluenceIrcLogger Show documentation
Show all versions of ConfluenceIrcLogger Show documentation
Logs IRC conversations into Confluence.
The newest version!
/**
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jasig.irclog;
import java.net.URL;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
/**
* Encapsulates basic Confluence RPC operations needed for updating pages
*
* @author Eric Dalquist
* @version $Revision: 25223 $
*/
public class XmlRpcConfluenceServer implements InitializingBean, ConfluenceServer {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
private XmlRpcClient client;
private String rpcEndpoint;
private String username;
private String password;
/**
* The Confluence XML-RPC endpoint URL
*/
public void setRpcEndpoint(String rpcEndpoint) {
this.rpcEndpoint = rpcEndpoint;
}
/**
* The Confluence account to use
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Password for the confluence account
*/
public void setPassword(String password) {
this.password = password;
}
@Override
public void afterPropertiesSet() throws Exception {
final XmlRpcClientConfigImpl clientConfig = new XmlRpcClientConfigImpl();
clientConfig.setServerURL(new URL(this.rpcEndpoint));
this.client = new XmlRpcClient();
this.client.setConfig(clientConfig);
//TODO eventually use httpclient via XmlRpcCommonsTransportFactory
}
/* (non-Javadoc)
* @see org.jasig.irclog.ConfluenceServer#login()
*/
@Override
public String login() {
return this.call("login", this.username, this.password);
}
/* (non-Javadoc)
* @see org.jasig.irclog.ConfluenceServer#logout(java.lang.String)
*/
@Override
public void logout(String token) {
this.call("logout", token);
}
/* (non-Javadoc)
* @see org.jasig.irclog.ConfluenceServer#getPage(java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public Map getPage(String token, String spaceKey, String title) {
return this.call("getPage", token, spaceKey, title);
}
/* (non-Javadoc)
* @see org.jasig.irclog.ConfluenceServer#storePage(java.lang.String, java.util.Map)
*/
@Override
public Map storePage(String token, Map page) {
return this.call("storePage", token, page);
}
/* (non-Javadoc)
* @see org.jasig.irclog.ConfluenceServer#updatePage(java.lang.String, java.util.Map, java.util.Map)
*/
@Override
public Map updatePage(String token, Map page, Map updateOptions) {
return this.call("updatePage", token, page, updateOptions);
}
/* (non-Javadoc)
* @see org.jasig.irclog.ConfluenceServer#convertWikiToStorageFormat(java.lang.String, java.lang.String)
*/
@Override
public String convertWikiToStorageFormat(String token, String message) {
return message;
}
@SuppressWarnings("unchecked")
private T call(String method, Object... args) {
final List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy