org.blojsom.extension.xmlrpc.handler
Class MetaWeblogAPIHandler

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

public class MetaWeblogAPIHandler
extends APIHandler

MetaWeblogAPIHandler

Since:
blojsom 3.0
Version:
$Id: MetaWeblogAPIHandler.java,v 1.7 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
MetaWeblogAPIHandler()
          Create a new instance of the MetaWeblog 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 postid, java.lang.String userid, java.lang.String password, java.util.Hashtable struct, boolean publish)
          Edits a given post.
 java.lang.Object getCategories(java.lang.String blogid, java.lang.String userid, java.lang.String password)
          Authenticates a user and returns the categories available in the blojsom
 java.lang.String getName()
          Retrieve the API handler name
 java.lang.Object getPost(java.lang.String postid, java.lang.String userid, java.lang.String password)
          Retrieves a given post from the blog
 java.lang.Object getRecentPosts(java.lang.String blogid, java.lang.String userid, java.lang.String password, int numberOfPosts)
          Retrieves a set of recent posts to the blog
 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 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.Object newMediaObject(java.lang.String blogid, java.lang.String userid, java.lang.String password, java.util.Hashtable struct)
          Uploads an object to the blog to a specified directory
 java.lang.String newPost(java.lang.String blogid, java.lang.String userid, java.lang.String password, java.util.Hashtable struct, boolean publish)
          Makes a new post to a designated blog.
 void setBlog(Blog blog)
          Set the 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, 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

MetaWeblogAPIHandler

public MetaWeblogAPIHandler()
Create a new instance of the MetaWeblog 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 "metaWeblog"

setBlog

public void setBlog(Blog blog)
Set the Blog

Overrides:
setBlog in class APIHandler
Parameters:
blog - Blog

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

getCategories

public java.lang.Object getCategories(java.lang.String blogid,
                                      java.lang.String userid,
                                      java.lang.String password)
                               throws java.lang.Exception
Authenticates a user and returns the categories available in the blojsom

Parameters:
blogid - Dummy Value for Blojsom
userid - Login for a MetaWeblog 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 blogid,
                                java.lang.String userid,
                                java.lang.String password,
                                java.util.Hashtable struct,
                                boolean publish)
                         throws java.lang.Exception
Makes a new post to a designated blog. Optionally, will publish the blog after making the post

Parameters:
blogid - Unique identifier of the blog the post will be added to
userid - Login for a MetaWeblog user who has permission to post to the blog
password - Password for said username
struct - 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 postid,
                        java.lang.String userid,
                        java.lang.String password,
                        java.util.Hashtable struct,
                        boolean publish)
                 throws java.lang.Exception
Edits a given post. Optionally, will publish the blog after making the edit

Parameters:
postid - Unique identifier of the post to be changed
userid - Login for a MetaWeblog user who has permission to post to the blog
password - Password for said username
struct - 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 postid,
                                java.lang.String userid,
                                java.lang.String password)
                         throws java.lang.Exception
Retrieves a given post from the blog

Parameters:
postid - Unique identifier of the post to be changed
userid - Login for a MetaWeblog user who has permission to post to the blog
password - Password for said username
Returns:
Structure containing the minimal attributes for the MetaWeblog API getPost() method: title, link, and description
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

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
java.lang.Exception

getRecentPosts

public java.lang.Object getRecentPosts(java.lang.String blogid,
                                       java.lang.String userid,
                                       java.lang.String password,
                                       int numberOfPosts)
                                throws java.lang.Exception
Retrieves a set of recent posts to the blog

Parameters:
blogid - Unique identifier of the blog the post will be added to
userid - Login for a MetaWeblog user who has permission to post to the blog
password - Password for said username
numberOfPosts - Number of posts to be retrieved from the blog
Returns:
Array of structures containing the minimal attributes for the MetaWeblog API getPost() method: title, link, and description
Throws:
java.lang.Exception - If the user was not authenticated correctly

newMediaObject

public java.lang.Object newMediaObject(java.lang.String blogid,
                                       java.lang.String userid,
                                       java.lang.String password,
                                       java.util.Hashtable struct)
                                throws java.lang.Exception
Uploads an object to the blog to a specified directory

Parameters:
blogid - Unique identifier of the blog the post will be added to
userid - Login for a MetaWeblog user who has permission to post to the blog
password - Password for said username
struct - Upload structure defined by the MetaWeblog API
Returns:
Structure containing a link to the uploaded media object
Throws:
org.apache.xmlrpc.XmlRpcException - If the user was not authenticated correctly, if there was an I/O exception, or if the MIME type of the upload object is not accepted
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:
Throws:
org.apache.xmlrpc.XmlRpcException
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:
Throws:
org.apache.xmlrpc.XmlRpcException
java.lang.Exception