/*
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2005 - 2016 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* Alfresco 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 3 of the License, or
* (at your option) any later version.
*
* Alfresco 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 Alfresco. If not, see .
* #L%
*/
package org.alfresco.repo.blog;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
/**
* Default blog integration implementation. Uses various standard XML PRC blogging API to satisfy the
* blog integration implementation interface.
*
* Based on origional contribution by Sudhakar Selvaraj.
*
* @author Roy Wetherall
*/
public abstract class DefaultBlogIntegrationImplementation extends BaseBlogIntegrationImplementation
{
/** Blog actions */
protected static final String ACTION_NEW_POST = "metaWeblog.newPost";
protected static final String ACTION_EDIT_POST = "metaWeblog.editPost";
protected static final String ACTION_GET_POST = "metaWeblog.getPost";
protected static final String ACTION_DELETE_POST = "blogger.deletePost";
/**
* Gets the XML RPC end point URL for the given blog details.
*
* @param blogDetails blog details
* @return String the end point URL
*/
protected abstract String getEndpointURL(BlogDetails blogDetails);
/**
* @see org.alfresco.repo.blog.BlogIntegrationImplementation#newPost(org.alfresco.repo.blog.BlogDetails, java.lang.String, java.lang.String, boolean)
*/
public String newPost(BlogDetails blogDetails, String title, String body, boolean publish)
{
// Create the hash table containing details of the post's content
Hashtable content = new Hashtable();
content.put("title", title);
content.put("description", body);
// Create a list of parameters
List