org.blojsom.extension.xmlrpc.handler
Class BloggerAPIHandler

java.lang.Object
  extended byorg.blojsom.extension.xmlrpc.handler.APIHandler
      extended byorg.blojsom.extension.xmlrpc.handler.BloggerAPIHandler

public class BloggerAPIHandler
extends APIHandler

Blogger API handler

Since:
blojsom 3.0
Version:
$Id: BloggerAPIHandler.java,v 1.6 2007/01/17 02:35:07 czarneckid Exp $
Author:
David Czarnecki

Field Summary
 
Fields inherited from class org.blojsom.extension.xmlrpc.handler.APIHandler
_authorizationProvider, _blog, _eventBroadcaster, _fetcher, _httpServletRequest, _httpServletResponse, _properties, _servletConfig, ALL_XMLRPC_EDIT_PERMISSION, AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG, INVALID_POSTID, INVALID_POSTID_MSG, NOBLOGS_EXCEPTION, NOBLOGS_EXCEPTION_MSG, PERMISSION_EXCEPTION, PERMISSION_EXCEPTION_MSG, UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG, UNSUPPORTED_EXCEPTION, UNSUPPORTED_EXCEPTION_MSG
 
Constructor Summary
BloggerAPIHandler()
          Create a new instance of the Blogger API handler
 
Method Summary
 boolean deletePost(java.lang.String appkey, java.lang.String postid, java.lang.String userid, java.lang.String password, boolean publish)
          Delete a Post
 boolean editPost(java.lang.String appkey, java.lang.String postid, java.lang.String userid, java.lang.String password, java.lang.String content, boolean publish)
          Edits a given post.
 java.lang.String getName()
          Retrieve the API handler name
 java.lang.Object getPost(java.lang.String appkey, java.lang.String postid, java.lang.String userid, java.lang.String password)
          Get a particular post for a blojsom category
 java.lang.Object getRecentPosts(java.lang.String appkey, java.lang.String blogid, java.lang.String userid, java.lang.String password, int numposts)
          Get a list of recent posts for a blojsom category
 java.lang.String getTemplate(java.lang.String appkey, java.lang.String blogid, java.lang.String userid, java.lang.String password, java.lang.String templateType)
          Returns the main or archive index template of a given blog (NOT IMPLEMENTED)
 java.lang.Object getUserInfo(java.lang.String appkey, java.lang.String userid, java.lang.String password)
          Authenticates a user and returns basic user info (name, email, userid, etc.).
 java.lang.Object getUsersBlogs(java.lang.String appkey, java.lang.String userid, java.lang.String password)
          Returns information on all the blogs a given user is a member of
 java.lang.String newPost(java.lang.String appkey, java.lang.String blogid, java.lang.String userid, java.lang.String password, java.lang.String content, boolean publish)
          Makes a new post to a designated blog.
 boolean setTemplate(java.lang.String appkey, java.lang.String blogid, java.lang.String userid, java.lang.String password, java.lang.String template, java.lang.String templateType)
          Edits the main or archive index template of a given blog (NOT IMPLEMENTED)
 
Methods inherited from class org.blojsom.extension.xmlrpc.handler.APIHandler
checkXMLRPCPermission, setAuthorizationProvider, setBlog, setEventBroadcaster, setFetcher, setHttpServletRequest, setHttpServletResponse, setProperties, setServletConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BloggerAPIHandler

public BloggerAPIHandler()
Create a new instance of the Blogger API handler

Method Detail

getName

public java.lang.String getName()
Retrieve the API handler name

Specified by:
getName in class APIHandler
Returns:
API handler name "blogger"

getUserInfo

public java.lang.Object getUserInfo(java.lang.String appkey,
                                    java.lang.String userid,
                                    java.lang.String password)
                             throws java.lang.Exception
Authenticates a user and returns basic user info (name, email, userid, etc.).

Parameters:
appkey - Unique identifier/passcode of the application sending the post
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
Returns:
Basic user information (name, email, userid)
Throws:
org.apache.xmlrpc.XmlRpcException - If there is an error
java.lang.Exception

getUsersBlogs

public java.lang.Object getUsersBlogs(java.lang.String appkey,
                                      java.lang.String userid,
                                      java.lang.String password)
                               throws java.lang.Exception
Returns information on all the blogs a given user is a member of

Parameters:
appkey - Unique identifier/passcode of the application sending the post
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
Returns:
Blog category list
Throws:
org.apache.xmlrpc.XmlRpcException - If there are no categories or the user was not authenticated correctly
java.lang.Exception

