org.codehaus.mojo.delicious
Class DeliciousService

java.lang.Object
  extended by org.codehaus.mojo.delicious.DeliciousService

public class DeliciousService
extends Object

A high level service access class for Delicious bookmarks.

Author:
ashley

Constructor Summary
DeliciousService()
          Creates a service that can connect to the REST api.
DeliciousService(DeliciousConnection connection)
          Plugin an alternative connection - probably for testing.
 
Method Summary
 void addBookmark(Bookmark bookmark, Boolean replace)
          Adds the given bookmark to the delicious service.
 void addBookmarks(BookmarkGroup group, Boolean replace)
          Adds the given group of bookmarks.
 void addBookmarks(List bookmarks, Boolean replace)
          Adds the given list of bookmars to the delicious service.
 void addBookmarks(Reader links, Boolean replace)
          Adds the links found at the given reader to the delicious service.
 void addBookmarks(String linksPage, Boolean replace)
          Adds the links found at the given path, that can be a local file or net URL.
 void addPost(String url, String description, String tags, String extended, Boolean replace)
          Adds the post with the given information.
 void deletePost(String url)
          Deletes the post at the given url.
 void doService(String category, String command, HashMap formFields)
          Invokes the delicous service defined by the supplied url and query.
 void fetchAllPosts(String tags)
          Fetches all posts.
 void fetchDates(String tags)
          Fetches a list of dates with the number of posts at each date.
 void fetchPosts(String tags, String date, String url)
          Fetches a list of posts with the given search criteria.
 void fetchRecentPosts(String tags, String count)
          Fetches a list of most recent posts, possibly filtered by tag, maxes out at 100.
 void fetchTags()
          Fetches the tags used by this account.
 void fetchUpdateTime()
          Gets the time of the last update.
 int getCode()
          The code of the most recent server communication.
 DeliciousListener getListener()
          Gets the currently set listener.
 boolean isServiceUnavailableException(RuntimeException e)
          Returns true if the given exception represents the service unavailable exception.
 void renameTag(String oldName, String newName)
          Renames the given tag.
 void setListener(DeliciousListener listener)
          Currently sets the one and only listener.
 void setUser(String userName, String password)
          Sets the credential to be used for this service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeliciousService

public DeliciousService(DeliciousConnection connection)
Plugin an alternative connection - probably for testing.


DeliciousService

public DeliciousService()
Creates a service that can connect to the REST api.

Method Detail

isServiceUnavailableException

public boolean isServiceUnavailableException(RuntimeException e)
Returns true if the given exception represents the service unavailable exception.

Parameters:
e -
Returns:

getListener

public DeliciousListener getListener()
Gets the currently set listener.

Returns:

setListener

public void setListener(DeliciousListener listener)
Currently sets the one and only listener.

Parameters:
listener -

getCode

public int getCode()
The code of the most recent server communication.

Returns:

addBookmarks

public void addBookmarks(Reader links,
                         Boolean replace)
                  throws IOException,
                         InterruptedException
Adds the links found at the given reader to the delicious service. The reader is assumed to be for a valid xml file containing anchor tags.

Parameters:
links -
replace -
Throws:
IOException
InterruptedException

addBookmarks

public void addBookmarks(BookmarkGroup group,
                         Boolean replace)
                  throws IOException,
                         InterruptedException
Adds the given group of bookmarks.

Parameters:
group -
replace -
Throws:
IOException
InterruptedException

addBookmarks

public void addBookmarks(List bookmarks,
                         Boolean replace)
                  throws IOException,
                         InterruptedException
Adds the given list of bookmars to the delicious service.

Parameters:
bookmarks -
replace -
Throws:
InterruptedException
IOException
ParserConfigurationException
SAXException
IOException
InterruptedException

addBookmark

public void addBookmark(Bookmark bookmark,
                        Boolean replace)
                 throws IOException,
                        InterruptedException
Adds the given bookmark to the delicious service.

Parameters:
bookmark -
replace - TODO
Throws:
IOException
InterruptedException

addBookmarks

public void addBookmarks(String linksPage,
                         Boolean replace)
                  throws IOException,
                         InterruptedException
Adds the links found at the given path, that can be a local file or net URL. Convenience method.

Parameters:
replace -
links -
Throws:
IOException
InterruptedException

setUser

public void setUser(String userName,
                    String password)
Sets the credential to be used for this service.

Parameters:
userName -
password -

fetchDates

public void fetchDates(String tags)
                throws IOException,
                       InterruptedException
Fetches a list of dates with the number of posts at each date.

Parameters:
tags -
Throws:
IOException
InterruptedException

fetchPosts

public void fetchPosts(String tags,
                       String date,
                       String url)
                throws IOException,
                       InterruptedException
Fetches a list of posts with the given search criteria. Either specify a tags/date combination, just a date or just a url.

Parameters:
tags -
Throws:
IOException
InterruptedException

fetchRecentPosts

public void fetchRecentPosts(String tags,
                             String count)
                      throws IOException,
                             InterruptedException
Fetches a list of most recent posts, possibly filtered by tag, maxes out at 100.

Throws:
IOException
InterruptedException

fetchAllPosts

public void fetchAllPosts(String tags)
                   throws IOException,
                          InterruptedException
Fetches all posts. use sparingly. call update function first to see if you need to fetch this at all.

Throws:
IOException
InterruptedException

fetchUpdateTime

public void fetchUpdateTime()
                     throws IOException,
                            InterruptedException
Gets the time of the last update.

Throws:
IOException
InterruptedException

addPost

public void addPost(String url,
                    String description,
                    String tags,
                    String extended,
                    Boolean replace)
             throws IOException,
                    InterruptedException
Adds the post with the given information.

Parameters:
url -
description -
tags -
extended -
replace -
Throws:
IOException
InterruptedException

deletePost

public void deletePost(String url)
                throws IOException,
                       InterruptedException
Deletes the post at the given url.

Parameters:
url -
Throws:
IOException
InterruptedException

fetchTags

public void fetchTags()
               throws IOException,
                      InterruptedException
Fetches the tags used by this account.

Throws:
IOException
InterruptedException

renameTag

public void renameTag(String oldName,
                      String newName)
               throws IOException,
                      InterruptedException
Renames the given tag.

Parameters:
url -
Throws:
IOException
InterruptedException

doService

public void doService(String category,
                      String command,
                      HashMap formFields)
               throws IOException,
                      InterruptedException
Invokes the delicous service defined by the supplied url and query. The username and password are supplied for http-auth basic authorisation. According to the guidelines at http://del.icio.us/doc/api this method: For an ordinairy internal server error this method will try up to a maximum number of times before bailing out.

Parameters:
category - TODO
command -
formFields -
Throws:
IOException
InterruptedException


Copyright © 2005-2011 Codehaus. All Rights Reserved.