Index: src/main/java/com/xpn/xwiki/xmlrpc/XWikiUtils.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/XWikiUtils.java (revision 0) +++ src/main/java/com/xpn/xwiki/xmlrpc/XWikiUtils.java (revision 0) @@ -0,0 +1,125 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * + */ +package com.xpn.xwiki.xmlrpc; + +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.HashMap; +import java.util.Map; + +import org.apache.xmlrpc.XmlRpcException; + +import com.xpn.xwiki.XWiki; +import com.xpn.xwiki.XWikiContext; +import com.xpn.xwiki.XWikiException; +import com.xpn.xwiki.render.XWikiVelocityRenderer; +import com.xpn.xwiki.web.Utils; +import com.xpn.xwiki.web.XWikiRequest; +import com.xpn.xwiki.web.XWikiResponse; +import com.xpn.xwiki.web.XWikiServletContext; +import com.xpn.xwiki.web.XWikiURLFactory; + +/** + * This is an helper class containing some utility method for handling and setting up the XWiki and + * XMLRPC data objects needed to serve XMLRPC requests. + * + * @author fmancinelli + */ +public class XWikiUtils +{ + public static Object mock(Class someClass) + { + ClassLoader loader = someClass.getClassLoader(); + + InvocationHandler handler = new InvocationHandler() + { + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + { + return null; + } + }; + Class[] interfaces = new Class[] {someClass}; + + return Proxy.newProxyInstance(loader, interfaces, handler); + } + + public static XWikiXmlRpcContext getXWikiXmlRpcContext(String token, XWikiRequest request, + XWikiResponse response, XWikiServletContext servletContext) throws XWikiException, + XmlRpcException + { + + XWikiContext context = getXWikiContext(request, response, servletContext); + XWikiXmlRpcUser user = XWikiUtils.checkToken(token, context); + com.xpn.xwiki.api.XWiki xwiki = new com.xpn.xwiki.api.XWiki(context.getWiki(), context); + + return new XWikiXmlRpcContext(context, context.getWiki(), xwiki, user); + } + + public static XWikiContext getXWikiContext(XWikiRequest request, XWikiResponse response, + XWikiServletContext servletContext) throws XWikiException + { + XWikiContext context = Utils.prepareContext("", request, response, servletContext); + XWiki xwiki = XWiki.getXWiki(context); + XWikiURLFactory urlf = + xwiki.getURLFactoryService().createURLFactory(context.getMode(), context); + context.setURLFactory(urlf); + XWikiVelocityRenderer.prepareContext(context); + + return context; + } + + public static Map getTokens(XWikiContext context) + { + Map tokens = (Map) context.getEngineContext().getAttribute("xmlrpc_tokens"); + if (tokens == null) { + tokens = new HashMap(); + context.getEngineContext().setAttribute("xmlrpc_tokens", tokens); + } + + return tokens; + } + + public static XWikiXmlRpcUser getUserForToken(XWikiContext context, String token) + { + return (XWikiXmlRpcUser) getTokens(context).get(token); + } + + public static XWikiXmlRpcUser checkToken(String token, XWikiContext context) + throws XmlRpcException + { + XWikiXmlRpcUser user = null; + String ip = context.getRequest().getRemoteAddr(); + + if (token != null) { + user = (XWikiXmlRpcUser) getTokens(context).get(token); + } + + if ((user == null) || (!user.getRemoteIp().equals(ip))) { + throw new XmlRpcException(String.format( + "[Access Denied: authentication token '%s' for IP %s is invalid]", token, ip)); + } + + context.setUser(user.getName()); + + return user; + } +} Index: src/main/java/com/xpn/xwiki/xmlrpc/BaseRpcHandler.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/BaseRpcHandler.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/BaseRpcHandler.java (working copy) @@ -1,99 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc; - -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -import javax.servlet.Servlet; -import javax.servlet.ServletContext; -import javax.servlet.ServletRequest; -import javax.servlet.http.HttpServletRequest; - -import com.xpn.xwiki.XWiki; -import com.xpn.xwiki.XWikiContext; -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.render.XWikiVelocityRenderer; -import com.xpn.xwiki.web.Utils; -import com.xpn.xwiki.web.XWikiEngineContext; -import com.xpn.xwiki.web.XWikiRequest; -import com.xpn.xwiki.web.XWikiResponse; -import com.xpn.xwiki.web.XWikiURLFactory; - -public class BaseRpcHandler implements RequestInitializableHandler -{ - - private XWikiEngineContext econtext; - - private XWikiRequest request; - - private XWikiResponse response; - - public void init(Servlet servlet, ServletRequest request) throws XWikiException - { - // use the real request - this.request = new XWikiXmlRpcRequest((HttpServletRequest) request); - - // use fake response (created as dynamic proxy) - XWikiResponse responseDummy = (XWikiResponse) generateDummy(XWikiResponse.class); - this.response = new XWikiXmlRpcResponse(responseDummy); - - ServletContext sContext = null; - try { - sContext = servlet.getServletConfig().getServletContext(); - } catch (Exception ignore) { - } - if (sContext != null) { - this.econtext = new XWikiXmlRpcContext(sContext); - } else { - // use fake server context (created as dynamic proxy) - ServletContext contextDummy = (ServletContext)generateDummy(ServletContext.class); - this.econtext = new XWikiXmlRpcContext(contextDummy); - } - } - - private Object generateDummy(Class someClass) - { - ClassLoader loader = someClass.getClassLoader(); - InvocationHandler handler = new InvocationHandler() - { - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable - { - return null; - } - }; - Class[] interfaces = new Class[] {someClass}; - return Proxy.newProxyInstance(loader, interfaces, handler); - } - - protected XWikiContext getXWikiContext() throws XWikiException - { - XWikiContext context = Utils.prepareContext("", request, response, econtext); - XWiki xwiki = XWiki.getXWiki(context); - XWikiURLFactory urlf = - xwiki.getURLFactoryService().createURLFactory(context.getMode(), context); - context.setURLFactory(urlf); - XWikiVelocityRenderer.prepareContext(context); - return context; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcHandler.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcHandler.java (revision 0) +++ src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcHandler.java (revision 0) @@ -0,0 +1,1505 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * + */ +package com.xpn.xwiki.xmlrpc; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.xmlrpc.XmlRpcException; +import org.suigeneris.jrcs.rcs.Version; +import org.xwiki.xmlrpc.model.Attachment; +import org.xwiki.xmlrpc.model.Comment; +import org.xwiki.xmlrpc.model.Page; +import org.xwiki.xmlrpc.model.PageHistorySummary; +import org.xwiki.xmlrpc.model.PageSummary; +import org.xwiki.xmlrpc.model.ServerInfo; +import org.xwiki.xmlrpc.model.Space; +import org.xwiki.xmlrpc.model.SpaceSummary; +import org.xwiki.xmlrpc.model.Utils; +import org.xwiki.xmlrpc.model.XWikiClass; +import org.xwiki.xmlrpc.model.XWikiClassSummary; +import org.xwiki.xmlrpc.model.XWikiObject; +import org.xwiki.xmlrpc.model.XWikiObjectSummary; +import org.xwiki.xmlrpc.model.XmlRpcConstants; + +import com.xpn.xwiki.XWikiContext; +import com.xpn.xwiki.XWikiException; +import com.xpn.xwiki.api.Document; +import com.xpn.xwiki.api.Property; +import com.xpn.xwiki.api.PropertyClass; +import com.xpn.xwiki.api.XWiki; +import com.xpn.xwiki.doc.XWikiAttachment; +import com.xpn.xwiki.doc.XWikiDocument; +import com.xpn.xwiki.web.XWikiRequest; +import com.xpn.xwiki.web.XWikiResponse; +import com.xpn.xwiki.web.XWikiServletContext; + +/** + * The class containing the implementation of the XML-RPC API. Methods tagged with the ConfluenceAPI + * are compatible with Confluence. + * + * @author fmancinelli + */ +public class XWikiXmlRpcHandler +{ + private XWikiRequest xwikiRequest; + + private XWikiResponse xwikiResponse; + + private XWikiServletContext xwikiServletContext; + + private static final Log log = LogFactory.getLog(XWikiXmlRpcHandler.class); + + /** + * Initialize the XML-RPC handler with respect to the current HTTP request. + * + * @param servlet The servlet requesting the XML-RPC call handling. + * @param httpRequest The current HTTP request. + */ + public void init(HttpServlet servlet, HttpServletRequest httpRequest) + { + xwikiRequest = new XWikiXmlRpcRequest(httpRequest); + xwikiResponse = new XWikiXmlRpcResponse((XWikiResponse)XWikiUtils.mock(XWikiResponse.class)); + ServletContext servletContext = servlet.getServletContext(); + xwikiServletContext = new XWikiServletContext(servletContext); + } + + /*********************************************************************************************** + * Authentication ****************************************************************************** + **********************************************************************************************/ + + /** + * Login. + * + * @param userName + * @param password + * @return A token to be used in subsequent calls as an identification. + * @throws XWikiException + * @throws XmlRpcException If authentication fails. + * @category ConfluenceAPI + */ + public String login(String userName, String password) throws XWikiException, XmlRpcException + { + XWikiContext context = + XWikiUtils.getXWikiContext(xwikiRequest, xwikiResponse, xwikiServletContext); + com.xpn.xwiki.XWiki xwiki = context.getWiki(); + String token; + + if (xwiki.getAuthService().authenticate(userName, password, context) != null) { + // Generate "unique" token using a random number + token = xwiki.generateValidationKey(128); + String ip = context.getRequest().getRemoteAddr(); + + XWikiUtils.getTokens(context).put(token, + new XWikiXmlRpcUser(String.format("XWiki.%s", userName), ip)); + + return token; + } else { + throw new XmlRpcException(String.format("[Authentication failed for user %s.]", + userName)); + } + } + + /** + * Logout. + * + * @param token The authentication token. + * @return True is logout was successful. + * @throws XWikiException + * @throws XmlRpcException An invalid token is provided. + * @category ConfluenceAPI + */ + public Boolean logout(String token) throws XWikiException, XmlRpcException + { + XWikiContext context = + XWikiUtils.getXWikiContext(xwikiRequest, xwikiResponse, xwikiServletContext); + XWikiUtils.checkToken(token, context); + + return XWikiUtils.getTokens(context).remove(token) != null; + } + + /*********************************************************************************************** + * Informaton ********************************************************************************** + **********************************************************************************************/ + + /** + * Get server information. + * + * @param token The authentication token. + * @return The server information + * @throws XWikiException + * @throws XmlRpcException An invalid token is provided. + * @category ConfluenceAPI + */ + public Map getServerInfo(String token) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getServerInfo()", xwikiXmlRpcContext.getUser() + .getName())); + + String version = xwiki.getVersion(); + Integer majorVersion = null; + Integer minorVersion = null; + + if (version != null) { + if (version.indexOf('.') != -1) { + String[] components = version.split("."); + majorVersion = new Integer(components[0]); + minorVersion = new Integer(components[1]); + } + } + + ServerInfo serverInfo = + new ServerInfo(majorVersion, minorVersion, 0, version, false, xwiki.getURL("/")); + + return serverInfo.toMap(); + } + + /*********************************************************************************************** + * Spaces ************************************************************************************** + **********************************************************************************************/ + + /** + * @param token The authentication token. + * @return A list of Maps that represents SpaceSummary objects. + * @throws XWikiException + * @throws XmlRpcException An invalid token is provided. + * @category ConfluenceAPI + */ + public List getSpaces(String token) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getSpaces()", xwikiXmlRpcContext.getUser() + .getName())); + + List result = new ArrayList(); + List spaceKeys = xwiki.getSpaces(); + for (String spaceKey : spaceKeys) { + String spaceWebHome = String.format("%s.WebHome", spaceKey); + + SpaceSummary spaceSummary = null; + + if (!xwiki.exists(spaceWebHome)) { + spaceSummary = new SpaceSummary(spaceKey, spaceKey, "global", ""); + } else { + Document doc = xwiki.getDocument(spaceWebHome); + + /* If doc is null, then we don't have the rights to access the document */ + if (doc != null) { + String title = doc.getTitle(); + + if (title == null || title.equals("")) { + title = spaceKey; + } + + spaceSummary = + new SpaceSummary(spaceKey, title, "global", doc.getExternalURL("view")); + } + } + + /* Might be null if we don't have the rights to access the document */ + if (spaceSummary != null) { + result.add(spaceSummary.toMap()); + } + } + + return result; + } + + /** + * @param token The authentication token. + * @param spaceName + * @return A map representing a Space object. + * @throws XWikiException + * @throws XmlRpcException An invalid token is provided or the user doesn't have enough rights + * to access the space. + * @category ConfluenceAPI + */ + public Map getSpace(String token, String spaceName) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getSpace()", xwikiXmlRpcContext.getUser() + .getName())); + + if (!xwiki.getSpaces().contains(spaceName)) { + throw new XmlRpcException(String.format("[Space '%s' does not exist]", spaceName)); + } + + Space space = null; + String spaceWebHome = String.format("%s.WebHome", spaceName); + if (!xwiki.exists(spaceWebHome)) { + space = new Space(spaceName, "", "", "global", "", "No description available"); + } else { + Document doc = xwiki.getDocument(spaceWebHome); + + /* If doc is null, then we don't have the rights to access the document */ + if (doc != null) { + space = + new Space(spaceName, + doc.getTitle(), + "global", + doc.getExternalURL("view"), + spaceWebHome, + "No description available"); + } else { + throw new XmlRpcException(String.format("[Space '%s' cannot be accessed]", + spaceName)); + } + + } + + return space.toMap(); + } + + /** + * Add a new space. It basically creates a SpaceKey.WebHome page with no content and the space + * title as its title. + * + * @param token The authentication token. + * @param spaceMap The map representing a Space object. + * @return The newly created space as a Space object. + * @throws XWikiException + * @throws XmlRpcException Space cannot be created or it already exists and the user has not the + * rights to modify it + * @category ConfluenceAPI + */ + public Map addSpace(String token, Map spaceMap) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called addSpace()", xwikiXmlRpcContext.getUser() + .getName())); + + Space space = new Space((Map) spaceMap); + + if (xwiki.getSpaces().contains(space.getKey())) { + throw new XmlRpcException(String + .format("[Space '%s' already exists]", space.getKey())); + } + + String spaceHomePage = String.format("%s.WebHome", space.getKey()); + Document doc = xwiki.getDocument(spaceHomePage); + if (doc != null) { + doc.setContent(""); + doc.setTitle(space.getName()); + doc.save(); + + space = + new Space(space.getKey(), + space.getName(), + "global", + doc.getExternalURL(), + spaceHomePage, + space.getDescription()); + + return space.toMap(); + } else { + throw new XmlRpcException(String + .format( + "Space cannot be created or it already exists and user '%s' has not the right to modify it", + xwikiXmlRpcContext.getUser().getName())); + } + } + + /** + * Removes a space by deleting every page in it. + * + * @param token The authentication token. + * @param spaceKey + * @return True if the space has been successfully deleted. + * @throws XWikiException + * @throws XmlRpcException + * @category ConfluenceAPI + */ + public Boolean removeSpace(String token, String spaceKey) throws XWikiException, + XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called removeSpace()", xwikiXmlRpcContext.getUser() + .getName())); + + if (!xwiki.getSpaces().contains(spaceKey)) { + throw new XmlRpcException(String.format("Space '%s' does not exist.", spaceKey)); + } + + boolean spaceDeleted = true; + List pageNames = xwiki.getSpaceDocsName(spaceKey); + for (String pageName : pageNames) { + String pageFullName = String.format("%s.%s", spaceKey, pageName); + if (xwiki.exists(pageFullName)) { + Document doc = xwiki.getDocument(pageFullName); + if (doc != null) { + try { + if (!doc.getLocked()) { + doc.delete(); + } else { + /* We cannot delete a locked page, so the space is not fully deleted. */ + spaceDeleted = false; + } + } catch (XWikiException e) { + /* + * An exception here means that we haven't succeeded in deleting a page, so + * there might be some pages that still belong to the space, so the space is + * not fully deleted + */ + System.out.format("%s\n", e.getMessage()); + spaceDeleted = false; + } + } else { + spaceDeleted = false; + } + } + } + + return spaceDeleted; + } + + /*********************************************************************************************** + * Pages *************************************************************************************** + **********************************************************************************************/ + + /** + * @param token The authentication token. + * @param spaceKey + * @return A list containing PageSummary objects. + * @throws XWikiException + * @throws XmlRpcException + * @category ConfluenceAPI + */ + public List getPages(String token, String spaceKey) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getPages()", xwikiXmlRpcContext.getUser() + .getName())); + + List result = new ArrayList(); + List pageNames = xwiki.getSpaceDocsName(spaceKey); + for (String pageName : pageNames) { + String pageFullName = String.format("%s.%s", spaceKey, pageName); + + if (!xwiki.exists(pageFullName)) { + log.warn(String.format( + "Page '%s' appears to be in space '%s' but no information is available.", + pageName)); + } else { + Document doc = xwiki.getDocument(pageFullName); + + /* We only add pages we have the right to access */ + if (doc != null) { + String pageTitle = doc.getTitle(); + if (pageTitle.equals("")) { + pageTitle = pageName; + } + + PageSummary pageSummary = + new PageSummary(pageFullName, spaceKey, doc.getParent(), pageTitle, doc + .getExternalURL("view"), 0, doc.getTranslationList()); + + result.add(pageSummary.toMap()); + } + } + } + + return result; + } + + /** + * Retrieves a page. + * + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @param language The language id for the translation + * @param version The desired version. If version == 0 then the latest version is returned. + * @param minorVersion The desired minor version (ignored if version == 0). + * @return A map representing a Page object containing information about the page at version + * 'version.minorVersion' + * @throws XWikiException + * @throws XmlRpcException If the user has not the right to access the page or the page does not + * exist at version 'version.minorVersion'. + */ + public Map getPage(String token, String pageId, String language, Integer version, + Integer minorVersion) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getPage()", xwikiXmlRpcContext.getUser() + .getName())); + + if (!xwiki.exists(pageId)) { + throw new XmlRpcException(String.format("Unable to get page %s", pageId)); + } + + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + if (language.equals("") || !doc.getTranslationList().contains(language)) { + language = doc.getDefaultLanguage(); + } + + /* + * If version == 0 then don't get a specific version and keep the latest version + * returned by the previous call of getDocument(). + */ + if (version != 0) { + doc = xwiki.getDocument(doc, String.format("%d.%d", version, minorVersion)); + } + + if (doc != null) { + doc = doc.getTranslatedDocument(language); + + if (doc != null) { + String pageTitle = doc.getTitle(); + if (pageTitle.equals("")) { + pageTitle = doc.getName(); + } + + Page page = + new Page(pageId, + doc.getSpace(), + doc.getParent(), + pageTitle, + doc.getExternalURL(), + 0, + doc.getTranslationList(), + doc.getRCSVersion().at(0), + doc.getRCSVersion().at(1), + doc.getContent(), + doc.getCreationDate(), + doc.getCreator(), + doc.getContentUpdateDate(), + doc.getContentAuthor(), + doc.getName().equals("WebHome"), + "current", + true, + doc.getLanguage()); + + return page.toMap(); + } else { + throw new XmlRpcException(String.format( + "Page '%s' does not have an '%s' translation", pageId, language)); + } + } else { + throw new XmlRpcException(String.format( + "Page '%s' does not exist at version %d.%d", pageId, version, minorVersion)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } + + /** + * Utility method for getting the latest version of the page in the default language. + * + * @see XWikiXmlRpcHandler#getPage(String, String, String, Integer, Integer) + * @category ConfluenceAPI + */ + public Map getPage(String token, String pageId) throws XWikiException, XmlRpcException + { + return getPage(token, pageId, "", 0, 1); + } + + /** + * Utility method for getting the latest version of the page in a given language This method has + * the same signature of the Confluence API but a different semantics. While in Confluence the + * third String parameter is the page title, here it identifies the language. + * + * @see XWikiXmlRpcHandler#getPage(String, String, String, Integer, Integer) + */ + public Map getPage(String token, String pageId, String language) throws XWikiException, + XmlRpcException + { + return getPage(token, pageId, language, 0, 1); + } + + /** + * Utility method for getting a specific major version of the page in the default language + * + * @see XWikiXmlRpcHandler#getPage(String, String, String, Integer, Integer) + */ + public Map getPage(String token, String pageId, Integer version) throws XWikiException, + XmlRpcException + { + return getPage(token, pageId, "", version, 1); + } + + /** + * Utility method for getting a specific major version of the page in a given language + * + * @see XWikiXmlRpcHandler#getPage(String, String, String, Integer, Integer) + */ + public Map getPage(String token, String pageId, String language, Integer version) + throws XWikiException, XmlRpcException + { + + return getPage(token, pageId, language, version, 1); + } + + /** + * Utility method for getting a specific major.minor version of the page in the default language + * + * @see XWikiXmlRpcHandler#getPage(String, String, String, Integer, Integer) + */ + public Map getPage(String token, String pageId, Integer version, Integer minorVersion) + throws XWikiException, XmlRpcException + { + return getPage(token, pageId, "", version, minorVersion); + } + + /** + * Store a page or create it if it doesn't exist. + * + * @param token The authentication token. + * @param pageMap A map representing the Page object to be stored. + * @return A map representing a Page object with the updated information. + * @throws XWikiException + * @throws XmlRpcException + * @category ConfluenceAPI + */ + public Map storePage(String token, Map pageMap) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called storePage()", xwikiXmlRpcContext.getUser() + .getName())); + + Page page = new Page((Map) pageMap); + + Document doc = xwiki.getDocument(page.getId()); + + if (doc != null) { + if (doc.getLocked()) { + throw new XmlRpcException(String.format( + "Unable to store document. Document locked by %s", doc.getLockingUser())); + } + + if (!page.getLanguage().equals("") + && !page.getLanguage().equals(doc.getDefaultLanguage())) { + + /* Try to get the document in the translation specified in the page parameter... */ + doc = doc.getTranslatedDocument(page.getLanguage()); + + if (!doc.getLanguage().equals(page.getLanguage())) { + /* + * If we are here, then the document returned by getTranslatedDocument is the + * same of the default translation, i.e., the page in the current translation + * does not exist. So we have to create it. Here we have to use the low-level + * XWiki API because it is not possible to set the language of a Document. + */ + XWikiDocument xwikiDocument = + new XWikiDocument(page.getSpace(), page.getId()); + xwikiDocument.setLanguage(page.getLanguage()); + doc = new Document(xwikiDocument, xwikiXmlRpcContext.getXWikiContext()); + } + } + + doc.setContent(page.getContent()); + doc.setTitle(page.getTitle()); + + if (!doc.getParent().equals(page.getParentId())) { + doc.setParent(page.getParentId()); + } + + doc.save(); + + String pageTitle = doc.getTitle(); + if (pageTitle.equals("")) { + pageTitle = doc.getName(); + } + + Page newPage = + new Page(doc.getFullName(), + doc.getSpace(), + doc.getParent(), + pageTitle, + doc.getExternalURL(), + 0, + doc.getTranslationList(), + doc.getRCSVersion().at(0), + doc.getRCSVersion().at(1), + doc.getContent(), + doc.getCreationDate(), + doc.getCreator(), + doc.getContentUpdateDate(), + doc.getContentAuthor(), + doc.getName().equals("WebHome"), + "current", + true, + doc.getLanguage()); + + return newPage.toMap(); + } else { + throw new XmlRpcException(String.format("Cannot get document for page '%s'", page + .getId())); + } + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @return + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + * @category ConfluenceAPI + */ + public Boolean removePage(String token, String pageId) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called removePage()", xwikiXmlRpcContext.getUser() + .getName())); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + if (doc.getLocked()) { + throw new XmlRpcException(String.format( + "Unable to remove attachment. Document '%s' locked by '%s'", doc + .getName(), doc.getLockingUser())); + } + + doc.delete(); + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + + return true; + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @return A list of maps representing PageHistorySummary objects. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + * @category ConfluenceAPI + */ + public List getPageHistory(String token, String pageId) throws XWikiException, + XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called removePage()", xwikiXmlRpcContext.getUser() + .getName())); + + List result = new ArrayList(); + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + Version[] versions = doc.getRevisions(); + for (Version version : versions) { + Document docRevision = xwiki.getDocument(doc, version.toString()); + + /* + * The returned document has the right content but the wrong content update + * date, that is always equals to the current date. + */ + PageHistorySummary pageHistorySummary = + new PageHistorySummary(pageId, version.at(0), version.at(1), docRevision + .getContentAuthor(), docRevision.getContentUpdateDate()); + + result.add(pageHistorySummary.toMap()); + + } + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + + return result; + } + + /*********************************************************************************************** + * Pages (Comments) **************************************************************************** * + **********************************************************************************************/ + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @return A list of maps representing Comment objects. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + * @category ConfluenceAPI + */ + public List getComments(String token, String pageId) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getComments()", xwikiXmlRpcContext.getUser() + .getName())); + + List result = new ArrayList(); + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + Vector comments = doc.getComments(); + if (comments != null) { + for (com.xpn.xwiki.api.Object commentObject : comments) { + Property dateProperty = commentObject.getProperty("date"); + Property authorProperty = commentObject.getProperty("author"); + + if (dateProperty != null && authorProperty != null) { + Property contentProperty = commentObject.getProperty("comment"); + String content = + contentProperty != null ? (String) contentProperty.getValue() + : ""; + + Comment comment = + new Comment(String.format("%d", commentObject.getNumber()), + doc.getFullName(), + "No title", + content, + doc.getExternalURL(), + (Date) dateProperty.getValue(), + (String) authorProperty.getValue()); + + result.add(comment.toMap()); + } else { + log.warn(String.format( + "Comment %d on page %s has a null author or a null date", + commentObject.getNumber(), pageId)); + } + } + } + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + + return result; + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @param commentMap A map representing a Comment object. + * @return A map representing a Comment object with updated information. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + * @category ConfluenceAPI + */ + public Map addComment(String token, String pageId, Map commentMap) throws XWikiException, + XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called addComment()", xwikiXmlRpcContext.getUser() + .getName())); + + Comment comment = new Comment((Map) commentMap); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + int id = doc.createNewObject("XWiki.XWikiComments"); + com.xpn.xwiki.api.Object commentObject = doc.getObject("XWiki.XWikiComments", id); + commentObject.set("author", xwikiXmlRpcContext.getUser().getName()); + Date creationDate = new Date(); + commentObject.set("date", creationDate); + commentObject.set("comment", comment.getContent()); + + doc.save(); + + comment = + new Comment(String.format("%d", id), + pageId, + "Comment", + comment.getContent(), + doc.getExternalURL(), + creationDate, + xwikiXmlRpcContext.getUser().getName()); + + return comment.toMap(); + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @param commentId + * @return True if the comment has been successfully removed. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + * @category ConfluenceAPI + */ + public Boolean removeComment(String token, String pageId, String commentId) + throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called removeComment()", xwikiXmlRpcContext.getUser() + .getName())); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + if (doc.getLocked()) { + throw new XmlRpcException(String.format( + "Unable to remove attachment. Document '%s' locked by '%s'", doc + .getName(), doc.getLockingUser())); + } + + int id = Integer.parseInt(commentId); + com.xpn.xwiki.api.Object commentObject = doc.getObject("XWiki.XWikiComments", id); + doc.removeObject(commentObject); + doc.save(); + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + + return true; + } + + /*********************************************************************************************** + * Attachments ********************************************************************************* + **********************************************************************************************/ + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @return A list of maps representing Attachment objects. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + * @category ConfluenceAPI + */ + public List getAttachments(String token, String pageId) throws XWikiException, + XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getAttachments()", xwikiXmlRpcContext + .getUser().getName())); + + List result = new ArrayList(); + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + List attachments = doc.getAttachmentList(); + for (com.xpn.xwiki.api.Attachment xwikiAttachment : attachments) { + /* Due to the silly confluence API we need to convert file sizes to strings :( */ + Attachment attachment = + new Attachment(String.format("%d", xwikiAttachment.getId()), + pageId, + "No title", + xwikiAttachment.getFilename(), + String.format("%d", xwikiAttachment.getFilesize()), + xwikiAttachment.getMimeType(), + xwikiAttachment.getDate(), + xwikiAttachment.getAuthor(), + doc.getAttachmentURL(xwikiAttachment.getFilename()), + xwikiAttachment.getComment()); + + result.add(attachment.toMap()); + } + + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + + return result; + } + + /** + * @param token The authentication token. + * @param contentId Ignored + * @param attachment The Attachment object used to identify the page id, and attachment + * metadata. + * @param attachmentData The actual attachment data. + * @return An Attachment object describing the newly added attachment. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + * @category ConfluenceAPI + */ + public Map addAttachment(String token, Integer contentId, Map attachmentMap, + byte[] attachmentData) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called addAttachment()", xwikiXmlRpcContext.getUser() + .getName())); + + Attachment attachment = new Attachment((Map) attachmentMap); + + if (xwiki.exists(attachment.getPageId())) { + Document doc = xwiki.getDocument(attachment.getPageId()); + + if (doc != null) { + if (doc.getLocked()) { + throw new XmlRpcException(String.format( + "Unable to add attachment. Document locked by %s", doc.getLockingUser())); + } + + /* + * Here we need to switch to the low-level API because the user's API support for + * attachment is not very well understandable. + */ + + /* + * FIXME: CHECK THE FOLLOWING if it's ok! + */ + com.xpn.xwiki.XWiki baseXWiki = xwikiXmlRpcContext.getBaseXWiki(); + XWikiDocument xwikiDocument = + baseXWiki.getDocument(attachment.getPageId(), xwikiXmlRpcContext + .getXWikiContext()); + + XWikiAttachment xwikiBaseAttachment = + xwikiDocument.getAttachment(attachment.getFileName()); + if (xwikiBaseAttachment == null) { + xwikiBaseAttachment = new XWikiAttachment(); + xwikiDocument.getAttachmentList().add(xwikiBaseAttachment); + } + xwikiBaseAttachment.setContent(attachmentData); + xwikiBaseAttachment.setFilename(attachment.getFileName()); + xwikiBaseAttachment.setAuthor(xwikiXmlRpcContext.getUser().getName()); + + xwikiBaseAttachment.setDoc(xwikiDocument); + xwikiDocument.saveAttachmentContent(xwikiBaseAttachment, xwikiXmlRpcContext + .getXWikiContext()); + + xwikiXmlRpcContext.getBaseXWiki().saveDocument(xwikiDocument, + xwikiXmlRpcContext.getXWikiContext()); + + com.xpn.xwiki.api.Attachment xwikiAttachment = + doc.getAttachment(attachment.getFileName()); + + attachment = + new Attachment(String.format("%d", xwikiAttachment.getId()), + attachment.getPageId(), + "No title", + xwikiAttachment.getFilename(), + String.format("%d", xwikiAttachment.getFilesize()), + xwikiAttachment.getMimeType(), + xwikiAttachment.getDate(), + xwikiAttachment.getAuthor(), + doc.getAttachmentURL(xwikiAttachment.getFilename()), + xwikiAttachment.getComment()); + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", + attachment.getPageId())); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", attachment + .getPageId())); + } + + return attachment.toMap(); + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @param fileName + * @param versionNumber (Ignored) + * @return An array of bytes with the actual attachment content. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access it + * or the attachment with the given fileName does not exist on the given page. + * @category ConfluenceAPI + */ + public byte[] getAttachmentData(String token, String pageId, String fileName, + String versionNumber) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getAttachmentData()", xwikiXmlRpcContext + .getUser().getName())); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + com.xpn.xwiki.api.Attachment xwikiAttachment = doc.getAttachment(fileName); + if (xwikiAttachment != null) { + return xwikiAttachment.getContent(); + } else { + throw new XmlRpcException(String.format( + "Attachment '%s' does not exist on page '%s'", fileName, pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @param fileName + * @return True if the attachment has been removed. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access it + * or the attachment with the given fileName does not exist on the given page. + * @category ConfluenceAPI + */ + public Boolean removeAttachment(String token, String pageId, String fileName) + throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called removeAttachment()", xwikiXmlRpcContext + .getUser().getName())); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + if (doc.getLocked()) { + throw new XmlRpcException(String.format( + "Unable to remove attachment. Document '%s' locked by '%s'", doc + .getName(), doc.getLockingUser())); + } + + com.xpn.xwiki.api.Attachment xwikiAttachment = doc.getAttachment(fileName); + if (xwikiAttachment != null) { + /* + * Here we must use low-level XWiki API because there is no way for removing an + * attachment through the XWiki User's API. Basically we use the + * com.xpn.xwiki.XWiki object to re-do all the steps that we have already done + * so far by using the API. It is safe because if we are here, we know that + * everything exists and we have the proper rights to do things. So nothing + * should fail. + */ + com.xpn.xwiki.XWiki baseXWiki = xwikiXmlRpcContext.getBaseXWiki(); + XWikiContext xwikiContext = xwikiXmlRpcContext.getXWikiContext(); + XWikiDocument baseXWikiDocument = baseXWiki.getDocument(pageId, xwikiContext); + XWikiAttachment baseXWikiAttachment = + baseXWikiDocument.getAttachment(fileName); + baseXWikiDocument.deleteAttachment(baseXWikiAttachment, xwikiContext); + } else { + throw new XmlRpcException(String.format( + "Attachment '%s' does not exist on page '%s'", fileName, pageId)); + } + + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + + return true; + } + + /*********************************************************************************************** + * Objects ************************************************************************************* + **********************************************************************************************/ + + /** + * @param token The authentication token. + * @return A list of maps representing XWikiClass objects + * @throws XWikiException + * @throws XmlRpcException + */ + public List getClasses(String token) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getClasses()", xwikiXmlRpcContext.getUser() + .getName())); + + List result = new ArrayList(); + + List classNames = xwiki.getClassList(); + for (String className : classNames) { + XWikiClassSummary xwikiClass = new XWikiClassSummary(className); + result.add(xwikiClass.toMap()); + } + + return result; + } + + /** + * @param token The authentication token. + * @param className + * @return A map representing a XWikiClass object. + * @throws XWikiException + * @throws XmlRpcException If the given class does not exist. + */ + public Map getClass(String token, String className) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getClass()", xwikiXmlRpcContext.getUser() + .getName())); + + if (!xwiki.exists(className)) { + throw new XmlRpcException(String.format("Class '%s' does not exist", className)); + } + + com.xpn.xwiki.api.Class userClass = xwiki.getClass(className); + Map> userClassPropertyToAttributesMap = + new HashMap>(); + + for (Object o : userClass.getProperties()) { + PropertyClass userClassProperty = (PropertyClass) o; + + Map attributeToValueMap = new HashMap(); + attributeToValueMap.put(XWikiClass.XWIKICLASS_ATTRIBUTE, userClassProperty + .getxWikiClass().getName()); + for (Object ucp : userClassProperty.getProperties()) { + Property property = (Property) ucp; + Object value = property.getValue(); + + if (value == null) { + attributeToValueMap.put(property.getName(), XmlRpcConstants.NULL_VALUE); + } else { + attributeToValueMap.put(property.getName(), value); + } + + } + + userClassPropertyToAttributesMap + .put(userClassProperty.getName(), attributeToValueMap); + } + + XWikiClass xwikiClass = new XWikiClass(className, userClassPropertyToAttributesMap); + + Map result = xwikiClass.toMap(); + + return result; + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @return A list of maps representing XWikiObject objects. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + */ + public List getObjects(String token, String pageId) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getObjects()", xwikiXmlRpcContext.getUser() + .getName())); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + + if (doc != null) { + List result = new ArrayList(); + + Map> classToObjectsMap = + doc.getxWikiObjects(); + for (String className : classToObjectsMap.keySet()) { + Vector objects = classToObjectsMap.get(className); + for (com.xpn.xwiki.api.Object object : objects) { + String prettyName = object.getPrettyName(); + if (prettyName == null || prettyName.equals("")) { + prettyName = String.format("%s[%d]", className, object.getNumber()); + } + + XWikiObjectSummary xwikiObjectSummary = + new XWikiObjectSummary(pageId, + className, + object.getNumber(), + prettyName); + + result.add(xwikiObjectSummary.toMap()); + } + } + + return result; + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Unable to get page %s", pageId)); + } + } + + /** + * The getObject function will return an XWikiObject where only non-null properties are included + * in the mapping 'field' -> 'value' In order to know all the available fields and their + * respective types and attributes, clients should refer to the object's class. + * + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @param className The class of the object. + * @param id The id (number) of the object. + * @return The XWikiObject containing the information about all the properties contained in the + * selected object. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access it + * or no object with the given id exist in the page. + */ + public Map getObject(String token, String pageId, String className, Integer id) + throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called getObject()", xwikiXmlRpcContext.getUser() + .getName())); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + + if (doc != null) { + XWikiObject xwikiObject = null; + com.xpn.xwiki.api.Object object = doc.getObject(className, id); + + if (object != null) { + Map propertyToValueMap = new HashMap(); + for (Object o : object.getProperties()) { + Property property = (Property) o; + String name = property.getName(); + + /* Send only non-null values */ + Object value = property.getValue(); + if (value != null) { + Object convertedValue = Utils.convertToXmlRpc(value); + propertyToValueMap.put(name, convertedValue); + } + } + + String prettyName = object.getPrettyName(); + if (prettyName == null || prettyName.equals("")) { + prettyName = String.format("%s[%d]", className, object.getNumber()); + } + + xwikiObject = + new XWikiObject(pageId, className, id, prettyName, propertyToValueMap); + + } else { + throw new XmlRpcException(String.format("Unable to find object id %d", id)); + } + + /* + * If we are here, xwikiObject != null, otherwise an exception would have been + * thrown. + */ + return xwikiObject.toMap(); + + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Unable to get page %s", pageId)); + } + + } + + /** + * Update the object or create a new one if it doesn't exist. + * + * @param token The authentication token. + * @param objectMap A map representing the XWikiObject to be updated/created. + * @return A map representing the XWikiObject with the updated information. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access + * it. + */ + public Map storeObject(String token, Map objectMap) throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called storeObject()", xwikiXmlRpcContext.getUser() + .getName())); + + XWikiObject object = new XWikiObject((Map) objectMap); + String pageId = object.getPageId(); + + if (xwiki.exists(pageId)) { + + Document doc = xwiki.getDocument(pageId); + + if (doc != null) { + if (doc.getLocked()) { + throw new XmlRpcException(String.format( + "Unable to store object. Document locked by %s", doc.getLockingUser())); + } + + com.xpn.xwiki.api.Object currentObject = + doc.getObject(object.getClassName(), object.getId()); + + /* If the object does not exist create it */ + if (currentObject == null) { + int id = doc.createNewObject(object.getClassName()); + + /* Create a copy of the passed XWikiObject with the newly created id */ + Map propertyMap = new HashMap(); + for (String property : object.getProperties()) { + propertyMap.put(property, object.get(property)); + } + object = + new XWikiObject(object.getPageId(), object.getClassName(), id, object + .getPrettyName(), propertyMap); + + /* Get the newly created object for update */ + currentObject = doc.getObject(object.getClassName(), id); + } + + /* + * We iterate on the XWikiObject-passed-as-a-parameter's properties instead of the + * one retrieved through the API because, a newly created object has no properties, + * and they should be added via set. Apparently setting properties that do not + * belong to the object's class is harmless. + */ + for (String propertyName : object.getProperties()) { + /* + * Object values are always sent as strings (or arrays/maps of strings)... let + * the actual object perform the conversion + */ + + currentObject.set(propertyName, object.get(propertyName)); + } + + doc.save(); + + return object.toMap(); + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Unable to get page %s", pageId)); + } + } + + /** + * @param token The authentication token. + * @param pageId The pageId in the 'Space.Page' format. + * @param className + * @param id The object's id. + * @return True if the object has been successfully deleted. + * @throws XWikiException + * @throws XmlRpcException If the page does not exist or the user has not the right to access it + * or no object with the given id exist in the page. + */ + public Boolean removeObject(String token, String pageId, String className, Integer id) + throws XWikiException, XmlRpcException + { + XWikiXmlRpcContext xwikiXmlRpcContext = + XWikiUtils.getXWikiXmlRpcContext(token, xwikiRequest, xwikiResponse, + xwikiServletContext); + XWiki xwiki = xwikiXmlRpcContext.getXWiki(); + log.info(String.format("User %s has called removeComment()", xwikiXmlRpcContext.getUser() + .getName())); + + if (xwiki.exists(pageId)) { + Document doc = xwiki.getDocument(pageId); + if (doc != null) { + if (doc.getLocked()) { + throw new XmlRpcException(String.format( + "Unable to remove attachment. Document '%s' locked by '%s'", doc + .getName(), doc.getLockingUser())); + } + + com.xpn.xwiki.api.Object commentObject = doc.getObject(className, id); + if (commentObject != null) { + doc.removeObject(commentObject); + doc.save(); + } else { + throw new XmlRpcException(String.format( + "Object %s[%d] on page '%s' does not exist", className, id, pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' cannot be accessed", pageId)); + } + } else { + throw new XmlRpcException(String.format("Page '%s' doesn't exist", pageId)); + } + + return true; + } +} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/Comment.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/Comment.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/Comment.java (working copy) @@ -1,78 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -import java.util.Date; - -public interface Comment extends MapObject -{ - - /** - * numeric id of the comment - */ - String getId(); - - void setId(String id); - - /** - * page ID of the comment - */ - String getPageId(); - - void setPageId(String pageId); - - /** - * title of the comment - */ - String getTitle(); - - void setTitle(String title); - - /** - * notated content of the comment (use renderContent to render) - */ - String getContent(); - - void setContent(String content); - - /** - * url to view the comment online - */ - String getUrl(); - - void setUrl(String url); - - /** - * creation date of the attachment - */ - Date getCreated(); - - void setCreated(Date created); - - /** - * creator of the attachment - */ - String getCreator(); - - void setCreator(String creator); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/SearchResult.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/SearchResult.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/SearchResult.java (working copy) @@ -1,62 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface SearchResult extends MapObject -{ - - /** - * the feed's title - */ - String getTitle(); - - void setTitle(String title); - - /** - * the remote URL needed to view this search result online - */ - String getUrl(); - - void setUrl(String url); - - /** - * a short excerpt of this result if it makes sense - */ - String getExcerpt(); - - void setExcerpt(String excerpt); - - /** - * the type of this result - page, comment, spacedesc, attachment, userinfo, blogpost - */ - String getType(); - - void setType(String type); - - /** - * the long ID of this result (if the type has one) - */ - String getId(); - - void setId(String id); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/MapObject.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/MapObject.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/MapObject.java (working copy) @@ -1,8 +0,0 @@ -package com.xpn.xwiki.xmlrpc.model; - -import java.util.Map; - -public interface MapObject -{ - Map toMap(); -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/BlogEntry.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/BlogEntry.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/BlogEntry.java (working copy) @@ -1,76 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface BlogEntry extends MapObject -{ - - /** - * the id of the blog entry - */ - String getId(); - - void setId(String id); - - /** - * the key of the space that this blog entry belongs to - */ - String getSpace(); - - void setSpace(String space); - - /** - * the title of the page - */ - String getTitle(); - - void setTitle(String title); - - /** - * the url to view this blog entry online - */ - String getUrl(); - - void setUrl(String url); - - /** - * the version number of this blog entry - */ - int getVersion(); - - void setVersion(int version); - - /** - * the blog entry content - */ - String getContent(); - - void setContent(String content); - - /** - * the number of locks current on this page - */ - int getLocks(); - - void setLocks(int locks); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/SpaceSummary.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/SpaceSummary.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/SpaceSummary.java (working copy) @@ -1,63 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -/** - * Represents the details of a Space (SpaceSummary) as described in the http://confluence.atlassian.com/display/DOC/Remote+API+Specification. - * - * @version $Revision$ $Date$ - */ -public interface SpaceSummary extends MapObject -{ - - /** - * @return the key of the space, i.e. the unique space name - */ - String getKey(); - - void setKey(String key); - - /** - * @return a more descriptive name of the space - * In XWiki this can (an often will) be empty. - */ - String getName(); - - void setName(String name); - - /** - * @return The type of the space - */ - String getType(); - - void setType(String type); - - /** - * @return The url to view this space online. - * Example: "http://server/xwiki/bin/view/Space/WebHome" - */ - String getUrl(); - - void setUrl(String url); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/PageHistorySummary.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/PageHistorySummary.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/PageHistorySummary.java (working copy) @@ -1,57 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -import java.util.Date; - -public interface PageHistorySummary extends MapObject -{ - - /** - * the id of the historical page - */ - String getId(); - - void setId(String id); - - /** - * the version of this historical page - */ - int getVersion(); - - void setVersion(int version); - - /** - * the user who made this change - */ - String getModifier(); - - void setModifier(String modifier); - - /** - * timestamp change was made - */ - Date getModified(); - - void setModified(Date modified); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/Page.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/Page.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/Page.java (working copy) @@ -1,133 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -import java.util.Date; - -public interface Page extends MapObject -{ - /** - * the id of the page - */ - String getId(); - - void setId(String id); - - /** - * the key of the space that this page belongs to - */ - String getSpace(); - - void setSpace(String space); - - /** - * the id of the parent page - */ - String getParentId(); - - void setParentId(String parentId); - - /** - * the title of the page - */ - String getTitle(); - - void setTitle(String title); - - /** - * the url to view this page online - */ - String getUrl(); - - void setUrl(String url); - - /** - * the number of locks current on this page - */ - int getLocks(); - - void setLocks(int locks); - - /** - * the version number of this page - */ - int getVersion(); - - void setVersion(int version); - - /** - * the page content - */ - String getContent(); - - void setContent(String content); - - /** - * timestamp page was created - */ - Date getCreated(); - - void setCreated(Date created); - - /** - * username of the creator - */ - String getCreator(); - - void setCreator(String creator); - - /** - * timestamp page was modified - */ - Date getModified(); - - void setModified(Date modified); - - /** - * username of the page's last modifier - */ - String getModifier(); - - void setModifier(String modifier); - - /** - * whether or not this page is the space's homepage - */ - boolean isHomePage(); - - void setHomePage(boolean homePage); - - /** - * status of the page (eg current or deleted) - */ - String getContentStatus(); - - void setContentStatus(String contentStatus); - - /** - * whether the page is current and not deleted - */ - boolean isCurrent(); - - void setCurrent(boolean current); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/User.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/User.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/User.java (working copy) @@ -1,55 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface User extends MapObject -{ - - /** - * the username of this user - */ - String getName(); - - void setName(String name); - - /** - * the full name of this user - */ - String getFullname(); - - void setFullname(String fullname); - - /** - * the email address of this user - */ - String getEmail(); - - void setEmail(String email); - - /** - * the url to view this user online - */ - String getUrl(); - - void setUrl(String url); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/Label.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/Label.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/Label.java (working copy) @@ -1,55 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface Label extends MapObject -{ - - /** - * the name of the label - */ - String getName(); - - void setName(String name); - - /** - * the username of the owner - */ - String getOwner(); - - void setOwner(String owner); - - /** - * the namespace of the label - */ - String getNamespace(); - - void setNamespace(String namespace); - - /** - * the ID of the label - */ - String getId(); - - void setId(String id); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/ServerInfo.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/ServerInfo.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/ServerInfo.java (working copy) @@ -1,69 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface ServerInfo extends MapObject -{ - - /** - * the major version number of the Confluence instance - */ - int getMajorVersion(); - - void setMajorVersion(int majorVersion); - - /** - * the minor version number of the Confluence instance - */ - int getMinorVersion(); - - void setMinorVersion(int minorVersion); - - /** - * the patch-level of the Confluence instance - */ - int getPatchLevel(); - - void setPatchLevel(int patchLevel); - - /** - * the build ID of the Confluence instance (usually a number) - */ - String getBuildId(); - - void setBuildId(String buildId); - - /** - * Whether the build is a developer-only release or not - */ - boolean isDevelopmentBuild(); - - void setDevelopmentBuild(boolean developmentBuild); - - /** - * The base URL for the confluence instance - */ - String getBaseUrl(); - - void setBaseUrl(String baseUrl); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/BlogEntrySummary.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/BlogEntrySummary.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/BlogEntrySummary.java (working copy) @@ -1,71 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -import java.util.Date; - -public interface BlogEntrySummary extends MapObject -{ - - /** - * the id of the blog entry - */ - String getId(); - - void setId(String id); - - /** - * the key of the space that this blog entry belongs to - */ - String getSpace(); - - void setSpace(String space); - - /** - * the title of the blog entry - */ - String getTitle(); - - void setTitle(String title); - - /** - * the url to view this blog entry online - */ - String getUrl(); - - void setUrl(String url); - - /** - * the number of locks current on this page - */ - int getLocks(); - - void setLocks(int locks); - - /** - * the date the blog post was published - */ - Date getPublishDate(); - - void setPublishDate(Date publishDate); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/UserInformation.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/UserInformation.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/UserInformation.java (working copy) @@ -1,85 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -import java.util.Date; - -public interface UserInformation extends MapObject -{ - - /** - * the username of this user - */ - String getUsername(); - - void setUsername(String username); - - /** - * the user description - */ - String getContent(); - - void setContent(String content); - - /** - * the creator of the user - */ - String getCreatorName(); - - void setCreatorName(String creatorName); - - /** - * the url to view this user online - */ - String getLastModifierName(); - - void setLastModifierName(String lastModifierName); - - /** - * the version - */ - int getVersion(); - - void setVersion(int version); - - /** - * the ID of the user - */ - String getId(); - - void setId(String id); - - /** - * the date the user was created - */ - Date getCreationDate(); - - void setCreationDate(Date creationDate); - - /** - * the date the user was last modified - */ - Date getLastModificationDate(); - - void setLastModificationDate(Date lastModificationDate); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/UserImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/UserImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/UserImpl.java (working copy) @@ -1,123 +0,0 @@ -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import org.codehaus.swizzle.confluence.MapConvertor; -import org.codehaus.swizzle.confluence.SwizzleConversionException; - -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.xmlrpc.model.User; - -/** - * @author hritcu - * - */ -public class UserImpl implements User -{ - private org.codehaus.swizzle.confluence.User target; - - public UserImpl() - { - target = new org.codehaus.swizzle.confluence.User(); - } - - public UserImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.User(map); - } - - public UserImpl(Map map, MapConvertor convertor) throws XWikiException - { - Map typeMap = org.codehaus.swizzle.confluence.User.FIELD_TYPES; - try { - target = new org.codehaus.swizzle.confluence.User(convertor.revert(map, typeMap)); - } catch (SwizzleConversionException e) { - throw new XWikiException(XWikiException.MODULE_XWIKI_XMLRPC, 0, e.getMessage(), e); - } - } - - public UserImpl(org.codehaus.swizzle.confluence.User user) - { - target = user; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#getEmail() - */ - public String getEmail() - { - return target.getEmail(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#getFullname() - */ - public String getFullname() - { - return target.getFullname(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#getName() - */ - public String getName() - { - return getName(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#getUrl() - */ - public String getUrl() - { - return getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#setEmail(java.lang.String) - */ - public void setEmail(String email) - { - target.setEmail(email); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#setFullname(java.lang.String) - */ - public void setFullname(String fullname) - { - target.setFullname(fullname); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#setName(java.lang.String) - */ - public void setName(String name) - { - target.setName(name); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.User#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap() - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.User getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/LabelImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/LabelImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/LabelImpl.java (working copy) @@ -1,110 +0,0 @@ -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.Label; - -/** - * @author hritcu - * - */ -public class LabelImpl implements Label -{ - - private org.codehaus.swizzle.confluence.Label target; - - public LabelImpl() - { - target = new org.codehaus.swizzle.confluence.Label(); - } - - public LabelImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.Label(map); - } - - public LabelImpl(org.codehaus.swizzle.confluence.Label label) - { - target = label; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#getName() - */ - public String getName() - { - return target.getName(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#getNamespace() - */ - public String getNamespace() - { - return target.getNamespace(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#getOwner() - */ - public String getOwner() - { - return target.getOwner(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#setName(java.lang.String) - */ - public void setName(String name) - { - target.setName(name); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#setNamespace(java.lang.String) - */ - public void setNamespace(String namespace) - { - target.setNamespace(namespace); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Label#setOwner(java.lang.String) - */ - public void setOwner(String owner) - { - target.setOwner(owner); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap() - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.Label getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/ServerInfoImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/ServerInfoImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/ServerInfoImpl.java (working copy) @@ -1,158 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.ServerInfo; - -/** - * @author hritcu - * - */ -public class ServerInfoImpl implements ServerInfo -{ - - private org.codehaus.swizzle.confluence.ServerInfo target; - - public ServerInfoImpl() - { - target = new org.codehaus.swizzle.confluence.ServerInfo(); - } - - public ServerInfoImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.ServerInfo(map); - } - - public ServerInfoImpl(org.codehaus.swizzle.confluence.ServerInfo serverInfo) - { - target = serverInfo; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#getBaseUrl() - */ - public String getBaseUrl() - { - return target.getBaseUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#getBuildId() - */ - public String getBuildId() - { - return target.getBuildId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#getMajorVersion() - */ - public int getMajorVersion() - { - return target.getMajorVersion(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#getMinorVersion() - */ - public int getMinorVersion() - { - return target.getMinorVersion(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#getPatchLevel() - */ - public int getPatchLevel() - { - return target.getPatchLevel(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#isDevelopmentBuild() - */ - public boolean isDevelopmentBuild() - { - return target.isDevelopmentBuild(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#setBaseUrl(java.lang.String) - */ - public void setBaseUrl(String baseUrl) - { - target.setBaseUrl(baseUrl); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#setBuildId(java.lang.String) - */ - public void setBuildId(String buildId) - { - target.setBuildId(buildId); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#setDevelopmentBuild(boolean) - */ - public void setDevelopmentBuild(boolean developmentBuild) - { - target.setDevelopmentBuild(developmentBuild); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#setMajorVersion(int) - */ - public void setMajorVersion(int majorVersion) - { - target.setMajorVersion(majorVersion); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#setMinorVersion(int) - */ - public void setMinorVersion(int minorVersion) - { - target.setMinorVersion(minorVersion); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.ServerInfo#setPatchLevel(int) - */ - public void setPatchLevel(int patchLevel) - { - target.setPatchLevel(patchLevel); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/BlogEntrySummaryImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/BlogEntrySummaryImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/BlogEntrySummaryImpl.java (working copy) @@ -1,137 +0,0 @@ -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Date; -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.BlogEntrySummary; - -/** - * @author hritcu - * - */ -public class BlogEntrySummaryImpl implements BlogEntrySummary -{ - private org.codehaus.swizzle.confluence.BlogEntrySummary target; - - public BlogEntrySummaryImpl() - { - target = new org.codehaus.swizzle.confluence.BlogEntrySummary(); - } - - public BlogEntrySummaryImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.BlogEntrySummary(map); - } - - public BlogEntrySummaryImpl(org.codehaus.swizzle.confluence.BlogEntrySummary blogEntrySummary) - { - target = blogEntrySummary; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#getLocks() - */ - public int getLocks() - { - return target.getLocks(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#getPublishDate() - */ - public Date getPublishDate() - { - return target.getPublishDate(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#getSpace() - */ - public String getSpace() - { - return target.getSpace(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#getTitle() - */ - public String getTitle() - { - return target.getTitle(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#setLocks(int) - */ - public void setLocks(int locks) - { - target.setLocks(locks); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#setPublishDate(java.util.Date) - */ - public void setPublishDate(Date publishDate) - { - target.setPublishDate(publishDate); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#setSpace(java.lang.String) - */ - public void setSpace(String space) - { - target.setSpace(space); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#setTitle(java.lang.String) - */ - public void setTitle(String title) - { - target.setTitle(title); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntrySummary#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap() - */ - public Map toMap() - { - return target.toMap(); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/UserInformationImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/UserInformationImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/UserInformationImpl.java (working copy) @@ -1,175 +0,0 @@ -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Date; -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.UserInformation; - -/** - * @author hritcu - * - */ -public class UserInformationImpl implements UserInformation -{ - private org.codehaus.swizzle.confluence.UserInformation target; - - public UserInformationImpl() - { - target = new org.codehaus.swizzle.confluence.UserInformation(); - } - - public UserInformationImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.UserInformation(map); - } - - public UserInformationImpl(org.codehaus.swizzle.confluence.UserInformation userInformation) - { - target = userInformation; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getContent() - */ - public String getContent() - { - return target.getContent(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getCreationDate() - */ - public Date getCreationDate() - { - return target.getCreationDate(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getCreatorName() - */ - public String getCreatorName() - { - return target.getCreatorName(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getLastModificationDate() - */ - public Date getLastModificationDate() - { - return target.getLastModificationDate(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getLastModifierName() - */ - public String getLastModifierName() - { - return target.getLastModifierName(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getUsername() - */ - public String getUsername() - { - return target.getUsername(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#getVersion() - */ - public int getVersion() - { - return target.getVersion(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setContent(java.lang.String) - */ - public void setContent(String content) - { - target.setContent(content); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setCreationDate(java.util.Date) - */ - public void setCreationDate(Date creationDate) - { - target.setCreationDate(creationDate); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setCreatorName(java.lang.String) - */ - public void setCreatorName(String creatorName) - { - target.setCreatorName(creatorName); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setLastModificationDate(java.util.Date) - */ - public void setLastModificationDate(Date lastModificationDate) - { - target.setLastModificationDate(lastModificationDate); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setLastModifierName(java.lang.String) - */ - public void setLastModifierName(String lastModifierName) - { - target.setLastModifierName(lastModifierName); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setUsername(java.lang.String) - */ - public void setUsername(String username) - { - target.setUsername(username); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.UserInformation#setVersion(int) - */ - public void setVersion(int version) - { - target.setVersion(version); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap() - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.UserInformation getTarget() - { - return target; - } - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PermissionImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PermissionImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PermissionImpl.java (working copy) @@ -1,72 +0,0 @@ -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.Permission; - -/** - * @author hritcu - * - */ -public class PermissionImpl implements Permission -{ - private org.codehaus.swizzle.confluence.Permission target; - - public PermissionImpl() - { - target = new org.codehaus.swizzle.confluence.Permission(); - } - - public PermissionImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.Permission(map); - } - - public PermissionImpl(org.codehaus.swizzle.confluence.Permission permission) - { - target = permission; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Permission#getLockType() - */ - public String getLockType() - { - return target.getLockType(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Permission#getLockedBy() - */ - public String getLockedBy() - { - return target.getLockedBy(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Permission#setLockType(java.lang.String) - */ - public void setLockType(String lockType) - { - target.setLockType(lockType); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Permission#setLockedBy(java.lang.String) - */ - public void setLockedBy(String lockedBy) - { - target.setLockedBy(lockedBy); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap() - */ - public Map toMap() - { - return target.toMap(); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/AttachmentImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/AttachmentImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/AttachmentImpl.java (working copy) @@ -1,240 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Date; -import java.util.Map; - -import org.codehaus.swizzle.confluence.MapConvertor; -import org.codehaus.swizzle.confluence.SwizzleConversionException; - -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.xmlrpc.model.Attachment; - - -/** - * @author hritcu - * - */ -public class AttachmentImpl implements Attachment -{ - - private org.codehaus.swizzle.confluence.Attachment target; - - public AttachmentImpl() - { - target = new org.codehaus.swizzle.confluence.Attachment(); - } - - public AttachmentImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.Attachment(map); - } - - public AttachmentImpl(Map map, MapConvertor convertor) throws XWikiException - { - Map typeMap = org.codehaus.swizzle.confluence.Attachment.FIELD_TYPES; - try { - target = new org.codehaus.swizzle.confluence.Attachment(convertor.revert(map, typeMap)); - } catch (SwizzleConversionException e) { - throw new XWikiException(XWikiException.MODULE_XWIKI_XMLRPC, 0, e.getMessage(), e); - } - } - - public AttachmentImpl(org.codehaus.swizzle.confluence.Attachment attachment) - { - target = attachment; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getComment() - */ - public String getComment() - { - return target.getComment(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getContentType() - */ - public String getContentType() - { - return target.getContentType(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getCreated() - */ - public Date getCreated() - { - return target.getCreated(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getCreator() - */ - public String getCreator() - { - return target.getCreator(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getFileName() - */ - public String getFileName() - { - return target.getFileName(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getFileSize() - */ - public int getFileSize() - { - return target.getFileSize(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getPageId() - */ - public String getPageId() - { - return target.getPageId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getTitle() - */ - public String getTitle() - { - return target.getTitle(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setComment(java.lang.String) - */ - public void setComment(String comment) - { - target.setComment(comment); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setContentType(java.lang.String) - */ - public void setContentType(String contentType) - { - target.setContentType(contentType); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setCreated(java.util.Date) - */ - public void setCreated(Date created) - { - target.setCreated(created); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setCreator(java.lang.String) - */ - public void setCreator(String creator) - { - target.setCreator(creator); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setFileName(java.lang.String) - */ - public void setFileName(String fileName) - { - target.setFileName(fileName); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setFileSize(int) - */ - public void setFileSize(int fileSize) - { - target.setFileSize(fileSize); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setPageId(java.lang.String) - */ - public void setPageId(String pageId) - { - target.setPageId(pageId); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setTitle(java.lang.String) - */ - public void setTitle(String title) - { - target.setTitle(title); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Attachment#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.Attachment getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageSummaryImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageSummaryImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageSummaryImpl.java (working copy) @@ -1,163 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.PageSummary; - -/** - * @author hritcu - * - */ -public class PageSummaryImpl implements PageSummary -{ - - private org.codehaus.swizzle.confluence.PageSummary target; - - public PageSummaryImpl() - { - target = new org.codehaus.swizzle.confluence.PageSummary(); - } - - public PageSummaryImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.PageSummary(map); - } - - public PageSummaryImpl(org.codehaus.swizzle.confluence.PageSummary pageSummary) - { - target = pageSummary; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getLocks() - */ - public int getLocks() - { - return target.getLocks(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getParentId() - */ - public String getParentId() - { - return target.getParentId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getSpace() - */ - public String getSpace() - { - return target.getSpace(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getTitle() - */ - public String getTitle() - { - return target.getTitle(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setLocks(int) - */ - public void setLocks(int locks) - { - target.setLocks(locks); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setParentId(java.lang.String) - */ - public void setParentId(String parentId) - { - target.setParentId(parentId); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setSpace(java.lang.String) - */ - public void setSpace(String space) - { - target.setSpace(space); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setTitle(java.lang.String) - */ - public void setTitle(String title) - { - target.setTitle(title); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.PageSummary getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SpaceImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SpaceImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SpaceImpl.java (working copy) @@ -1,173 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import org.codehaus.swizzle.confluence.MapConvertor; -import org.codehaus.swizzle.confluence.SwizzleConversionException; - -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.xmlrpc.model.Space; - -/** - * @author hritcu - * - */ -public class SpaceImpl implements Space -{ - - private org.codehaus.swizzle.confluence.Space target; - - public SpaceImpl() - { - target = new org.codehaus.swizzle.confluence.Space(); - } - - public SpaceImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.Space(map); - } - - public SpaceImpl(Map map, MapConvertor convertor) throws XWikiException - { - Map typeMap = org.codehaus.swizzle.confluence.Space.FIELD_TYPES; - try { - target = new org.codehaus.swizzle.confluence.Space(convertor.revert(map, typeMap)); - } catch (SwizzleConversionException e) { - throw new XWikiException(XWikiException.MODULE_XWIKI_XMLRPC, 0, e.getMessage(), e); - } - } - - public SpaceImpl(org.codehaus.swizzle.confluence.Space space) - { - target = space; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#getDescription() - */ - public String getDescription() - { - return target.getDescription(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#getHomePage() - */ - public String getHomePage() - { - return target.getHomepage(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#getKey() - */ - public String getKey() - { - return target.getKey(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#getName() - */ - public String getName() - { - return target.getName(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#getType() - */ - public String getType() - { - return target.getType(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#setDescription(java.lang.String) - */ - public void setDescription(String description) - { - target.setDescription(description); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#setHomePage(String) - */ - public void setHomePage(String homepage) - { - target.setHomepage(homepage); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#setKey(java.lang.String) - */ - public void setKey(String key) - { - target.setKey(key); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#setName(java.lang.String) - */ - public void setName(String name) - { - target.setName(name); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#setType(java.lang.String) - */ - public void setType(String type) - { - target.setType(type); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Space#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap() - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.Space getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/CommentImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/CommentImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/CommentImpl.java (working copy) @@ -1,194 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Date; -import java.util.Map; - -import org.codehaus.swizzle.confluence.MapConvertor; -import org.codehaus.swizzle.confluence.SwizzleConversionException; - -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.xmlrpc.model.Comment; - -/** - * @author hritcu - * - */ -public class CommentImpl implements Comment -{ - - private org.codehaus.swizzle.confluence.Comment target; - - public CommentImpl() - { - target = new org.codehaus.swizzle.confluence.Comment(); - } - - public CommentImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.Comment(map); - } - - public CommentImpl(Map map, MapConvertor convertor) throws XWikiException - { - Map typeMap = org.codehaus.swizzle.confluence.Comment.FIELD_TYPES; - try { - target = new org.codehaus.swizzle.confluence.Comment(convertor.revert(map, typeMap)); - } catch (SwizzleConversionException e) { - throw new XWikiException(XWikiException.MODULE_XWIKI_XMLRPC, 0, e.getMessage(), e); - } - } - - public CommentImpl(org.codehaus.swizzle.confluence.Comment comment) - { - target = comment; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#getContent() - */ - public String getContent() - { - return target.getContent(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#getCreated() - */ - public Date getCreated() - { - return target.getCreated(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#getCreator() - */ - public String getCreator() - { - return target.getCreator(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#getPageId() - */ - public String getPageId() - { - return target.getPageId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#getTitle() - */ - public String getTitle() - { - return target.getTitle(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#setContent(java.lang.String) - */ - public void setContent(String content) - { - target.setContent(content); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#setCreated(java.util.Date) - */ - public void setCreated(Date created) - { - target.setCreated(created); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#setCreator(java.lang.String) - */ - public void setCreator(String creator) - { - target.setCreator(creator); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#setPageId(java.lang.String) - */ - public void setPageId(String pageId) - { - target.setPageId(pageId); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#setTitle(java.lang.String) - */ - public void setTitle(String title) - { - target.setTitle(title); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Comment#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.Comment getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SearchResultImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SearchResultImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SearchResultImpl.java (working copy) @@ -1,142 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.SearchResult; - -/** - * @author hritcu - * - */ -public class SearchResultImpl implements SearchResult -{ - - private org.codehaus.swizzle.confluence.SearchResult target; - - public SearchResultImpl() - { - target = new org.codehaus.swizzle.confluence.SearchResult(); - } - - public SearchResultImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.SearchResult(map); - } - - public SearchResultImpl(org.codehaus.swizzle.confluence.SearchResult searchResult) - { - target = searchResult; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#getExcerpt() - */ - public String getExcerpt() - { - return target.getExcerpt(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#getTitle() - */ - public String getTitle() - { - return target.getTitle(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#getType() - */ - public String getType() - { - return target.getType(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#setExcerpt(java.lang.String) - */ - public void setExcerpt(String excerpt) - { - target.setExcerpt(excerpt); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#setTitle(java.lang.String) - */ - public void setTitle(String title) - { - target.setTitle(title); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#setType(java.lang.String) - */ - public void setType(String type) - { - target.setType(type); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SearchResult#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/BlogEntryImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/BlogEntryImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/BlogEntryImpl.java (working copy) @@ -1,158 +0,0 @@ -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.BlogEntry; - -/** - * @author hritcu - * - */ -public class BlogEntryImpl implements BlogEntry -{ - - private org.codehaus.swizzle.confluence.BlogEntry target; - - public BlogEntryImpl() - { - target = new org.codehaus.swizzle.confluence.BlogEntry(); - } - - public BlogEntryImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.BlogEntry(map); - } - - public BlogEntryImpl(org.codehaus.swizzle.confluence.BlogEntry blogEntry) - { - target = blogEntry; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#getContent() - */ - public String getContent() - { - return target.getContent(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#getLocks() - */ - public int getLocks() - { - return target.getLocks(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#getSpace() - */ - public String getSpace() - { - return target.getSpace(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#getTitle() - */ - public String getTitle() - { - return target.getTitle(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#getVersion() - */ - public int getVersion() - { - return target.getVersion(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#setContent(java.lang.String) - */ - public void setContent(String content) - { - target.setContent(content); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#setLocks(int) - */ - public void setLocks(int locks) - { - target.setLocks(locks); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#setSpace(java.lang.String) - */ - public void setSpace(String space) - { - target.setSpace(space); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#setTitle(java.lang.String) - */ - public void setTitle(String title) - { - target.setTitle(title); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.BlogEntry#setVersion(int) - */ - public void setVersion(int version) - { - target.setVersion(version); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap() - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.BlogEntry getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SpaceSummaryImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SpaceSummaryImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/SpaceSummaryImpl.java (working copy) @@ -1,121 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.SpaceSummary; - -/** - * @author hritcu - * - */ -public class SpaceSummaryImpl implements SpaceSummary -{ - private org.codehaus.swizzle.confluence.SpaceSummary target; - - public SpaceSummaryImpl() - { - target = new org.codehaus.swizzle.confluence.SpaceSummary(); - } - - public SpaceSummaryImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.SpaceSummary(map); - } - - public SpaceSummaryImpl(org.codehaus.swizzle.confluence.SpaceSummary spaceSummary) - { - target = spaceSummary; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#getKey() - */ - public String getKey() - { - return target.getKey(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#getName() - */ - public String getName() - { - return target.getName(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#getType() - */ - public String getType() - { - return target.getType(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#setKey(java.lang.String) - */ - public void setKey(String key) - { - target.setKey(key); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#setName(java.lang.String) - */ - public void setName(String name) - { - target.setName(name); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#setType(java.lang.String) - */ - public void setType(String type) - { - target.setType(type); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.SpaceSummary#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageImpl.java (working copy) @@ -1,318 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Date; -import java.util.Map; - -import org.codehaus.swizzle.confluence.MapConvertor; -import org.codehaus.swizzle.confluence.SwizzleConversionException; - -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.xmlrpc.model.Page; - -/** - * @author hritcu - * - */ -public class PageImpl implements Page -{ - - private org.codehaus.swizzle.confluence.Page target; - - public PageImpl() - { - target = new org.codehaus.swizzle.confluence.Page(); - } - - public PageImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.Page(map); - } - - public PageImpl(Map map, MapConvertor convertor) throws XWikiException - { - Map typeMap = org.codehaus.swizzle.confluence.Page.FIELD_TYPES; - try { - target = new org.codehaus.swizzle.confluence.Page(convertor.revert(map, typeMap)); - } catch (SwizzleConversionException e) { - throw new XWikiException(XWikiException.MODULE_XWIKI_XMLRPC, 0, e.getMessage(), e); - } - } - - public PageImpl(org.codehaus.swizzle.confluence.Page page) - { - target = page; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getLocks() - */ - public int getLocks() - { - return target.getLocks(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getParentId() - */ - public String getParentId() - { - return target.getParentId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getSpace() - */ - public String getSpace() - { - return target.getSpace(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getTitle() - */ - public String getTitle() - { - return target.getTitle(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#getUrl() - */ - public String getUrl() - { - return target.getUrl(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setLocks(int) - */ - public void setLocks(int locks) - { - target.setLocks(locks); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setParentId(java.lang.String) - */ - public void setParentId(String parentId) - { - target.setParentId(parentId); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setSpace(java.lang.String) - */ - public void setSpace(String space) - { - target.setSpace(space); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setTitle(java.lang.String) - */ - public void setTitle(String title) - { - target.setTitle(title); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageSummary#setUrl(java.lang.String) - */ - public void setUrl(String url) - { - target.setUrl(url); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#getContent() - */ - public String getContent() - { - return target.getContent(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#getContentStatus() - */ - public String getContentStatus() - { - return target.getContentStatus(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#getCreated() - */ - public Date getCreated() - { - return target.getCreated(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#getCreator() - */ - public String getCreator() - { - return target.getCreator(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#getModified() - */ - public Date getModified() - { - return target.getModified(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#getModifier() - */ - public String getModifier() - { - return target.getModifier(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#getVersion() - */ - public int getVersion() - { - return target.getVersion(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#isCurrent() - */ - public boolean isCurrent() - { - return target.isCurrent(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#isHomePage() - */ - public boolean isHomePage() - { - return target.isHomePage(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setContent(java.lang.String) - */ - public void setContent(String content) - { - target.setContent(content); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setContentStatus(java.lang.String) - */ - public void setContentStatus(String contentStatus) - { - target.setContentStatus(contentStatus); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setCreated(java.util.Date) - */ - public void setCreated(Date created) - { - target.setCreated(created); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setCreator(java.lang.String) - */ - public void setCreator(String creator) - { - target.setCreator(creator); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setCurrent(boolean) - */ - public void setCurrent(boolean current) - { - target.setCurrent(current); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setHomePage(boolean) - */ - public void setHomePage(boolean homePage) - { - target.setHomePage(homePage); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setModified(java.util.Date) - */ - public void setModified(Date modified) - { - target.setModified(modified); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setModifier(java.lang.String) - */ - public void setModifier(String modifier) - { - target.setModifier(modifier); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.Page#setVersion(int) - */ - public void setVersion(int version) - { - target.setVersion(version); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } - - public org.codehaus.swizzle.confluence.Page getTarget() - { - return target; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageHistorySummaryImpl.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageHistorySummaryImpl.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/swizzle/PageHistorySummaryImpl.java (working copy) @@ -1,127 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -/** - * - */ -package com.xpn.xwiki.xmlrpc.model.swizzle; - -import java.util.Date; -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.PageHistorySummary; - -/** - * @author hritcu - * - */ -public class PageHistorySummaryImpl implements PageHistorySummary -{ - - private org.codehaus.swizzle.confluence.PageHistorySummary target; - - public PageHistorySummaryImpl() - { - target = new org.codehaus.swizzle.confluence.PageHistorySummary(); - } - - public PageHistorySummaryImpl(Map map) - { - target = new org.codehaus.swizzle.confluence.PageHistorySummary(map); - } - - public PageHistorySummaryImpl(org.codehaus.swizzle.confluence.PageHistorySummary phs) - { - target = phs; - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#getId() - */ - public String getId() - { - return target.getId(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#getModified() - */ - public Date getModified() - { - return target.getModified(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#getModifier() - */ - public String getModifier() - { - return target.getModifier(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#getVersion() - */ - public int getVersion() - { - return target.getVersion(); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#setId(java.lang.String) - */ - public void setId(String id) - { - target.setId(id); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#setModified(java.util.Date) - */ - public void setModified(Date modified) - { - target.setModified(modified); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#setModifier(java.lang.String) - */ - public void setModifier(String modifier) - { - target.setModifier(modifier); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.PageHistorySummary#setVersion(int) - */ - public void setVersion(int version) - { - target.setVersion(version); - } - - /** - * @see com.xpn.xwiki.xmlrpc.model.MapObject#toMap(java.lang.String) - */ - public Map toMap() - { - return target.toMap(); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/Permission.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/Permission.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/Permission.java (working copy) @@ -1,41 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface Permission extends MapObject -{ - - /** - * The type of permission. One of 'View' or 'Edit' - */ - String getLockType(); - - void setLockType(String lockType); - - /** - * The user or group name of the permission's owner - */ - String getLockedBy(); - - void setLockedBy(String lockedBy); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/Attachment.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/Attachment.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/Attachment.java (working copy) @@ -1,119 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -import java.util.Date; - -/** - * Represents an Attachment as described in the - * http://confluence.atlassian.com/display/DOC/Remote+API+Specification. - * - * @version $Revision$ $Date$ - */ -public interface Attachment extends MapObject -{ - - /** - * numeric id of the attachment - */ - String getId(); - - void setId(String id); - - /** - * page ID of the attachment - */ - - String getPageId(); - - void setPageId(String pageId); - - /** - * @return the title of the attachment - */ - String getTitle(); - - void setTitle(String title); - - /** - * @return The file name of the attachment. - */ - String getFileName(); - - /** - * @param fileName The file name of the attachment {color:#cc3300}(Required){color}. - * For example "picture.jpg". - */ - void setFileName(String fileName); - - /** - * @return the size of the attachment in bytes - */ - int getFileSize(); - - /** - * @param fileSize the size of the attachment in bytes (encoded as a String) - * Confluence expects this number encoded as a String and swizzle takes care of the encoding. - */ - void setFileSize(int fileSize); - - /** - * @return the MIME content type of the attachment. - */ - String getContentType(); - - /** - * @param contentType the MIME content type of the attachment. - * {color:#cc0000}Required{color} by Confluence. - * Ignored by XWiki which computes the content type from the file extension. - */ - void setContentType(String contentType); - - /** - * @return the creation date of the attachment - */ - Date getCreated(); - - void setCreated(Date created); - - /** - * @return the name of the user that created of the attachment - */ - String getCreator(); - - void setCreator(String creator); - - /** - * @return the url to download the attachment - */ - String getUrl(); - - void setUrl(String url); - - /** - * @return comment for the attachment {color:#cc3300}(Required){color} - */ - String getComment(); - - void setComment(String comment); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/PageSummary.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/PageSummary.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/PageSummary.java (working copy) @@ -1,69 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface PageSummary extends MapObject -{ - - /** - * the id of the page - */ - String getId(); - - void setId(String id); - - /** - * the key of the space that this page belongs to - */ - String getSpace(); - - void setSpace(String space); - - /** - * the id of the parent page - */ - String getParentId(); - - void setParentId(String parentId); - - /** - * the title of the page - */ - String getTitle(); - - void setTitle(String title); - - /** - * the url to view this page online - */ - String getUrl(); - - void setUrl(String url); - - /** - * the number of locks current on this page - */ - int getLocks(); - - void setLocks(int locks); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/Space.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/Space.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/Space.java (working copy) @@ -1,69 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface Space extends MapObject -{ - - /** - * the space key - */ - String getKey(); - - void setKey(String key); - - /** - * the name of the space - */ - String getName(); - - void setName(String name); - - /** - * type of the space (not documented) - */ - String getType(); - - void setType(String type); - - /** - * the url to view this space online - */ - String getUrl(); - - void setUrl(String url); - - /** - * the id of the space homepage - */ - String getHomePage(); - - void setHomePage(String homepage); - - /** - * the HTML rendered space description - */ - String getDescription(); - - void setDescription(String description); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/model/RssFeed.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/model/RssFeed.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/model/RssFeed.java (working copy) @@ -1,41 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc.model; - -public interface RssFeed extends MapObject -{ - - /** - * the URL of the RSS feed - */ - String getUrl(); - - void setUrl(String url); - - /** - * the feed's title - */ - String getTitle(); - - void setTitle(String title); - -} Index: src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcUser.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcUser.java (revision 0) +++ src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcUser.java (revision 0) @@ -0,0 +1,49 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * + */ +package com.xpn.xwiki.xmlrpc; + +/** + * This is an helper class for storing XMLRPC user information. + * + * @author fmancinelli + */ +public class XWikiXmlRpcUser +{ + private String userName; + + private String remoteIp; + + public XWikiXmlRpcUser(String userName, String remoteIp) + { + this.userName = userName; + this.remoteIp = remoteIp; + } + + public String getName() + { + return userName; + } + + public String getRemoteIp() + { + return remoteIp; + } +} Index: src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcHttpRequestConfig.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcHttpRequestConfig.java (revision 0) +++ src/main/java/com/xpn/xwiki/xmlrpc/XWikiXmlRpcHttpRequestConfig.java (revision 0) @@ -0,0 +1,46 @@ +/* + * See the NOTICE file distributed with this work for additional + * information regarding copyright ownership. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + * + */ +package com.xpn.xwiki.xmlrpc; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl; + +/** + * This is an helper class for storing the current HTTP request coming from an XMLRPC client + * interacting with the XMLRPC endpoint servlet + * + * @author fmancinelli + */ +public class XWikiXmlRpcHttpRequestConfig extends XmlRpcHttpRequestConfigImpl +{ + private HttpServletRequest request; + + public XWikiXmlRpcHttpRequestConfig(HttpServletRequest request) + { + this.request = request; + } + + public HttpServletRequest getRequest() + { + return request; + } +} Index: src/main/java/com/xpn/xwiki/xmlrpc/ConfluenceRpcHandler.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/ConfluenceRpcHandler.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/ConfluenceRpcHandler.java (working copy) @@ -1,1286 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - * - */ - -package com.xpn.xwiki.xmlrpc; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import javax.servlet.Servlet; -import javax.servlet.ServletRequest; - -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.velocity.VelocityContext; -import org.codehaus.swizzle.confluence.ConfluenceObjectConvertor; -import org.codehaus.swizzle.confluence.IdentityObjectConvertor; -import org.codehaus.swizzle.confluence.MapConvertor; -import org.suigeneris.jrcs.rcs.Version; - -import com.xpn.xwiki.XWiki; -import com.xpn.xwiki.XWikiContext; -import com.xpn.xwiki.XWikiException; -import com.xpn.xwiki.doc.XWikiAttachment; -import com.xpn.xwiki.doc.XWikiDocument; -import com.xpn.xwiki.objects.BaseObject; -import com.xpn.xwiki.objects.classes.BaseClass; -import com.xpn.xwiki.web.Utils; -import com.xpn.xwiki.xmlrpc.model.Attachment; -import com.xpn.xwiki.xmlrpc.model.Comment; -import com.xpn.xwiki.xmlrpc.model.MapObject; -import com.xpn.xwiki.xmlrpc.model.Page; -import com.xpn.xwiki.xmlrpc.model.PageHistorySummary; -import com.xpn.xwiki.xmlrpc.model.PageSummary; -import com.xpn.xwiki.xmlrpc.model.SearchResult; -import com.xpn.xwiki.xmlrpc.model.Space; -import com.xpn.xwiki.xmlrpc.model.SpaceSummary; -import com.xpn.xwiki.xmlrpc.model.swizzle.AttachmentImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.CommentImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.PageImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.SpaceImpl; - -/** - * Implements the - * Confluence XML-RPC interface. Provides all the operations that can be done remotely on a - * XWiki instance using the XML-RPC protocol. - * - *

- * Note: Lots of the Javadoc comments below are borrowed from the - * Confluence Javadoc. - *

- * - *

Note: Ids (eg. page ids) should be treated as opaque handlers. If you ever find yourself parsing them - * then you are doing something wrong.

- * - * @version $Id: $ - * - */ -public class ConfluenceRpcHandler extends BaseRpcHandler -{ - // TODO Also run the tests for unprivileged users with just enough rights - // -- user management could be a part of the test setup - - // Q: Where are access rights checked ? Ensure they are ! - // Vincent discovered that they are not checked ... was it fixed? - - // TODO Use the log for more than login, logout and errors - - // TODO Refactor - Get rid of duplicate code: - // - inside the xml-rpc implementation itself (there is too much plumbing) - // - between xml-rpc and actions (important but hard!) - - // TODO enabling exceptions doesn't really work in xml-rpc versions before 3.1 - - private static final Log log = LogFactory.getLog(ConfluenceRpcHandler.class); - - private DomainObjectFactory factory = new DomainObjectFactory(); - - private MapConvertor convertor; - - private class RemoteUser - { - - public RemoteUser(String username, String ip) - { - this.ip = ip; - this.username = username; - } - - public String ip; - - public String username; - } - - public void init(Servlet servlet, ServletRequest request) throws XWikiException - { - super.init(servlet, request); - - // we are interoperable with Confluence by default - setConvertor(new MapConvertor( new ConfluenceObjectConvertor())); - } - - - // Authentication Methods - - - /** - * Logs the user into XWiki. The security token which is returned is used in all subsequent - * method calls. You can supply an empty string as the token to be treated as being the - * anonymous user (XWiki.XWikiGuest). - * - * @param username the username of the person logged in as - * @param password the appropriate password - * @return A string which is a security token to be used in all subsequent calls - * @throws XWikiException in case of error - */ - public String login(String username, String password) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - String token; - - if (xwiki.getAuthService().authenticate(username, password, context) != null) { - // Generate "unique" token using a random number - token = xwiki.generateValidationKey(128); - String ip = context.getRequest().getRemoteAddr(); - getTokens(context).put(token, new RemoteUser("XWiki." + username, ip)); - log.info("Logged in '" + username + "'"); - return token; - } else { - throw exception("Failed authentication for user '" + username + "'."); - } - } - - /** - * Logs the user out of XWiki. - * - * @param token the authentication token retrieved when calling the login method - * @return whether the logging out was successful or not - * @throws XWikiException in case of error - */ - public boolean logout(String token) throws XWikiException - { - XWikiContext context = getXWikiContext(); - checkToken(token, context); - - return getTokens(context).remove(token) != null; - } - - - // General - - - /** - * Retrieve some basic information about the server being connected to. Useful for clients that - * need to turn certain features on or off depending on the version of the server. - * - * @param token the authentication token retrieved when calling the login method - * @return the Server information such as Server base URL and Server version. The returned map - * contains the fields from {@linkServerInfo}. - * @throws XWikiException in case of error - */ - public Map getServerInfo(String token) throws XWikiException - { - // TODO this should return as if this was Confluence - // the version should be the largest one we implement fully - // ServerInfo info = new ServerInfo(); - // info.setBaseUrl(baseUrl); - // - // info.setMajorVersion(1); - // info.setMinorVersion(0); - // info.setPatchLevel(0); - // - // return info.getParameters(); - - throw exception("Not implemented.", XWikiException.ERROR_XWIKI_NOT_IMPLEMENTED); - } - - - // Space Retrieval - - - /** - * Get the summaries of all spaces the user can view. - * - * @param token the authentication token retrieved when calling the login method - * @return all the SpaceSummaries that the current user can see. - * @throws XWikiException in case of error - */ - public Object[] getSpaces(String token) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - checkToken(token, context); - - List spaces = xwiki.getSpaces(context); - ArrayList result = new ArrayList(spaces.size()); - for (int i = 0; i < spaces.size(); i++) { - String key = (String) spaces.get(i); - String fullName = key + ".WebHome"; - XWikiDocument doc = xwiki.getDocument(fullName, context); - String name = doc.getTitle(); - String url = doc.getURL("view", context); - SpaceSummary spacesum = factory.createSpaceSummary(key, name, url); - result.add(convert(spacesum)); - } - return result.toArray(); - } - - /** - * Get one Space. - * - * @param token the authentication token retrieved when calling the login method - * @param spaceKey identifier for space - * @return a single Space object as xml-rpc representation - * @throws XWikiException in case of error - */ - public Map getSpace(String token, String spaceKey) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - checkToken(token, context); - - String fullName = spaceKey + "." + "WebHome"; - if (xwiki.exists(fullName, context)) { - XWikiDocument doc = xwiki.getDocument(fullName, context); - String url = doc.getURL("view", context); - String name = doc.getTitle(); - Space space = factory.createSpace(spaceKey, name, url, "", fullName); - return convert(space); - } else { - throw exception("The space '" + spaceKey + "' does not exist."); - } - - } - - - // Space Management - - - // TODO JavaDoc: we SAY we require description, but we discard it! - // we can also live without a space name - /** - * Create a new space. - * - * @param token the authentication token retrieved when calling the login method - * @param spaceMap Map containing all informations, we need to create a new space. We - * need the following keys: - key "name": the name of the space - key "key": the - * space key - key "description": the space description - * @return created Space as xml-rpc representation - * @throws XWikiException in case of error - */ - public Map addSpace(String token, Map spaceMap) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("save"); - checkToken(token, context); - - Space space = new SpaceImpl(spaceMap, convertor); - String spaceKey = space.getKey(); - String fullName = spaceKey + "." + "WebHome"; - if (!xwiki.exists(fullName, context)) { - // Create a new WebHome document and store it - XWikiDocument doc = new XWikiDocument(spaceKey, "WebHome"); - doc.setAuthor(context.getUser()); - if (space.getName() != null) { - doc.setTitle(space.getName()); - } - xwiki.saveDocument(doc, context); - String url = doc.getURL("view", context); - String name = doc.getTitle(); - Space resultSpace = factory.createSpace(spaceKey, name, url, "", fullName); - return convert(resultSpace); - } else { - throw exception("The space '" + spaceKey + "' already exists."); - } - } - - /** - * Remove a space completely by removing all of it's child documents. - * - * @param token the authentication token retrieved when calling the login method - * @param spaceKey the space to be deleted - * @return true (xml-rpc methods have to return something) - * @throws XWikiException in case of error - */ - public boolean removeSpace(String token, String spaceKey) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("delete"); - checkToken(token, context); - - if (xwiki.exists(spaceKey + "." + "WebHome", context)) { - // Delete each page individually - List docNames = xwiki.getSpaceDocsName(spaceKey, context); - for (int i = 0; i < docNames.size(); i++) { - removePage(token, spaceKey + "." + docNames.get(i)); - } - return true; - } else { - throw exception("The space '" + spaceKey + "' does not exist."); - } - } - - - // Page Retrieval - - - /** - * Get the summaries of all the pages in the space. - * - * @param token the authentication token retrieved when calling the login method - * @param spaceKey to look for pages in - * @return a vector of PageSummaries as xml-rpc representation - * @throws XWikiException in case of error - */ - public Object[] getPages(String token, String spaceKey) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - checkToken(token, context); - - String fullName = spaceKey + "." + "WebHome"; - if (xwiki.exists(fullName, context)) { - List docNames = xwiki.getSpaceDocsName(spaceKey, context); - ArrayList pages = new ArrayList(docNames.size()); - for (int i = 0; i < docNames.size(); i++) { - String docFullName = spaceKey + "." + docNames.get(i); - XWikiDocument doc = xwiki.getDocument(docFullName, context); - PageSummary pagesum = factory.createPageSummary(doc, context); - pages.add(convert(pagesum)); - } - return pages.toArray(); - } else { - throw exception("The space '" + spaceKey + "' does not exist."); - } - } - - /** - * Get one Page. - * - * @param token the authentication token retrieved when calling the login method - * @param pageId page identifier to look for - * @return a Page object as xml-rpc representation - * @throws XWikiException in case of error - */ - public Map getPage(String token, String pageId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - Page page = factory.createPage(doc, context); - return convert(page); - } - - /** - * Get one Page. - * @param token token the authentication token retrieved when calling the login method - * @param spaceKey the parent space of the page - * @param pageTitle the title of the page - * @return a Page object represented as a Map - * @throws XWikiException - */ - public Map getPage(String token, String spaceKey, String pageTitle) throws XWikiException - { - return getPage(token, factory.getPageId(spaceKey, pageTitle)); - } - - /** - * Returns all the previous versions of a page as a list of PageHistorySummaries. - * We only consider the *old* versions of the document in the page history. - * - * @param token the authentication token retrieved when calling the login method - * @param pageId page identifier to look for - * @return a vector of PageHistories as xml-rpc representation - * @throws XWikiException in case of error - */ - public Object[] getPageHistory(String token, String pageId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - - // We only consider the old(!) versions of the document in the page history - Version[] versions = doc.getRevisions(context); - List result = new LinkedList(); - for (int i = 0; i < versions.length && !versions[i].toString().equals(doc.getVersion()); i++) { - String version = versions[i].toString(); - XWikiDocument revdoc = xwiki.getDocument(doc, version, context); - PageHistorySummary phs = factory.createPageHistorySummary(revdoc); - result.add(0, convert(phs)); - } - return result.toArray(); - } - - - // Page Dependencies - - - /** - * Get all the Attachments for a page. - * - * @param token the authentication token retrieved when calling the login method - * @param pageId id of page from where we want all Attachments - * @return a vector of Attachment objects as xml-rpc representation - * @throws XWikiException in case of error - */ - public Object[] getAttachments(String token, String pageId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("view"); - // TODO isn't this default ? - // -- if yes, then don't set it explicitly. Or maybe still useful - // -- if not then ensure it is set everywhere! - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - - List attachlist = doc.getAttachmentList(); - ArrayList result = new ArrayList(attachlist.size()); - for (int i = 0; i < attachlist.size(); i++) { - XWikiAttachment xAttach = (XWikiAttachment) attachlist.get(i); - Attachment attach = factory.createAttachment(doc, xAttach, context); - result.add(convert(attach)); - } - return result.toArray(); - } - - // TODO test page history + comments - // problem: confluence and xwiki behave differently and there seems to be no way to reconcile - // Confluence: creating, modifying, removing objects (i.e. comments, tags/labels) and - // attachments does not generate new versions. Reverting the page does not revert objects and - // attachments. Comparing 2 versions of a page does not take objects and attachments into - // account. - // -> the test would be xwiki specific and won't work with confluence! - - // TODO generalize this to arbitrary objects (there the class name is no longer fixed) - // - this would be an extension to the confluence api, still adding new methods is not(!) a - // problem for interoperability - /** - * Get all the comments for a page. - * - * @param token the authentication token retrieved when calling the login method - * @param pageId page identifier to get comments from - * @return a vector of Comment objects as xml-rpc representation - * @throws XWikiException in case of error - */ - public Object[] getComments(String token, String pageId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("view"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - - // TODO: here we can also use getComments - // TODO: overkill for getting "XWikiComments" (which is hard-coded everywhere anyway) - String className = xwiki.getCommentsClass(context).getName(); - List commentlist = doc.getObjects(className); - if (commentlist != null) { - ArrayList result = new ArrayList(); - for (int i = 0; i < commentlist.size(); i++) { - BaseObject obj = (BaseObject) commentlist.get(i); - if (obj != null) { - // Note: checking for null values here is crucial - // because comments are just set to null when deleted - Comment comment = factory.createComment(doc, obj, context); - result.add(convert(comment)); - } - } - return result.toArray(); - } else { - return new Object[0]; - } - } - - // TODO How is this useful ? Is there a way to get a comment id without getting the comment - // itself ? - // -- commentIds are long lived, so they may be useful to save for later use - - // TODO improve javadoc - /** - * Returns a comment given a comment id. - * - * @param token - * @param commentId - * @return - * @throws XWikiException - */ - public Map getComment(String token, String commentId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("view"); - checkToken(token, context); - - Object[] pair = factory.getDocObjectPair(commentId, context); - Comment comment = factory.createComment((XWikiDocument)pair[0], (BaseObject)pair[1], context); - return convert(comment); - } - - // TODO improve javadoc - /** - * Adds a comment to a page. - * - * @param token - * @param commentParams - * @return - * @throws XWikiException - */ - public Map addComment(String token, Map commentParams) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("commentadd"); - - checkToken(token, context); - - Comment comment = new CommentImpl(commentParams, convertor); - XWikiDocument doc = factory.getDocFromPageId(comment.getPageId(), context); - if (doc.isMostRecent()) { - // TODO Q: does this really have to be so complex ? (taken from CommentAddAction) - Map map = new HashMap(); - map.put("author", context.getUser()); - map.put("date", ""); // dummy value needed - map.put("comment", comment.getContent()); - BaseClass baseclass = xwiki.getCommentsClass(context); - String className = baseclass.getName(); - int nb = doc.createNewObject(className, context); - BaseObject oldobject = doc.getObject(className, nb); - BaseObject newobject = (BaseObject) baseclass.fromMap(map, oldobject); - - newobject.setNumber(oldobject.getNumber()); - newobject.setName(doc.getFullName()); - doc.setObject(className, nb, newobject); - String msg = context.getMessageTool().get("core.comment.addComment"); - xwiki.saveDocument(doc, msg, context); - - return convert(factory.createComment(doc, newobject, context)); - } else { - throw exception("You can only comment on the latest version of a page"); - } - } - - // TODO improve javadoc - /** - * Removes a comment given a comment id. - * - * @param token - * @param commentId - * @return true (xml-rpc methods have to return something) - * @throws XWikiException - */ - public boolean removeComment(String token, String commentId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("objectremove"); - checkToken(token, context); - - Object[] pair = factory.getDocObjectPair(commentId, context); - XWikiDocument doc = (XWikiDocument)pair[0]; - BaseObject obj = (BaseObject)pair[1]; - if (doc.isMostRecent()) { - doc.removeObject(obj); - String msg = context.getMessageTool().get("core.comment.deleteObject"); - xwiki.saveDocument(doc, msg, context); - return true; - } else { - throw exception("You can only remove comments attached to the latest version of a page"); - } - } - - - // Page Management - - - // TODO Why is the version needed for updating ? - /** - * Add or update a page. - * - * For adding, the Page given as an argument should have - space - title - content - * - * For updating, the Page given should have - id - space - title - content - version - * - * The parentId field is always optional. All other fields will be ignored. - * - * @param token the authentication token retrieved when calling the login method - * @param page a xml-rpc Page - * @return a Page object as xml-rpc representation - * @throws XWikiException in case of error - */ - public Map storePage(String token, Map pageMap) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("save"); - checkToken(token, context); - - Page page = new PageImpl(pageMap, convertor); - XWikiDocument doc = null; - if (page.getId() != null) { - // page id is set -> save page - doc = factory.getDocFromPageId(page.getId(), context); - if (!doc.isMostRecent()) { - throw exception("You can only edit the latest version of a page"); - } - } else { - // page id not set -> create new page or overwrite existing one - String space = page.getSpace(); - String title = page.getTitle(); - if (space == null || title == null) { - throw exception("Space and title are required when calling storePage with no id"); - } - - // if page already exists then overwrite it -- could also raise exception - doc = xwiki.getDocument(space + "." + title, context); - - if (doc == null) { - // otherwise create a new page - doc = new XWikiDocument(space, title); - } - } - if (page.getParentId() != null) { - doc.setParent(page.getParentId()); - } - doc.setAuthor(context.getUser()); - doc.setContent(page.getContent()); - if (page.getCreated() != null) { - doc.setCreationDate(page.getCreated()); - } - if (!StringUtils.isBlank(page.getCreator())) { - doc.setCreator(page.getCreator()); - } - if (!StringUtils.isBlank(page.getModifier())) { - doc.setAuthor(page.getModifier()); - } - // TODO "" was page.getComment() (removed) - context.getWiki().saveDocument(doc, "", context); - return convert(factory.createPage(doc, context)); - } - - /** - * Returns the HTML rendered content for a page. - * - * If 'content' is provided, then that is rendered as if it were the body of the page (useful - * for a 'preview page' function). If it's not provided, then the existing content of the page - * is used instead (ie useful for 'view page' function). - * - * @param token the authentication token retrieved when calling the login method - * @param spaceKey unused. We have to have since it's in the Confluence XMLRPC API but it doesn't seem to be used. - * @param pageId the id of page to get rendered HTML. A getPage() call should be done to get the pageId. The - * pageId can be in any format since this API will support any server side system implementing it. - * @param content if this is set, it will replace the original content for rendering - * @return the string representing the rendered content of the page as HTML - * @throws XWikiException in case of error - */ - public String renderContent(String token, String spaceKey, String pageId, String content) - throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("view"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - context.setDoc(doc); - VelocityContext vcontext = (VelocityContext) context.get("vcontext"); - xwiki.prepareDocuments(context.getRequest(), context, vcontext); - if (content.length() == 0) { - // If content is not provided, then the existing content of the page is used - content = doc.getContent(); - } - String result = xwiki.getRenderingEngine().renderText(content, doc, context); - return result; - } - - /** - * Remove a page. - * - * @param token the authentication token retrieved when calling the login method - * @param pageId id of page to delete - * @return true (xml-rpc methods have to return something) - * @throws XWikiException in case of error - */ - public boolean removePage(String token, String pageId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("delete"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - if (doc.isMostRecent()) { - context.setDoc(doc); - // do not use recycle bin (because it has bugs) - context.getWiki().deleteDocument(doc, false, context); - return true; - } else { - throw exception("You cannot remove an old version of a page"); - } - } - - // Attachments Retrieval - - /** - * - get information about an attachment. - * - * @param token - * @param pageId - * @param fileName - * @param versionNumber - what are the possible values here? guessing :( -- xwiki has a - * viewattachrev action which would be really useful - * @return - * @throws XWikiException - */ - public Map getAttachment(String token, String pageId, String fileName, String versionNumber) - throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("view"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - XWikiAttachment xAttach = doc.getAttachment(fileName); - xAttach = xAttach.getAttachmentRevision(versionNumber, context); - Attachment attachment = factory.createAttachment(doc, xAttach, context); - return convert(attachment); - } - - /** - * - get the contents of an attachment. - * - * @param token - * @param pageId - * @param fileName - * @param versionNumber - what are the possible values here? guessing :( -- xwiki has a - * viewattachrev action which would be really useful - * @return - * @throws XWikiException - */ - public byte[] getAttachmentData(String token, String pageId, String fileName, - String versionNumber) throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("download"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - XWikiAttachment xAttach = doc.getAttachment(fileName); - xAttach = xAttach.getAttachmentRevision(versionNumber, context); - return xAttach.getContent(context); - } - - // Attachments Management - - /** - * - add a new attachment to a content entity object. - * - * @param token - * @param pageId (redundant) - * @param attachment - * @param attachmentData - * @return - * @throws XWikiException - */ - public Map addAttachment(String token, String pageId, Map attachmentMap, byte[] attachmentData) - throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("upload"); - checkToken(token, context); - - Attachment attachment = new AttachmentImpl(attachmentMap, convertor); - - // TODO Does this really have to be so complex ? (taken from UploadAction) - XWikiDocument doc = factory.getDocFromPageId(attachment.getPageId(), context); - // Read XWikiAttachment - XWikiAttachment xAttachment = doc.getAttachment(attachment.getFileName()); - if (xAttachment == null) { - xAttachment = new XWikiAttachment(); - doc.getAttachmentList().add(xAttachment); - } - xAttachment.setContent(attachmentData); - xAttachment.setFilename(attachment.getFileName()); - xAttachment.setAuthor(context.getUser()); - - // Add the attachment to the document - xAttachment.setDoc(doc); - xAttachment.setComment(attachment.getTitle()); - - doc.setAuthor(context.getUser()); // TODO WTF ? - if (doc.isNew()) { - doc.setCreator(context.getUser()); - } - - // Adding a comment with a link to the download URL - String comment; - String nextRev = xAttachment.getNextVersion(); - ArrayList params = new ArrayList(); - params.add(attachment.getFileName()); - params.add(doc.getAttachmentRevisionURL(attachment.getFileName(), nextRev, context)); - if (xAttachment.isImage(context)) { - comment = context.getMessageTool().get("core.comment.uploadImageComment", params); - } else { - comment = - context.getMessageTool().get("core.comment.uploadAttachmentComment", params); - } - doc.setComment(comment); - - doc.saveAttachmentContent(xAttachment, context); - - Attachment resultAttachment = factory.createAttachment(doc, xAttachment, context); - return convert(resultAttachment); - } - - /** - * - remove an attachment from a content entity object. - * - * @param token - * @param pageId - * @param fileName - * @return true - * @throws XWikiException - */ - public boolean removeAttachment(String token, String pageId, String fileName) - throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("delattachment"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - XWikiAttachment xAttachment = doc.getAttachment(fileName); - - doc.setAuthor(context.getUser()); - - ArrayList params = new ArrayList(); - params.add(fileName); - String comment; - if (xAttachment.isImage(context)) { - comment = context.getMessageTool().get("core.comment.deleteImageComment", params); - } else { - comment = - context.getMessageTool().get("core.comment.deleteAttachmentComment", params); - } - doc.setComment(comment); - - doc.deleteAttachment(xAttachment, context); - - return true; - } - - /** - * - move an attachment to a different content entity object and/or give it a new name. - * - * @param token - * @param originalPageId - * @param originalName - * @param newPageId - * @param newName - * @return true - * @throws XWikiException - */ - public boolean moveAttachment(String token, String originalPageId, String originalName, - String newPageId, String newName) throws XWikiException - { - Map map = getAttachment(token, originalPageId, originalName, null); - byte[] data = getAttachmentData(token, originalPageId, originalName, null); - - addAttachment(token, newPageId, map, data); - removeAttachment(token, originalPageId, originalName); - - return true; - } - - // Search // - - /** - * Get a list of SearchResults which match a given search query. - * - * @param token the authentication token retrieved when calling the login method - * @param query search query - * @param maxResults number of maximal results - * @return a Vector of SearchResults as xml-rpc representation - * @throws XWikiException in case of error - */ - public Object[] search(String token, String query, int maxResults) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - checkToken(token, context); - - List doclist = - xwiki.getStore().searchDocumentsNames( - "where doc.content like '%" + Utils.SQLFilter(query) + "%' or doc.name like '%" - + Utils.SQLFilter(query) + "%'", context); - - // TODO: This is not enough and search is implemented in velocity (SUPER STUPID!!!) - // http://localhost:8080/xwiki/bin/edit/XWiki/WebSearchCode - // xwiki.search(sql, context) - // Q: Would using the Lucene search be a solution? - - if (doclist == null) - return new Object[0]; - - List result = new ArrayList(doclist.size()); - for (int i = 0; i < doclist.size(); i++) { - String docName = (String) doclist.get(i); - XWikiDocument doc = xwiki.getDocument(docName, context); - SearchResult sresult = factory.createSearchResult(doc, context); - result.add(convert(sresult)); - } - return result.toArray(); - } - - // ///////////////////// - // Rights Management // - // ///////////////////// - - // /////////////////// - // User Management // - // /////////////////// - - /** - * Get a single User. - * - * @param token the authentication token retrieved when calling the login method - * @param username the name of the user we want the User Object - * @return a User object as xml-rpc representation - * @throws XWikiException in case of error - */ - public Map getUser(String token, String username) throws XWikiException - { - // TODO implement! - throw exception("Not implemented.", XWikiException.ERROR_XWIKI_NOT_IMPLEMENTED); - } - - /** - * Add a new user with the given password. - * - * @param token the authentication token retrieved when calling the login method - * @param user object of new user - * @param password of the new user - * @return true (xml-rpc methods have to return something) - * @throws XWikiException in case of error - */ - public boolean addUser(String token, Map user, String password) throws XWikiException - { - // TODO implement! - throw exception("Not implemented.", XWikiException.ERROR_XWIKI_NOT_IMPLEMENTED); - } - - /** - * Add a new group. - * - * @param token the authentication token retrieved when calling the login method - * @param group name of group to add - * @return true (xml-rpc methods have to return something) - * @throws XWikiException in case of error - */ - public boolean addGroup(String token, String group) throws XWikiException - { - // TODO implement! - throw exception("Not implemented.", XWikiException.ERROR_XWIKI_NOT_IMPLEMENTED); - } - - /** - * Get a user's current groups. - * - * @param token the authentication token retrieved when calling the login method - * @param username for which we want to recive all groups - * @return a Vector of Group objects as xml-rpc representation - * @throws XWikiException in case of error - */ - public Object[] getUserGroups(String token, String username) throws XWikiException - { - // TODO implement! - throw exception("Not implemented.", XWikiException.ERROR_XWIKI_NOT_IMPLEMENTED); - } - - /** - * Add a user to a particular group. - * - * @param token the authentication token retrieved when calling the login method - * @param username name of user to add to a group - * @param groupname name of group to add user - * @return true (xml-rpc methods have to return something) - * @throws XWikiException in case of error - */ - public boolean addUserToGroup(String token, String username, String groupname) - throws XWikiException - { - // TODO implement! - throw exception("Not implemented.", XWikiException.ERROR_XWIKI_NOT_IMPLEMENTED); - } - - private Map getTokens(XWikiContext context) - { - Map tokens = (Map) context.getEngineContext().getAttribute("xmlrpc_tokens"); - if (tokens == null) { - tokens = new HashMap(); - context.getEngineContext().setAttribute("xmlrpc_tokens", tokens); - } - return tokens; - } - - /** - * Verify the authentication token - * - * @param token - * @param context - * @throws XWikiException - */ - private void checkToken(String token, XWikiContext context) throws XWikiException - { - RemoteUser user = null; - String ip = context.getRequest().getRemoteAddr(); - - if (token != null) { - if (!token.equals("")) { - user = (RemoteUser) getTokens(context).get(token); - } else { - // anonymous access - user = new RemoteUser("XWiki.XWikiGuest", ip); - } - } - - if ((user == null) || (!user.ip.equals(ip))) { - throw exception("Access Denied: authentification token {" + token + "} for ip {" + ip - + "} is invalid", XWikiException.ERROR_XWIKI_ACCESS_TOKEN_INVALID); - } - - context.setUser(user.username); - } - - private XWikiException exception(String message) - { - return exception(message, 0); - } - - private XWikiException exception(String message, int code) { - return exception(message, code, null); - } - - private XWikiException exception(String message, Throwable cause) { - return exception(message, 0, cause); - } - - private XWikiException exception(String message, int code, Throwable cause) - { - log.info("Exception thrown to XML-RPC client: " + message); - XWikiException ex = new XWikiException(); - ex.setModule(XWikiException.MODULE_XWIKI_XMLRPC); - ex.setCode(code); - ex.setMessage(message); - ex.setException(cause); - return ex; - } - - // XWiki-objects and XWiki-classes - - public Object[] getClasses(String token, String pageId) throws XWikiException - { - // TODO What action is this ? - XWikiContext context = getXWikiContext(); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - return doc.getxWikiClasses(context).toArray(); - } - - // TODO: getComments can't really call this now ... refactor the common part out ? - // -- the creation of the DSO is/(will be) different - // this DSO scheme needs to be extensible ... leave them Maps ? - // --- or have structured objects but use toMap for getting extra properties - // ---- constructor needs to store all extra properties (and fields won't work!) - // -- if we manage to implement this in a general enough way we can reuse it for a LOT of things - public Object[] getObjects(String token, String pageId, String className) - throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("view"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - - List commentlist = doc.getObjects(className); - if (commentlist != null) { - ArrayList result = new ArrayList(); - for (int i = 0; i < commentlist.size(); i++) { - BaseObject obj = (BaseObject) commentlist.get(i); - if (obj != null) { - // Note: checking for null values here is crucial - // because comments are just set to null when deleted - // TODO - we need a new DSO type! - Comment object = factory.createComment(doc, obj, context); - result.add(object.toMap()); - } - } - return result.toArray(); - } else { - return new Object[0]; - } - } - - // TODO this is NOT trivial to implement! - public Map addObject(String token, Map objectMap) throws XWikiException - { - // TODO the class will be one of the fields in the params - - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("objectadd"); - - checkToken(token, context); - - Comment object = new CommentImpl(objectMap); // TODO Create another type of DSO ... - // factory/reflection needed? - XWikiDocument doc = factory.getDocFromPageId(object.getPageId(), context); - if (doc.isMostRecent()) { - // TODO Q: does this really have to be so complex ? (taken from CommentAddAction) - // TODO Check ObjectAddAction here!!! - Map map = new HashMap(); - map.put("author", context.getUser()); - map.put("date", ""); // dummy value needed - map.put("comment", object.getContent()); // probably not - String className = "";// object.getClassName(); // like this class name includes - // "XWiki." - BaseClass baseclass = xwiki.getClass(className, context); - int nb = doc.createNewObject(className, context); - BaseObject oldobject = doc.getObject(className, nb); - BaseObject newobject = (BaseObject) baseclass.fromMap(map, oldobject); - - newobject.setNumber(oldobject.getNumber()); - newobject.setName(doc.getFullName()); - doc.setObject(className, nb, newobject); - String msg = context.getMessageTool().get("core.comment.addObject"); // TODO the - // message also - // depends on - // the DSO - xwiki.saveDocument(doc, msg, context); - - return (factory.createComment(doc, newobject, context)).toMap(); // TODO Create another type of - // DSO here .. - // factory/reflection needed ? - } else { - throw exception("You can only add objects to the latest version of a page"); - } - } - - // TODO class should also be included in the objectId !!! - // -- More complex way to construct objectIds needed - public boolean removeObject(String token, String objectId) throws XWikiException - { - XWikiContext context = getXWikiContext(); - XWiki xwiki = context.getWiki(); - context.setAction("objectremove"); - checkToken(token, context); - - Object[] pair = factory.getDocObjectPair(objectId, context); // Class should also be used - XWikiDocument doc = (XWikiDocument)pair[0]; - BaseObject obj = (BaseObject)pair[1]; - // here!!! - if (doc.isMostRecent()) { - doc.removeObject(obj); - String msg = context.getMessageTool().get("core.comment.deleteObject"); - xwiki.saveDocument(doc, msg, context); - return true; - } else { - throw exception("You can only remove objects from the latest version of a page"); - } - } - - // TODO There also needs to be a way to add and remove classes easily - // --- but how ? - - - /** - * Function needed, but missing from the confluence api. - * Supported only by XWiki. - * @return A list of strings - */ - public Object[] getAttachmentVersions(String token, String pageId, String fileName) - throws XWikiException - { - XWikiContext context = getXWikiContext(); - context.setAction("viewattachrev"); - checkToken(token, context); - - XWikiDocument doc = factory.getDocFromPageId(pageId, context); - XWikiAttachment xAttach = doc.getAttachment(fileName); - Version[] versions = xAttach.getVersions(); - Object[] result = new Object[versions.length]; - for (int i = 0; i= comments.size()) { - throw exception("Invalid comment ID."); - } - BaseObject obj = (BaseObject) comments.get(nb); - - // TODO this is more general, is it also more efficient? - // XWiki xwiki = context.getWiki(); - // BaseObject obj = doc.getObject(xwiki.getCommentsClass(context).getName(), nb); - - if (obj == null) { - throw exception("This comment was already removed."); - } - - return new Object[] {doc, obj}; - } - - /** - * Notes: - *
    - *
  • XWiki ignores the content type field set by the user and uses the file extension instead - * to determine it (Confluence requires this field to be set by the user).
  • - *
  • XWiki always sets the id of the attachments to the empty string since this field is - * totally useless.
  • - *
  • XWiki always sets the title of the attachment to its file name.
  • - * - * - * @param doc the (@link com.xpn.xwiki.XWikiDocument), used to create the Attachment. The reason - * we need its that some information for creating the Attachment is available only - * from the XWikiDocument object and not in the passed XWikiAttachment. - * @param attachment the (@link com.xpn.xwiki.XWikiAttachment), used to create the Attachment - * @param context the {@link com.xpn.xwiki.XWikiContext} object, used to get access to XWiki - * primitives for loading documents - */ - public Attachment createAttachment(XWikiDocument doc, XWikiAttachment attachment, - XWikiContext context) - { - Attachment result = new AttachmentImpl(); - - // Ids for attachments are useless so we don't set them (Confluence does) - result.setId(""); - result.setPageId(doc.getFullName()); - // We use the filename as the document title (Confluence does the same) - result.setTitle(attachment.getFilename()); - result.setFileName(attachment.getFilename()); - result.setFileSize(attachment.getFilesize()); - XWiki xwiki = context.getWiki(); - XWikiEngineContext engineContext = xwiki.getEngineContext(); - String mimeType = engineContext.getMimeType(attachment.getFilename()); - if (mimeType == null) { - mimeType = DEFAULT_MIME_TYPE; - } - result.setContentType(mimeType); - result.setCreator(attachment.getAuthor()); - result.setCreated(attachment.getDate()); - result.setUrl(doc.getAttachmentURL(attachment.getFilename(), "download", context)); - result.setComment(attachment.getComment()); - - return result; - } - - public Comment createComment(XWikiDocument doc, BaseObject obj, XWikiContext context) - { - Comment result = new CommentImpl(); - - if (doc.isMostRecent()) { - result.setId(doc.getFullName() + ";" + obj.getNumber()); - result.setPageId(doc.getFullName()); - result.setUrl(doc.getURL("view", context)); - } else { - result.setId(doc.getFullName() + ":" + doc.getVersion() + ";" + obj.getNumber()); - result.setPageId(doc.getFullName() + ":" + doc.getVersion()); - result.setUrl(doc.getURL("view", "rev=" + doc.getVersion(), context)); - } - result.setTitle(doc.getName()); - result.setContent(obj.getStringValue("comment")); - result.setCreated(obj.getDateValue("date")); - result.setCreator(obj.getStringValue("author")); - - return result; - } - - public Page createPage(XWikiDocument doc, XWikiContext context) - { - Page result = new PageImpl(); - - // since we don't have multiple inheritance - // we had to copy paste this initial part from PageSummary - if (doc.isMostRecent()) { - // Current version of document - result.setId(doc.getFullName()); - result.setUrl(doc.getURL("view", context)); - } else { - // Old version of document - result.setId(doc.getFullName() + ":" + doc.getVersion()); - result.setUrl(doc.getURL("view", "rev=" + doc.getVersion(), context)); - } - result.setSpace(doc.getSpace()); - result.setParentId(doc.getParent()); - result.setTitle(doc.getName()); - result.setLocks(0); - - result.setVersion(constructVersion(doc.getRCSVersion())); - result.setContent(doc.getContent()); - result.setCreated(doc.getCreationDate()); - result.setCreator(doc.getAuthor()); - result.setModified(doc.getDate()); - result.setModifier(doc.getAuthor()); - result.setHomePage((doc.getName().equals("WebHome"))); - - return result; - } - - /** - * Notes: - *
      - *
    • XWiki does not have mutex locks to getLocks always returns 0.
    • - *
    - */ - public PageSummary createPageSummary(XWikiDocument doc, XWikiContext context) - { - PageSummary result = new PageSummaryImpl(); - - if (doc.isMostRecent()) { - // Current version of document - result.setId(doc.getFullName()); - result.setUrl(doc.getURL("view", context)); - } else { - // Old version of document - result.setId(doc.getFullName() + ":" + doc.getVersion()); - result.setUrl(doc.getURL("view", "rev=" + doc.getVersion(), context)); - } - - result.setSpace(doc.getSpace()); - result.setParentId(doc.getParent()); - result.setTitle(doc.getName()); - result.setLocks(0); - - return result; - } - - public PageHistorySummary createPageHistorySummary(XWikiDocument document) - { - PageHistorySummary result = new PageHistorySummaryImpl(); - - result.setId(document.getFullName() + ":" + document.getVersion()); - result.setVersion(constructVersion(document.getRCSVersion())); - result.setModified(document.getDate()); - result.setModifier(document.getAuthor()); - - return result; - } - - public SearchResult createSearchResult(XWikiDocument document, XWikiContext context) - { - SearchResult result = new SearchResultImpl(); - - result.setTitle(document.getName()); - result.setId(document.getFullName()); - result.setUrl(document.getURL("view", context)); - result.setType("page"); - String content = document.getContent(); - // TODO is this a good way to generate excerpts? - if (content.length() <= 256) { - result.setExcerpt(content); - } else { - result.setExcerpt(content.substring(0, 256)); - } - - return result; - } - - public Space createSpace(String key, String name, String url, String description, - String homepage) - { - Space result = new SpaceImpl(); - - result.setKey(key); - result.setName(name); - result.setUrl(url); - - result.setDescription(description); - result.setHomePage(homepage); - - return result; - } - - /** - * @param key of the space (usually the Space's name as it's unique) - * @param name of the space - * @param url to view the space online. Example: "http://server/xwiki/bin/view/Space/WebHome" - */ - public SpaceSummary createSpaceSummary(String key, String name, String url) - { - SpaceSummary result = new SpaceSummaryImpl(); - - result.setKey(key); - result.setName(name); - result.setUrl(url); - // TODO we do not set the type ... document at least - - return result; - } - - public User createUser(XWikiDocument userdoc, XWikiContext context) - { - User result = new UserImpl(); - - result.setName(userdoc.getName()); - result.setFullname(userdoc.getStringValue("XWiki.XWikiUsers", "fullName")); - result.setEmail(userdoc.getStringValue("XWiki.XWikiUsers", "email")); - result.setUrl(userdoc.getURL("view", context)); - - return result; - } - - private static int constructVersion(Version ver) - { - return ((ver.at(0) - 1) << 16) + ver.at(1); - } - - private XWikiException exception(String message) - { - log.info("Exception thrown to XML-RPC client: " + message); - XWikiException ex = new XWikiException(); - ex.setModule(XWikiException.MODULE_XWIKI_XMLRPC); - ex.setMessage(message); - return ex; - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/RequestInitializableHandler.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/RequestInitializableHandler.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/RequestInitializableHandler.java (working copy) @@ -1,27 +0,0 @@ -package com.xpn.xwiki.xmlrpc; - -import com.xpn.xwiki.XWikiException; -import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl; - -import javax.servlet.Servlet; -import javax.servlet.ServletRequest; - -public interface RequestInitializableHandler -{ - public void init(Servlet servlet, ServletRequest request) throws XWikiException; - - static class Config extends XmlRpcHttpRequestConfigImpl - { - private ServletRequest request; - - public ServletRequest getRequest() - { - return request; - } - - public void setRequest(ServletRequest request) - { - this.request = request; - } - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientConversionException.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientConversionException.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientConversionException.java (working copy) @@ -1,26 +0,0 @@ -package com.xpn.xwiki.xmlrpc.client; - -public class XWikiClientConversionException extends XWikiClientException -{ - private static final long serialVersionUID = 5971517238393022569L; - - public XWikiClientConversionException() - { - super(); - } - - public XWikiClientConversionException(String message) - { - super(message); - } - - public XWikiClientConversionException(Throwable cause) - { - super(cause); - } - - public XWikiClientConversionException(String message, Throwable cause) - { - super(message, cause); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/client/SwizzleXWikiClient.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/client/SwizzleXWikiClient.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/client/SwizzleXWikiClient.java (working copy) @@ -1,1572 +0,0 @@ -/* - * See the NOTICE file distributed with this work for additional - * information regarding copyright ownership. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package com.xpn.xwiki.xmlrpc.client; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.codehaus.swizzle.confluence.Confluence; -import org.codehaus.swizzle.confluence.ConfluenceException; -import org.codehaus.swizzle.confluence.IdentityObjectConvertor; -import org.codehaus.swizzle.confluence.MapConvertor; -import org.codehaus.swizzle.confluence.SwizzleConfluenceException; - -import com.xpn.xwiki.xmlrpc.model.Attachment; -import com.xpn.xwiki.xmlrpc.model.BlogEntry; -import com.xpn.xwiki.xmlrpc.model.Comment; -import com.xpn.xwiki.xmlrpc.model.Label; -import com.xpn.xwiki.xmlrpc.model.Page; -import com.xpn.xwiki.xmlrpc.model.PageSummary; -import com.xpn.xwiki.xmlrpc.model.ServerInfo; -import com.xpn.xwiki.xmlrpc.model.Space; -import com.xpn.xwiki.xmlrpc.model.User; -import com.xpn.xwiki.xmlrpc.model.UserInformation; -import com.xpn.xwiki.xmlrpc.model.swizzle.AttachmentImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.BlogEntryImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.BlogEntrySummaryImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.CommentImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.LabelImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.PageHistorySummaryImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.PageImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.PageSummaryImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.PermissionImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.SearchResultImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.ServerInfoImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.SpaceImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.SpaceSummaryImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.UserImpl; -import com.xpn.xwiki.xmlrpc.model.swizzle.UserInformationImpl; - -public class SwizzleXWikiClient implements XWikiClient -{ - Confluence swizzle; - - public SwizzleXWikiClient(String endpoint) throws XWikiClientException - { - if (endpoint.endsWith("/")) { - endpoint = endpoint.substring(0, endpoint.length() - 1); - } - - if (!endpoint.endsWith("xmlrpc")) { - endpoint += "/xwiki/xmlrpc"; - } - - try { - swizzle = new Confluence(endpoint); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#login(java.lang.String, java.lang.String) - */ - public void login(String username, String password) throws XWikiClientException, - XWikiClientRemoteException - { - try { - swizzle.login(username, password); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#logout() - */ - public boolean logout() throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.logout(); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#exportSite(boolean) - */ - public String exportSite(boolean exportAttachments) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.exportSite(exportAttachments); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getServerInfo() - */ - public ServerInfo getServerInfo() throws XWikiClientException, XWikiClientRemoteException - { - try { - return new ServerInfoImpl(swizzle.getServerInfo()); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getSpaces() - */ - public List getSpaces() throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getSpaces(), SpaceSummaryImpl.class, - org.codehaus.swizzle.confluence.SpaceSummary.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getSpace(java.lang.String) - */ - public Space getSpace(String spaceKey) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return new SpaceImpl(swizzle.getSpace(spaceKey)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#exportSpace(java.lang.String, java.lang.String) - */ - public String exportSpace(String spaceKey, String exportType) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.exportSpace(spaceKey, exportType); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addSpace(org.codehaus.swizzle.confluence.Space) - */ - public Space addSpace(Space space) throws XWikiClientException, XWikiClientRemoteException - { - try { - return new SpaceImpl(swizzle.addSpace(((SpaceImpl) space).getTarget())); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeSpace(java.lang.String) - */ - public boolean removeSpace(String spaceKey) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.removeSpace(spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getPages(java.lang.String) - */ - public List getPages(String spaceKey) throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getPages(spaceKey), PageSummaryImpl.class, - org.codehaus.swizzle.confluence.PageSummary.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getPage(java.lang.String) - */ - public Page getPage(String pageId) throws XWikiClientException, XWikiClientRemoteException - { - try { - return new PageImpl(swizzle.getPage(pageId)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getPage(java.lang.String, java.lang.String) - */ - public Page getPage(String spaceKey, String pageTitle) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return new PageImpl(swizzle.getPage(spaceKey, pageTitle)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getPageHistory(java.lang.String) - */ - public List getPageHistory(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getPageHistory(pageId), PageHistorySummaryImpl.class, - org.codehaus.swizzle.confluence.PageHistorySummary.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getAttachments(java.lang.String) - */ - public List getAttachments(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getAttachments(pageId), AttachmentImpl.class, - org.codehaus.swizzle.confluence.Attachment.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getAncestors(java.lang.String) - */ - public List getAncestors(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getAncestors(pageId), PageSummaryImpl.class, - org.codehaus.swizzle.confluence.PageSummary.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getChildren(java.lang.String) - */ - public List getChildren(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getChildren(pageId), PageSummaryImpl.class, - org.codehaus.swizzle.confluence.PageSummary.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getDescendents(java.lang.String) - */ - public List getDescendents(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getDescendents(pageId), PageSummaryImpl.class, - org.codehaus.swizzle.confluence.PageSummary.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getComments(java.lang.String) - */ - public List getComments(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getComments(pageId), CommentImpl.class, - org.codehaus.swizzle.confluence.Comment.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getComment(java.lang.String) - */ - public Comment getComment(String commentId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return new CommentImpl(swizzle.getComment(commentId)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addComment(org.codehaus.swizzle.confluence.Comment) - */ - public Comment addComment(Comment comment) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return new CommentImpl(swizzle.addComment(((CommentImpl) comment).getTarget())); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeComment(java.lang.String) - */ - public boolean removeComment(String commentId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.removeComment(commentId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#storePage(org.codehaus.swizzle.confluence.Page) - */ - public Page storePage(Page page) throws XWikiClientException, XWikiClientRemoteException - { - try { - return new PageImpl(swizzle.storePage(((PageImpl) page).getTarget())); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#renderContent(java.lang.String, - * java.lang.String, java.lang.String) - */ - public String renderContent(String spaceKey, String pageId, String content) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.renderContent(spaceKey, pageId, content); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#renderContent(java.lang.String, - * java.lang.String) - */ - public String renderContent(String spaceKey, String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.renderContent(spaceKey, pageId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#renderContent(org.codehaus.swizzle.confluence.PageSummary) - */ - public String renderContent(PageSummary page) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.renderContent(((PageSummaryImpl) page).getTarget()); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#renderContent(java.lang.String, - * java.lang.String, java.lang.String, java.util.Map) - */ - public String renderContent(String spaceKey, String pageId, String content, Map parameters) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.renderContent(spaceKey, pageId, content, parameters); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removePage(java.lang.String) - */ - public void removePage(String pageId) throws XWikiClientException, XWikiClientRemoteException - { - try { - swizzle.removePage(pageId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getAttachment(java.lang.String, - * java.lang.String, java.lang.String) - */ - public Attachment getAttachment(String pageId, String fileName, String versionNumber) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return new AttachmentImpl(swizzle.getAttachment(pageId, fileName, versionNumber)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getAttachmentData(java.lang.String, - * java.lang.String, java.lang.String) - */ - public byte[] getAttachmentData(String pageId, String fileName, String versionNumber) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.getAttachmentData(pageId, fileName, versionNumber); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addAttachment(java.lang.String, - * org.codehaus.swizzle.confluence.Attachment, byte[]) - */ - public Attachment addAttachment(String pageId, Attachment attachment, byte[] attachmentData) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return new AttachmentImpl(swizzle.addAttachment(pageId, ((AttachmentImpl) attachment) - .getTarget(), attachmentData)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeAttachment(java.lang.String, - * java.lang.String) - */ - public boolean removeAttachment(String pageId, String fileName) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.removeAttachment(pageId, fileName); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#moveAttachment(java.lang.String, - * java.lang.String, java.lang.String, java.lang.String) - */ - public boolean moveAttachment(String originalPageId, String originalName, String newPageId, - String newName) throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.moveAttachment(originalPageId, originalName, newPageId, newName); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getBlogEntries(java.lang.String) - */ - public List getBlogEntries(String spaceKey) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getBlogEntries(spaceKey), BlogEntrySummaryImpl.class, - org.codehaus.swizzle.confluence.BlogEntrySummary.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getBlogEntry(java.lang.String) - */ - public BlogEntry getBlogEntry(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return new BlogEntryImpl(swizzle.getBlogEntry(pageId)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#storeBlogEntry(org.codehaus.swizzle.confluence.BlogEntry) - */ - public BlogEntry storeBlogEntry(BlogEntry entry) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return new BlogEntryImpl(swizzle.storeBlogEntry(((BlogEntryImpl) entry).getTarget())); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getBlogEntryByDayAndTitle(java.lang.String, int, - * java.lang.String) - */ - public BlogEntry getBlogEntryByDayAndTitle(String spaceKey, int dayOfMonth, String postTitle) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return new BlogEntryImpl(swizzle.getBlogEntryByDayAndTitle(spaceKey, dayOfMonth, - postTitle)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#search(java.lang.String, int) - */ - public List search(String query, int maxResults) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.search(query, maxResults), SearchResultImpl.class, - org.codehaus.swizzle.confluence.SearchResult.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#search(java.lang.String, java.util.Map, int) - */ - public List search(String query, Map parameters, int maxResults) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.search(query, parameters, maxResults), - SearchResultImpl.class, org.codehaus.swizzle.confluence.SearchResult.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getPermissions(java.lang.String) - */ - public List getPermissions(String spaceKey) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getPermissions(spaceKey), PermissionImpl.class, - org.codehaus.swizzle.confluence.Permission.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getPermissionsForUser(java.lang.String, - * java.lang.String) - */ - public List getPermissionsForUser(String spaceKey, String userName) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getPermissionsForUser(spaceKey, userName), - PermissionImpl.class, org.codehaus.swizzle.confluence.Permission.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getPagePermissions(java.lang.String) - */ - public List getPagePermissions(String pageId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getPagePermissions(pageId), PermissionImpl.class, - org.codehaus.swizzle.confluence.Permission.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getSpaceLevelPermissions() - */ - public List getSpaceLevelPermissions() throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getSpaceLevelPermissions(), PermissionImpl.class, - org.codehaus.swizzle.confluence.Permission.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addPermissionToSpace(java.lang.String, - * java.lang.String, java.lang.String) - */ - public boolean addPermissionToSpace(String permission, String remoteEntityName, - String spaceKey) throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.addPermissionToSpace(permission, remoteEntityName, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addPermissionsToSpace(java.util.List, - * java.lang.String, java.lang.String) - */ - public boolean addPermissionsToSpace(List permissions, String remoteEntityName, - String spaceKey) throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.addPermissionsToSpace(permissions, remoteEntityName, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removePermissionFromSpace(java.lang.String, - * java.lang.String, java.lang.String) - */ - public boolean removePermissionFromSpace(String permission, String remoteEntityName, - String spaceKey) throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.removePermissionFromSpace(permission, remoteEntityName, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addAnonymousPermissionToSpace(java.lang.String, - * java.lang.String) - */ - public boolean addAnonymousPermissionToSpace(String permission, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.addAnonymousPermissionToSpace(permission, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addAnonymousPermissionsToSpace(java.util.List, - * java.lang.String) - */ - public boolean addAnonymousPermissionsToSpace(List permissions, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException - { - try { - // TODO what is the type of the elements in permissions ? do they need wrapping? - return swizzle.addAnonymousPermissionsToSpace(permissions, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeAnonymousPermissionFromSpace(java.lang.String, - * java.lang.String) - */ - public boolean removeAnonymousPermissionFromSpace(String permission, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.removeAnonymousPermissionFromSpace(permission, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeAllPermissionsForGroup(java.lang.String) - */ - public boolean removeAllPermissionsForGroup(String groupname) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.removeAllPermissionsForGroup(groupname); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getUser(java.lang.String) - */ - public User getUser(String username) throws XWikiClientException, XWikiClientRemoteException - { - try { - return new UserImpl(swizzle.getUser(username)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addUser(org.codehaus.swizzle.confluence.User, - * java.lang.String) - */ - public void addUser(User user, String password) throws XWikiClientException, - XWikiClientRemoteException - { - try { - swizzle.addUser(((UserImpl) user).getTarget(), password); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addGroup(java.lang.String) - */ - public void addGroup(String group) throws XWikiClientException, XWikiClientRemoteException - { - try { - swizzle.addGroup(group); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getUserGroups(java.lang.String) - */ - public List getUserGroups(String username) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.getUserGroups(username); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addUserToGroup(java.lang.String, - * java.lang.String) - */ - public void addUserToGroup(String username, String groupname) throws XWikiClientException, - XWikiClientRemoteException - { - try { - swizzle.addUserToGroup(username, groupname); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeUserFromGroup(java.lang.String, - * java.lang.String) - */ - public boolean removeUserFromGroup(String username, String groupname) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.removeUserFromGroup(username, groupname); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeUser(java.lang.String) - */ - public boolean removeUser(String username) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.removeUser(username); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeGroup(java.lang.String, java.lang.String) - */ - public boolean removeGroup(String groupname, String defaultGroupName) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.removeGroup(groupname, defaultGroupName); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getGroups() - */ - public List getGroups() throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.getGroups(); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#hasUser(java.lang.String) - */ - public boolean hasUser(String username) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.hasUser(username); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#hasGroup(java.lang.String) - */ - public boolean hasGroup(String groupname) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.hasGroup(groupname); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#editUser(org.codehaus.swizzle.confluence.User) - */ - public boolean editUser(User remoteUser) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.editUser(((UserImpl) remoteUser).getTarget()); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#deactivateUser(java.lang.String) - */ - public boolean deactivateUser(String username) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.deactivateUser(username); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#reactivateUser(java.lang.String) - */ - public boolean reactivateUser(String username) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.reactivateUser(username); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getActiveUsers(boolean) - */ - public List getActiveUsers(boolean viewAll) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.getActiveUsers(viewAll); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#setUserInformation(org.codehaus.swizzle.confluence.UserInformation) - */ - public boolean setUserInformation(UserInformation userInfo) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.setUserInformation(((UserInformationImpl) userInfo).getTarget()); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getUserInformation(java.lang.String) - */ - public UserInformation getUserInformation(String username) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return new UserInformationImpl(swizzle.getUserInformation(username)); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#changeMyPassword(java.lang.String, - * java.lang.String) - */ - public boolean changeMyPassword(String oldPass, String newPass) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.changeMyPassword(oldPass, newPass); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#changeUserPassword(java.lang.String, - * java.lang.String) - */ - public boolean changeUserPassword(String username, String newPass) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.changeUserPassword(username, newPass); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getLabelsById(long) - */ - public List getLabelsById(long objectId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getLabelsById(objectId), LabelImpl.class, - org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getMostPopularLabels(int) - */ - public List getMostPopularLabels(int maxCount) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getMostPopularLabels(maxCount), LabelImpl.class, - org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getMostPopularLabelsInSpace(java.lang.String, - * int) - */ - public List getMostPopularLabelsInSpace(String spaceKey, int maxCount) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getMostPopularLabelsInSpace(spaceKey, maxCount), - LabelImpl.class, org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getRecentlyUsedLabels(int) - */ - public List getRecentlyUsedLabels(int maxResults) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getRecentlyUsedLabels(maxResults), LabelImpl.class, - org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getRecentlyUsedLabelsInSpace(java.lang.String, - * int) - */ - public List getRecentlyUsedLabelsInSpace(String spaceKey, int maxResults) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getRecentlyUsedLabelsInSpace(spaceKey, maxResults), - LabelImpl.class, org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getSpacesWithLabel(java.lang.String) - */ - public List getSpacesWithLabel(String labelName) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getSpacesWithLabel(labelName), SpaceImpl.class, - org.codehaus.swizzle.confluence.Space.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getRelatedLabels(java.lang.String, int) - */ - public List getRelatedLabels(String labelName, int maxResults) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return wrapList(swizzle.getRelatedLabels(labelName, maxResults), LabelImpl.class, - org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getRelatedLabelsInSpace(java.lang.String, - * java.lang.String, int) - */ - public List getRelatedLabelsInSpace(String labelName, String spaceKey, int maxResults) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getRelatedLabelsInSpace(labelName, spaceKey, maxResults), - LabelImpl.class, org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getLabelsByDetail(java.lang.String, - * java.lang.String, java.lang.String, java.lang.String) - */ - public List getLabelsByDetail(String labelName, String namespace, String spaceKey, - String owner) throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getLabelsByDetail(labelName, namespace, spaceKey, owner), - LabelImpl.class, org.codehaus.swizzle.confluence.Label.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getLabelContentById(long) - */ - public List getLabelContentById(long labelId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - // TODO what is the type of the elements returned here ? most likely they need wrapping - return swizzle.getLabelContentById(labelId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getLabelContentByName(java.lang.String) - */ - public List getLabelContentByName(String labelName) throws XWikiClientException, - XWikiClientRemoteException - { - try { - // TODO what is the type of the elements returned here ? most likely they need wrapping - return swizzle.getLabelContentByName(labelName); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getLabelContentByObject(org.codehaus.swizzle.confluence.Label) - */ - public List getLabelContentByObject(Label labelObject) throws XWikiClientException, - XWikiClientRemoteException - { - try { - // TODO what is the type of the elements returned here ? most likely they need wrapping - return swizzle.getLabelContentByObject(((LabelImpl) labelObject).getTarget()); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getSpacesContainingContentWithLabel(java.lang.String) - */ - public List getSpacesContainingContentWithLabel(String labelName) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return wrapList(swizzle.getSpacesContainingContentWithLabel(labelName), - SpaceImpl.class, org.codehaus.swizzle.confluence.Space.class); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addLabelByName(java.lang.String, long) - */ - public boolean addLabelByName(String labelName, long objectId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.addLabelByName(labelName, objectId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addLabelById(long, long) - */ - public boolean addLabelById(long labelId, long objectId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.addLabelById(labelId, objectId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addLabelByObject(org.codehaus.swizzle.confluence.Label, - * long) - */ - public boolean addLabelByObject(Label labelObject, long objectId) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.addLabelByObject(((LabelImpl) labelObject).getTarget(), objectId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#addLabelByNameToSpace(java.lang.String, - * java.lang.String) - */ - public boolean addLabelByNameToSpace(String labelName, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.addLabelByNameToSpace(labelName, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeLabelByName(java.lang.String, long) - */ - public boolean removeLabelByName(String labelName, long objectId) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.removeLabelByName(labelName, objectId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeLabelById(long, long) - */ - public boolean removeLabelById(long labelId, long objectId) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.removeLabelById(labelId, objectId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeLabelByObject(org.codehaus.swizzle.confluence.Label, - * long) - */ - public boolean removeLabelByObject(Label labelObject, long objectId) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.removeLabelByObject(((LabelImpl) labelObject).getTarget(), objectId); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#removeLabelByNameFromSpace(java.lang.String, - * java.lang.String) - */ - public boolean removeLabelByNameFromSpace(String labelName, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.removeLabelByNameFromSpace(labelName, spaceKey); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - private Object call(String command) throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.call(command); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - private Object call(String command, Object arg1) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.call(command, arg1); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - private Object call(String command, Object arg1, Object arg2) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.call(command, arg1, arg2); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - private Object call(String command, Object arg1, Object arg2, Object arg3) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.call(command, arg1, arg2, arg3); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - private Object call(String command, Object arg1, Object arg2, Object arg3, Object arg4) - throws XWikiClientException, XWikiClientRemoteException - { - try { - return swizzle.call(command, arg1, arg2, arg3, arg4); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - private Object call(String command, Object[] args) throws XWikiClientException, - XWikiClientRemoteException - { - try { - return swizzle.call(command, args); - } catch (ConfluenceException e) { - throw new XWikiClientRemoteException(e); - } catch (SwizzleConfluenceException e) { - throw new XWikiClientException(e); - } - } - - private List wrapList(List list, Class wrapperClass, Class targetClass) - throws XWikiClientException - { - List result = new ArrayList(list.size()); - for (int i = 0; i < list.size(); i++) { - Object target = list.get(i); - try { - result.add(wrapperClass.getConstructor(new Class[] {targetClass}).newInstance( - new Object[] {target})); - } catch (Exception e) { - throw new XWikiClientException(e); - } - } - return result; - } - - // XWiki-only methods - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#getAttachmentVersions(java.lang.String, - * java.lang.String) - */ - public List getAttachmentVersions(String pageId, String fileName) - throws XWikiClientRemoteException, XWikiClientException - { - Object[] vector = (Object[]) call("getAttachmentVersions", pageId, fileName); - return Arrays.asList(vector); - } - - /** - * @see com.xpn.xwiki.xmlrpc.client.XWikiClient#setNoConversion() - */ - public void setNoConversion() throws XWikiClientRemoteException, XWikiClientException - { - call("setNoConversion"); - swizzle.setConvertor(new MapConvertor(new IdentityObjectConvertor())); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientRemoteException.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientRemoteException.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientRemoteException.java (working copy) @@ -1,31 +0,0 @@ -package com.xpn.xwiki.xmlrpc.client; - -/** - * This exception is thrown to signal an error on the server. Sometimes the original cause of the - * error is also transmitted and can be obtained by calling the getCause method (otherwise getCause - * will return null). - */ -public class XWikiClientRemoteException extends XWikiClientException -{ - private static final long serialVersionUID = 3943876772981124681L; - - public XWikiClientRemoteException() - { - super(); - } - - public XWikiClientRemoteException(String message) - { - super(message); - } - - public XWikiClientRemoteException(Throwable cause) - { - super(cause); - } - - public XWikiClientRemoteException(String message, Throwable cause) - { - super(message, cause); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientException.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientException.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClientException.java (working copy) @@ -1,31 +0,0 @@ -package com.xpn.xwiki.xmlrpc.client; - -/** - * This is the exception thrown by Swizzle to signal errors. Errors that occurred on the server are - * indicated by throwing a {@link com.xpn.xwiki.xmlrpc.client.XWikiClientRemoteException}, which - * is a subclass of SwizzleXWikiException. - */ -public class XWikiClientException extends Exception -{ - private static final long serialVersionUID = 4578210684020233937L; - - public XWikiClientException() - { - super(); - } - - public XWikiClientException(String message) - { - super(message); - } - - public XWikiClientException(Throwable cause) - { - super(cause); - } - - public XWikiClientException(String message, Throwable cause) - { - super(message, cause); - } -} Index: src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClient.java =================================================================== --- src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClient.java (revision 9134) +++ src/main/java/com/xpn/xwiki/xmlrpc/client/XWikiClient.java (working copy) @@ -1,573 +0,0 @@ -package com.xpn.xwiki.xmlrpc.client; - -import java.util.List; -import java.util.Map; - -import com.xpn.xwiki.xmlrpc.model.Attachment; -import com.xpn.xwiki.xmlrpc.model.BlogEntry; -import com.xpn.xwiki.xmlrpc.model.Comment; -import com.xpn.xwiki.xmlrpc.model.Label; -import com.xpn.xwiki.xmlrpc.model.Page; -import com.xpn.xwiki.xmlrpc.model.PageSummary; -import com.xpn.xwiki.xmlrpc.model.ServerInfo; -import com.xpn.xwiki.xmlrpc.model.Space; -import com.xpn.xwiki.xmlrpc.model.User; -import com.xpn.xwiki.xmlrpc.model.UserInformation; - -public interface XWikiClient -{ - - void login(String username, String password) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * remove this token from the list of logged in tokens. Returns true if the user was logged out, - * false if they were not logged in in the first place (we don't really need this return, but - * void seems to kill XML-RPC for me) - */ - boolean logout() throws XWikiClientException, XWikiClientRemoteException; - - /** - * exports a Confluence instance and returns a String holding the URL for the download. The - * boolean argument indicates whether or not attachments ought to be included in the export. - */ - String exportSite(boolean exportAttachments) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * retrieve some basic information about the server being connected to. Useful for clients that - * need to turn certain features on or off depending on the version of the server. (Since 1.0.3) - */ - ServerInfo getServerInfo() throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the {@link SpaceSummary} instances that the current user can see. - */ - List getSpaces() throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns a single Space. - */ - Space getSpace(String spaceKey) throws XWikiClientException, XWikiClientRemoteException; - - /** - * exports a space and returns a String holding the URL for the download. The export type - * argument indicates whether or not to export in XML, PDF, or HTML format - use "TYPE_XML", - * "TYPE_PDF", or "TYPE_HTML" respectively. Also, using "all" will select TYPE_XML. - */ - String exportSpace(String spaceKey, String exportType) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * create a new space, passing in name, key and description. - */ - Space addSpace(Space space) throws XWikiClientException, XWikiClientRemoteException; - - /** - * remove a space completely. - */ - boolean removeSpace(String spaceKey) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the {@link PageSummary} instances in the space. Doesn't include pages which are - * in the Trash. Equivalent to calling {{Space.getCurrentPages()}}. - */ - List getPages(String spaceKey) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns a single Page - */ - Page getPage(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns a single Page - */ - Page getPage(String spaceKey, String pageTitle) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * returns all the {@link PageHistorySummary} instances - useful for looking up the previous - * versions of a page, and who changed them. - */ - List getPageHistory(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the {@link Attachment}s for this page (useful to point users to download them - * with the full file download URL returned). - */ - List getAttachments(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the ancestors (as {@link PageSummary} instances) of this page (parent, parent's - * parent etc). - */ - List getAncestors(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the direct children (as {@link PageSummary} instances) of this page. - */ - List getChildren(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the descendents (as {@link PageSummary} instances) of this page (children, - * children's children etc). - */ - List getDescendents(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the {@link Comment}s for this page. - */ - List getComments(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns an individual comment. - */ - Comment getComment(String commentId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * adds a comment to the page. - */ - Comment addComment(Comment comment) throws XWikiClientException, XWikiClientRemoteException; - - /** - * removes a comment from the page. - */ - boolean removeComment(String commentId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * add or update a page. For adding, the Page given as an argument should have space, title and - * content fields at a minimum. For updating, the Page given should have id, space, title, - * content and version fields at a minimum. The parentId field is always optional. All other - * fields will be ignored. - */ - Page storePage(Page page) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns the HTML rendered content for this page. If 'content' is provided, then that is - * rendered as if it were the body of the page (useful for a 'preview page' function). If it's - * not provided, then the existing content of the page is used instead (ie useful for 'view - * page' function). - * - * @param spaceKey unused. We have to have since it's in the Confluence XMLRPC API but it doesn't seem to be used. - * @param pageId the id of page to get rendered HTML. A getPage() call should be done to get the pageId. The - * pageId can be in any format since this API will support any server side system implementing it. - * @param content if this is set, it will replace the original content for rendering - * @return the string representing the rendered content of the page as HTML - * @throws XWikiClientException in case of error - * @throws XWikiClientRemoteException in case of error - */ - String renderContent(String spaceKey, String pageId, String content) - throws XWikiClientException, XWikiClientRemoteException; - - String renderContent(String spaceKey, String pageId) throws XWikiClientException, - XWikiClientRemoteException; - - String renderContent(PageSummary page) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Like the above renderContent(), but you can supply an optional hash (map, dictionary, etc) - * containing additional instructions for the renderer. Currently, only one such parameter is - * supported: - */ - String renderContent(String spaceKey, String pageId, String content, Map parameters) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * remove a page - */ - void removePage(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * get information about an attachment. - */ - Attachment getAttachment(String pageId, String fileName, String versionNumber) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * get the contents of an attachment. - */ - byte[] getAttachmentData(String pageId, String fileName, String versionNumber) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * add a new attachment to a content entity object. *Note that this uses a lot of memory -- - * about 4 times the size of the attachment.* - */ - Attachment addAttachment(String pageId, Attachment attachment, byte[] attachmentData) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * remove an attachment from a content entity object. - */ - boolean removeAttachment(String pageId, String fileName) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * move an attachment to a different content entity object and/or give it a new name. - */ - boolean moveAttachment(String originalPageId, String originalName, String newPageId, - String newName) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns all the {@link BlogEntrySummary} instances in the space. - */ - List getBlogEntries(String spaceKey) throws XWikiClientException, XWikiClientRemoteException; - - /** - * returns a single BlogEntry. - */ - BlogEntry getBlogEntry(String pageId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * add or update a blog entry. For adding, the BlogEntry given as an argument should have space, - * title and content fields at a minimum. For updating, the BlogEntry given should have id, - * space, title, content and version fields at a minimum. All other fields will be ignored. - */ - BlogEntry storeBlogEntry(BlogEntry entry) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Retrieves a blog post in the Space with the given spaceKey, with the title 'postTitle' and - * posted on the day 'dayOfMonth'. - */ - BlogEntry getBlogEntryByDayAndTitle(String spaceKey, int dayOfMonth, String postTitle) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * return a list of {@link SearchResult}s which match a given search query (including pages and - * other content types). This is the same as a performing a parameterised search (see below) - * with an empty parameter map. - */ - List search(String query, int maxResults) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns a list of {@link SearchResult}s like the previous search, but you can optionally - * limit your search by adding parameters to the parameter map. If you do not include a - * parameter, the default is used instead. - */ - List search(String query, Map parameters, int maxResults) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns a List of {@link Permission}s representing the permissions the current user has for - * this space (a list of "view", "modify", "comment" and / or "admin"). - */ - List getPermissions(String spaceKey) throws XWikiClientException, XWikiClientRemoteException; - - /** - * Returns a List of {@link Permission}s representing the permissions the given user has for - * this space. (since 2.1.4) - */ - List getPermissionsForUser(String spaceKey, String userName) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns a List of {@link Permission}s representing the permissions set on the given page. - */ - List getPagePermissions(String pageId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * returns List of the space level {@link Permission}s which may be granted. This is a list of - * possible permissions to use with {{addPermissionToSpace}}, below, not a list of current - * permissions on a Space. - */ - List getSpaceLevelPermissions() throws XWikiClientException, XWikiClientRemoteException; - - /** - * Give the entity named {{remoteEntityName}} (either a group or a user) the permission - * {{permission}} on the space with the key {{spaceKey}}. - */ - boolean addPermissionToSpace(String permission, String remoteEntityName, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Give the entity named {{remoteEntityName}} (either a group or a user) the permissions - * {{permissions}} on the space with the key {{spaceKey}}. - */ - boolean addPermissionsToSpace(List permissions, String remoteEntityName, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Remove the permission {{permission} from the entity named {{remoteEntityName}} (either a - * group or a user) on the space with the key {{spaceKey}}. - */ - boolean removePermissionFromSpace(String permission, String remoteEntityName, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Give anonymous users the permission {{permission}} on the space with the key {{spaceKey}}. - * (since 2.0) - */ - boolean addAnonymousPermissionToSpace(String permission, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Give anonymous users the permissions {{permissions}} on the space with the key {{spaceKey}}. - * (since 2.0) - */ - boolean addAnonymousPermissionsToSpace(List permissions, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Remove the permission {{permission} from anonymous users on the space with the key - * {{spaceKey}}. (since 2.0) - */ - boolean removeAnonymousPermissionFromSpace(String permission, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Remove all the global and space level permissions for {{groupname}}. - */ - boolean removeAllPermissionsForGroup(String groupname) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * get a single user - */ - User getUser(String username) throws XWikiClientException, XWikiClientRemoteException; - - /** - * add a new user with the given password - */ - void addUser(User user, String password) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * add a new group - */ - void addGroup(String group) throws XWikiClientException, XWikiClientRemoteException; - - /** - * get a user's current groups as a list of {@link String}s - */ - List getUserGroups(String username) throws XWikiClientException, XWikiClientRemoteException; - - /** - * add a user to a particular group - */ - void addUserToGroup(String username, String groupname) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * remove a user from a group. - */ - boolean removeUserFromGroup(String username, String groupname) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * delete a user. - */ - boolean removeUser(String username) throws XWikiClientException, XWikiClientRemoteException; - - /** - * remove a group. If {{defaultGroupName}} is specified, users belonging to {{groupname}} will - * be added to {{defaultGroupName}}. - */ - boolean removeGroup(String groupname, String defaultGroupName) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * gets all groups as a list of {@link String}s - */ - List getGroups() throws XWikiClientException, XWikiClientRemoteException; - - /** - * checks if a user exists - */ - boolean hasUser(String username) throws XWikiClientException, XWikiClientRemoteException; - - /** - * checks if a group exists - */ - boolean hasGroup(String groupname) throws XWikiClientException, XWikiClientRemoteException; - - /** - * edits the details of a user - */ - boolean editUser(User remoteUser) throws XWikiClientException, XWikiClientRemoteException; - - /** - * deactivates the specified user - */ - boolean deactivateUser(String username) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * reactivates the specified user - */ - boolean reactivateUser(String username) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * returns all registered users as Strings - */ - List getActiveUsers(boolean viewAll) throws XWikiClientException, XWikiClientRemoteException; - - /** - * updates user information - */ - boolean setUserInformation(UserInformation userInfo) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Retrieves user information - */ - UserInformation getUserInformation(String username) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * changes the current user's password - */ - boolean changeMyPassword(String oldPass, String newPass) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * changes the specified user's password - */ - boolean changeUserPassword(String username, String newPass) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns all {@link Label}s for the given ContentEntityObject ID - */ - List getLabelsById(long objectId) throws XWikiClientException, XWikiClientRemoteException; - - /** - * Returns the most popular {@link Label}s for the Confluence instance, with a specified - * maximum number. - */ - List getMostPopularLabels(int maxCount) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns the most popular {@link Label}s for the given {{spaceKey}}, with a specified maximum - * number of results. - */ - List getMostPopularLabelsInSpace(String spaceKey, int maxCount) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns the recently used {@link Label}s for the Confluence instance, with a specified - * maximum number of results. - */ - List getRecentlyUsedLabels(int maxResults) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns the recently used {@link Label}s for the given {{spaceKey}}, with a specified - * maximum number of results. - */ - List getRecentlyUsedLabelsInSpace(String spaceKey, int maxResults) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Returns a list of {@link Space}s that have been labeled with {{labelName}}. - */ - List getSpacesWithLabel(String labelName) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns the {@link Label}s related to the given label name, with a specified maximum number - * of results. - */ - List getRelatedLabels(String labelName, int maxResults) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns the {@link Label}s related to the given label name for the given {{spaceKey}}, with - * a specified maximum number of results. - */ - List getRelatedLabelsInSpace(String labelName, String spaceKey, int maxResults) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Retrieves the {@link Label}s matching the given {{labelName}}, {{namespace}}, {{spaceKey}} - * or {{owner}}. - */ - List getLabelsByDetail(String labelName, String namespace, String spaceKey, String owner) - throws XWikiClientException, XWikiClientRemoteException; - - /** - * Returns the content for a given label ID - */ - List getLabelContentById(long labelId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns the content for a given label name. - */ - List getLabelContentByName(String labelName) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns the content for a given Label object. - */ - List getLabelContentByObject(Label labelObject) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Returns all Spaces that have content labeled with {{labelName}}. - */ - List getSpacesContainingContentWithLabel(String labelName) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Adds a label to the object with the given ContentEntityObject ID. - */ - boolean addLabelByName(String labelName, long objectId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Adds a label with the given ID to the object with the given ContentEntityObject ID. - */ - boolean addLabelById(long labelId, long objectId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Adds the given label object to the object with the given ContentEntityObject ID. - */ - boolean addLabelByObject(Label labelObject, long objectId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Adds a label to the object with the given ContentEntityObject ID. - */ - boolean addLabelByNameToSpace(String labelName, String spaceKey) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Removes the given label from the object with the given ContentEntityObject ID. - */ - boolean removeLabelByName(String labelName, long objectId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Removes the label with the given ID from the object with the given ContentEntityObject ID. - */ - boolean removeLabelById(long labelId, long objectId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Removes the given label object from the object with the given ContentEntityObject ID. - */ - boolean removeLabelByObject(Label labelObject, long objectId) throws XWikiClientException, - XWikiClientRemoteException; - - /** - * Removes the given label from the given {{spaceKey}}. - */ - boolean removeLabelByNameFromSpace(String labelName, String spaceKey) - throws XWikiClientException, XWikiClientRemoteException; - - // XWiki-only methods - - List getAttachmentVersions(String pageId, String fileName) throws XWikiClientRemoteException, - XWikiClientException; - - void setNoConversion() throws XWikiClientRemoteException, XWikiClientException; - -} Index: src/main/resources/org/apache/xmlrpc/webserver/XmlRpcServlet.properties =================================================================== --- src/main/resources/org/apache/xmlrpc/webserver/XmlRpcServlet.properties (revision 9134) +++ src/main/resources/org/apache/xmlrpc/webserver/XmlRpcServlet.properties (working copy) @@ -1 +1,2 @@ -confluence1=com.xpn.xwiki.xmlrpc.ConfluenceRpcHandler \ No newline at end of file +confluence1=com.xpn.xwiki.xmlrpc.XWikiXmlRpcHandler +xwiki1=com.xpn.xwiki.xmlrpc.XWikiXmlRpcHandler \ No newline at end of file Index: pom.xml =================================================================== --- pom.xml (revision 9134) +++ pom.xml (working copy) @@ -513,6 +513,11 @@ ${platform.tool.test.version} test + + org.xwiki.platform + xwiki-xmlrpc-model + 1.4-SNAPSHOT +