newPost

public java.lang.String newPost(java.lang.String appkey,
                                java.lang.String blogid,
                                java.lang.String userid,
                                java.lang.String password,
                                java.lang.String content,
                                boolean publish)
                         throws java.lang.Exception
Makes a new post to a designated blog. Optionally, will publish the blog after making the post

Parameters:
appkey - Unique identifier/passcode of the application sending the post
blogid - Unique identifier of the blog the post will be added to
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
content - Contents of the post
publish - If true, the blog will be published immediately after the post is made
Returns:
Post ID of the added entry
Throws:
org.apache.xmlrpc.XmlRpcException - If the user was not authenticated correctly or if there was an I/O exception
java.lang.Exception

editPost

public boolean editPost(java.lang.String appkey,
                        java.lang.String postid,
                        java.lang.String userid,
                        java.lang.String password,
                        java.lang.String content,
                        boolean publish)
                 throws java.lang.Exception
Edits a given post. Optionally, will publish the blog after making the edit

Parameters:
appkey - Unique identifier/passcode of the application sending the post
postid - Unique identifier of the post to be changed
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
content - Contents of the post
publish - If true, the blog will be published immediately after the post is made
Returns:
true if the entry was edited, false otherwise
Throws:
org.apache.xmlrpc.XmlRpcException - If the user was not authenticated correctly, if there was an I/O exception, or if the entry permalink ID is invalid
java.lang.Exception

getPost

public java.lang.Object getPost(java.lang.String appkey,
                                java.lang.String postid,
                                java.lang.String userid,
                                java.lang.String password)
                         throws java.lang.Exception
Get a particular post for a blojsom category

Parameters:
appkey - Unique identifier/passcode of the application sending the post
postid - Unique identifier of the blog post
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
Returns:
Post to the blog
Throws:
org.apache.xmlrpc.XmlRpcException - If the user was not authenticated correctly
java.lang.Exception

deletePost

public boolean deletePost(java.lang.String appkey,
                          java.lang.String postid,
                          java.lang.String userid,
                          java.lang.String password,
                          boolean publish)
                   throws java.lang.Exception
Delete a Post

Parameters:
appkey - Unique identifier/passcode of the application sending the post
postid - Unique identifier of the post to be changed
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
publish - Ignored
Returns:
true if the entry was delete, false otherwise
Throws:
org.apache.xmlrpc.XmlRpcException - If there is an error deleting the post
java.lang.Exception

getRecentPosts

public java.lang.Object getRecentPosts(java.lang.String appkey,
                                       java.lang.String blogid,
                                       java.lang.String userid,
                                       java.lang.String password,
                                       int numposts)
                                throws java.lang.Exception
Get a list of recent posts for a blojsom category

Parameters:
appkey - Unique identifier/passcode of the application sending the post
blogid - Unique identifier of the blog the post will be added to
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
numposts - Number of Posts to Retrieve
Returns:
Recent posts to the blog
Throws:
org.apache.xmlrpc.XmlRpcException - If the user was not authenticated correctly
java.lang.Exception

setTemplate

public boolean setTemplate(java.lang.String appkey,
                           java.lang.String blogid,
                           java.lang.String userid,
                           java.lang.String password,
                           java.lang.String template,
                           java.lang.String templateType)
                    throws java.lang.Exception
Edits the main or archive index template of a given blog (NOT IMPLEMENTED)

Parameters:
appkey - Unique identifier/passcode of the application sending the post
blogid - Unique identifier of the blog the post will be added to
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
template - The text for the new template (usually mostly HTML). Must contain opening and closing tags, since they're needed to publish
templateType - Determines which of the blog's templates will be returned. Currently, either "main" or "archiveIndex"
Returns:
Not supported
Throws:
org.apache.xmlrpc.XmlRpcException - Not supported
java.lang.Exception

getTemplate

public java.lang.String getTemplate(java.lang.String appkey,
                                    java.lang.String blogid,
                                    java.lang.String userid,
                                    java.lang.String password,
                                    java.lang.String templateType)
                             throws java.lang.Exception
Returns the main or archive index template of a given blog (NOT IMPLEMENTED)

Parameters:
appkey - Unique identifier/passcode of the application sending the post
blogid - Unique identifier of the blog the post will be added to
userid - Login for a Blogger user who has permission to post to the blog
password - Password for said username
templateType - Determines which of the blog's templates will be returned. Currently, either "main" or "archiveIndex"
Returns:
Not supported
Throws:
org.apache.xmlrpc.XmlRpcException - Not supported
java.lang.Exception