net.sourceforge.pebble.webservice
Class AbstractAPIHandler

java.lang.Object
  extended by net.sourceforge.pebble.webservice.AbstractAPIHandler
Direct Known Subclasses:
BloggerAPIHandler, MetaWeblogAPIHandler, PebbleAPIHandler

public abstract class AbstractAPIHandler
extends java.lang.Object

A handler for the XML-RPC blogging APIs.

Author:
Simon Brown

Constructor Summary
AbstractAPIHandler()
           
 
Method Summary
protected  void authenticate(Blog blog, java.lang.String username, java.lang.String password)
          A helper method to authenticate a username/password pair against the properties for the specified Blog instance.
protected  java.lang.String formatPostId(java.lang.String blogid, java.lang.String postid)
          Formats a post ID for the blogger client.
 AuthenticationManager getAuthenticationManager()
           
protected  Blog getBlogWithBlogId(java.lang.String blogId)
          Gets the blog from a given String.
protected  Blog getBlogWithPostId(java.lang.String s)
          Gets the blog from a given String.
protected  java.lang.String getPostId(java.lang.String s)
          Gets the post ID (blog entry ID) from a given String.
 void setAuthenticationManager(AuthenticationManager authenticationManager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAPIHandler

public AbstractAPIHandler()
Method Detail

getAuthenticationManager

public AuthenticationManager getAuthenticationManager()

setAuthenticationManager

public void setAuthenticationManager(AuthenticationManager authenticationManager)

authenticate

protected void authenticate(Blog blog,
                            java.lang.String username,
                            java.lang.String password)
                     throws XmlRpcAuthenticationException
A helper method to authenticate a username/password pair against the properties for the specified Blog instance.

Parameters:
blog - the Blog instance to test against
username - the username used for logging in via XML-RPC
password - the password used for logging in via XML-RPC
Throws:
XmlRpcAuthenticationException

getBlogWithPostId

protected Blog getBlogWithPostId(java.lang.String s)
                          throws XmlRpcException
Gets the blog from a given String.

In single-user mode, blog IDs are irrelevant since there is only one blog. In multi-user mode, the post ID is composed of "blog ID/post ID" (this is Pebble's way of uniquely identifying a blog entry across all users' blogs).

Parameters:
s - the String containing the post ID
Returns:
the post ID (blog entry ID)
Throws:
XmlRpcException

getBlogWithBlogId

protected Blog getBlogWithBlogId(java.lang.String blogId)
                          throws XmlRpcException
Gets the blog from a given String.

In single-user mode, blog IDs are irrelevant since there is only one blog. In multi-user mode, the post ID is composed of "blog ID/post ID" (this is Pebble's way of uniquely identifying a blog entry across all users' blogs).

Parameters:
blogId - the String containing the post ID
Returns:
the blog ID
Throws:
XmlRpcException

getPostId

protected java.lang.String getPostId(java.lang.String s)
Gets the post ID (blog entry ID) from a given String.

In single-user mode, post IDs are specified as just the blog ID. In multi-user mode, the post ID is composed of "blog ID/post ID" (this is Pebble's way of uniquely identifying a blog entry across all users' blogs).

Parameters:
s - the String containing the post ID
Returns:
the post ID (blog entry ID)

formatPostId

protected java.lang.String formatPostId(java.lang.String blogid,
                                        java.lang.String postid)
Formats a post ID for the blogger client.

Parameters:
blogid - the blog ID
postid - the post ID
Returns:
if running in multi-user mode, returns "blogid/postid", otherwise just returns "postid"


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