net.sourceforge.pebble.webservice
Class BloggerAPIHandler

java.lang.Object
  extended by net.sourceforge.pebble.webservice.AbstractAPIHandler
      extended by net.sourceforge.pebble.webservice.BloggerAPIHandler

public class BloggerAPIHandler
extends AbstractAPIHandler

A handler for the Blogger API (accessed via XML-RPC).

Author:
Simon Brown

Constructor Summary
BloggerAPIHandler()
           
 
Method Summary
 boolean addCategory(java.lang.String appkey, java.lang.String postid, java.lang.String username, java.lang.String password, java.lang.String category)
          Adds a category to a blog entry - this isn't a standard Blogger API method.
 boolean deletePost(java.lang.String appkey, java.lang.String postid, java.lang.String username, java.lang.String password, boolean publish)
          Deletes an existing blog entry.
 boolean editPost(java.lang.String appkey, java.lang.String postid, java.lang.String username, java.lang.String password, java.lang.String content, boolean publish)
          Edits an existing blog entry.
 java.util.Hashtable getPost(java.lang.String appkey, java.lang.String postid, java.lang.String username, java.lang.String password)
          Gets an individual blog entry.
 java.util.Vector getRecentPosts(java.lang.String appkey, java.lang.String blogid, java.lang.String username, java.lang.String password, int numberOfPosts)
          Gets a list of the recent blog entries.
 java.lang.String getTemplate(java.lang.String appkey, java.lang.String blogid, java.lang.String username, java.lang.String password, java.lang.String templateType)
          Gets the specified template type for a blog - not supported by Pebble.
 java.util.Hashtable getUserInfo(java.lang.String appkey, java.lang.String username, java.lang.String password)
          Gets information about the user logging in.
 java.util.Vector getUsersBlogs(java.lang.String appkey, java.lang.String username, java.lang.String password)
          Gets a list of the blogs that the specified user can edit.
 java.lang.String newPost(java.lang.String appkey, java.lang.String blogid, java.lang.String username, java.lang.String password, java.lang.String content, boolean publish)
          Creates a new blog entry.
 boolean setTemplate(java.lang.String appkey, java.lang.String blogid, java.lang.String username, java.lang.String password, java.lang.String template, java.lang.String templateType)
          Sets the specified template type for a blog - not supported by Pebble.
 
Methods inherited from class net.sourceforge.pebble.webservice.AbstractAPIHandler
authenticate, formatPostId, getAuthenticationManager, getBlogWithBlogId, getBlogWithPostId, getPostId, setAuthenticationManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BloggerAPIHandler

public BloggerAPIHandler()
Method Detail

getUserInfo

public java.util.Hashtable getUserInfo(java.lang.String appkey,
                                       java.lang.String username,
                                       java.lang.String password)
                                throws XmlRpcException
Gets information about the user logging in.

Parameters:
appkey - the client application key (ignored)
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
Returns:
a Hashtable containing user information
Throws:
XmlRpcException - if something goes wrong, including an authentication error

getUsersBlogs

public java.util.Vector getUsersBlogs(java.lang.String appkey,
                                      java.lang.String username,
                                      java.lang.String password)
                               throws XmlRpcException
Gets a list of the blogs that the specified user can edit. Pabble only has the concept of a single blog.

Parameters:
appkey - the client application key (ignored)
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
Returns:
a Vector of Hashtables (an array of structs) representing blogs
Throws:
XmlRpcException - if something goes wrong, including an authentication error

getRecentPosts

public java.util.Vector getRecentPosts(java.lang.String appkey,
                                       java.lang.String blogid,
                                       java.lang.String username,
                                       java.lang.String password,
                                       int numberOfPosts)
                                throws XmlRpcException
Gets a list of the recent blog entries.

Parameters:
appkey - the client application key (ignored)
blogid - the ID of the blog (ignored)
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
numberOfPosts - the number of posts to get
Returns:
a Vector of Hashtables (an array of structs) representing blog entries
Throws:
XmlRpcException - if something goes wrong, including an authentication error

getPost

public java.util.Hashtable getPost(java.lang.String appkey,
                                   java.lang.String postid,
                                   java.lang.String username,
                                   java.lang.String password)
                            throws XmlRpcException
Gets an individual blog entry.

Parameters:
appkey - the client application key (ignored)
postid - the ID of the blog (ignored)
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
Returns:
a Hashtable representing a blog entry
Throws:
XmlRpcException - if something goes wrong, including an authentication error

newPost

public java.lang.String newPost(java.lang.String appkey,
                                java.lang.String blogid,
                                java.lang.String username,
                                java.lang.String password,
                                java.lang.String content,
                                boolean publish)
                         throws XmlRpcException
Creates a new blog entry.

Parameters:
appkey - the client application key (ignored)
blogid - the ID of the blog (ignored)
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
content - the content of the new blog entry
publish - a flag to indicate whether the entry should be published
Returns:
a String representing the ID of the new blog entry
Throws:
XmlRpcException - if something goes wrong, including an authentication error

editPost

public boolean editPost(java.lang.String appkey,
                        java.lang.String postid,
                        java.lang.String username,
                        java.lang.String password,
                        java.lang.String content,
                        boolean publish)
                 throws XmlRpcException
Edits an existing blog entry.

Parameters:
appkey - the client application key (ignored)
postid - the ID of the blog entry to be edited
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
content - the new content of the new blog entry
publish - a flag to indicate whether the entry should be published (this is ignored as all new entries are published)
Returns:
a boolean true value to signal success
Throws:
XmlRpcException - if something goes wrong, including an authentication error

deletePost

public boolean deletePost(java.lang.String appkey,
                          java.lang.String postid,
                          java.lang.String username,
                          java.lang.String password,
                          boolean publish)
                   throws XmlRpcException
Deletes an existing blog entry.

Parameters:
appkey - the client application key (ignored)
postid - the ID of the blog entry to be edited
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
publish - a flag to indicate whether the entry should be published (this is ignored)
Returns:
a boolean true value to signal success
Throws:
XmlRpcException - if something goes wrong, including an authentication error

getTemplate

public java.lang.String getTemplate(java.lang.String appkey,
                                    java.lang.String blogid,
                                    java.lang.String username,
                                    java.lang.String password,
                                    java.lang.String templateType)
                             throws XmlRpcException
Gets the specified template type for a blog - not supported by Pebble.

Parameters:
appkey - the client application key (ignored)
blogid - the ID of the blog
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
templateType - the type of template to retrieve
Returns:
the text of the specified template
Throws:
XmlRpcException

setTemplate

public boolean setTemplate(java.lang.String appkey,
                           java.lang.String blogid,
                           java.lang.String username,
                           java.lang.String password,
                           java.lang.String template,
                           java.lang.String templateType)
                    throws XmlRpcException
Sets the specified template type for a blog - not supported by Pebble.

Parameters:
appkey - the client application key (ignored)
blogid - the ID of the blog
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
template - the new text of the template
templateType - the type of template to retrieve
Returns:
true if setting the template was successful, false otherwise
Throws:
XmlRpcException

addCategory

public boolean addCategory(java.lang.String appkey,
                           java.lang.String postid,
                           java.lang.String username,
                           java.lang.String password,
                           java.lang.String category)
                    throws XmlRpcException
Adds a category to a blog entry - this isn't a standard Blogger API method.

Parameters:
appkey - the client application key (ignored)
postid - the ID of the blog entry to be edited
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
category - the category ID
Returns:
a boolean true value to signal success
Throws:
XmlRpcException - if something goes wrong, including an authentication error


Copyright © 2003-2006, Simon Brown. All Rights Reserved.