org.rometools.propono.blogclient.metaweblog
Class MetaWeblogBlog

java.lang.Object
  extended by org.rometools.propono.blogclient.metaweblog.MetaWeblogBlog
All Implemented Interfaces:
Blog

public class MetaWeblogBlog
extends Object
implements Blog

Blog implementation that uses a mix of Blogger and MetaWeblog API methods.


Nested Class Summary
 class MetaWeblogBlog.EntryIterator
          Iterates over MetaWeblog API entries.
 class MetaWeblogBlog.MetaWeblogBlogCollection
          MetaWeblog API impplementation of Blog.Collection
 class MetaWeblogBlog.NoOpIterator
          No-op iterator.
 
Nested classes/interfaces inherited from interface org.rometools.propono.blogclient.Blog
Blog.Collection
 
Method Summary
 List getCategories()
          Returns list of available BlogEntry.Category in primary entries collection.
 Blog.Collection getCollection(String token)
          Get collection by token.
 List getCollections()
          Gets listing of entry and resource collections available in the blog, including the primary collections.
 Iterator getEntries()
          Get iterator over entries in primary entries collection (the first collection that accepts entries).
 BlogEntry getEntry(String id)
          Get a single BlogEntry (or BlogResource) by token.
 String getName()
          Name of this blog.
 Iterator getResources()
          Get entries in primary resources collection (the first collection that accepts anything other than entries).
 String getToken()
          Token can be used to fetch this blog again from getBlog() method.
 BlogEntry newEntry()
          Create but do not save it to server new BlogEntry in primary entries collection (the first collection found that accepts entries).
 BlogResource newResource(String name, String contentType, byte[] bytes)
          Create but do not save it to server new BlogResource in primary resources collection (the first collection found that accepts resources).
 String toString()
          String representation of blog, returns the name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getName

public String getName()
Name of this blog.

Specified by:
getName in interface Blog
Returns:
Display name of this blog.

getToken

public String getToken()
Token can be used to fetch this blog again from getBlog() method.

Specified by:
getToken in interface Blog
Returns:
Blog object specified by token.

toString

public String toString()
String representation of blog, returns the name.

Overrides:
toString in class Object

newEntry

public BlogEntry newEntry()
Create but do not save it to server new BlogEntry in primary entries collection (the first collection found that accepts entries). To save the entry to the server to a collection, use the entry's save() method.

Specified by:
newEntry in interface Blog
Returns:
Unsaved BlogEntry in primary entries collection.

getEntry

public BlogEntry getEntry(String id)
                   throws BlogClientException
Get a single BlogEntry (or BlogResource) by token.

Specified by:
getEntry in interface Blog
Parameters:
id - Token from blog entry's getToken() method.
Returns:
Blog entry specified by token.
Throws:
BlogClientException

getEntries

public Iterator getEntries()
                    throws BlogClientException
Get iterator over entries in primary entries collection (the first collection that accepts entries). Note that entries may be partial, so don't try to update and save them: to update and entry, first fetch it with getEntry(), change fields, then call entry.save();

Specified by:
getEntries in interface Blog
Returns:
To iterate over all entries in collection.
Throws:
BlogClientException - On failure or if there is no primary entries collection.

newResource

public BlogResource newResource(String name,
                                String contentType,
                                byte[] bytes)
                         throws BlogClientException
Create but do not save it to server new BlogResource in primary resources collection (the first collection found that accepts resources). To save the resource to the server to a collection, use the resource's save() method.

Specified by:
newResource in interface Blog
Parameters:
name - Name of resource to be saved.
contentType - MIME content type of resource data.
bytes - Bytes of resource data.
Returns:
Unsaved BlogEntry in primary resources collection.
Throws:
BlogClientException - On error or if there is no primary respurces collection.

getResources

public Iterator getResources()
                      throws BlogClientException
Get entries in primary resources collection (the first collection that accepts anything other than entries).

Specified by:
getResources in interface Blog
Returns:
To iterate over all resojrces in collection.
Throws:
BlogClientException - On failure or if there is no primary resources collection.

getCategories

public List getCategories()
                   throws BlogClientException
Returns list of available BlogEntry.Category in primary entries collection.

Specified by:
getCategories in interface Blog
Returns:
List of BlogEntry.Category objects.
Throws:
BlogClientException - On error or if there is no primary entries collection.

getCollections

public List getCollections()
                    throws BlogClientException
Gets listing of entry and resource collections available in the blog, including the primary collections.

Specified by:
getCollections in interface Blog
Returns:
List of Blog.Collection objects.
Throws:
BlogClientException - On error fetching collections.

getCollection

public Blog.Collection getCollection(String token)
                              throws BlogClientException
Get collection by token.

Specified by:
getCollection in interface Blog
Parameters:
token - Token from a collection's getToken() method.
Returns:
Blog.Collection object.
Throws:
BlogClientException - On error fetching collection.


Copyright © 2007-2013 ROME Project. All Rights Reserved.