org.rometools.propono.blogclient.metaweblog
Class MetaWeblogBlog.MetaWeblogBlogCollection

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

public class MetaWeblogBlog.MetaWeblogBlogCollection
extends Object
implements Blog.Collection

MetaWeblog API impplementation of Blog.Collection


Constructor Summary
MetaWeblogBlog.MetaWeblogBlogCollection(Blog blog, String token, String title, String accept)
           
 
Method Summary
 boolean accepts(String ct)
          Determines if collection will accept a content-type.
 List getAccepts()
          Content-types accepted by collection.
 Blog getBlog()
          Get blog that contains this collection.
 List getCategories()
          Return categories allowed by colletion.
 Iterator getEntries()
          Get iterator over entries/resources in this collection.
 String getTitle()
          Title of collection.
 String getToken()
          Token that can be used to fetch collection.
 BlogEntry newEntry()
          Create but do not save new entry in collection.
 BlogResource newResource(String name, String contentType, byte[] bytes)
          Create but do not save new resource in collection.
 String saveEntry(BlogEntry entry)
          Save or update a BlogEntry in this collection by adding it to this collection and then calling it's entry.save() method.
 String saveResource(BlogResource res)
          Save or update resource in this collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaWeblogBlog.MetaWeblogBlogCollection

public MetaWeblogBlog.MetaWeblogBlogCollection(Blog blog,
                                               String token,
                                               String title,
                                               String accept)
Parameters:
token - Identifier for collection, unique within blog
title - Title of collection
accept - Content types accepted, either "entry" or "*"
Method Detail

getTitle

public String getTitle()
Title of collection.

Specified by:
getTitle in interface Blog.Collection
Returns:
Title of collecton.

getToken

public String getToken()
Token that can be used to fetch collection.

Specified by:
getToken in interface Blog.Collection
Returns:
Token that can be used to fetch collection.

getAccepts

public List getAccepts()
Content-types accepted by collection.

Specified by:
getAccepts in interface Blog.Collection
Returns:
Comma-separated list of content-types accepted.

newResource

public BlogResource newResource(String name,
                                String contentType,
                                byte[] bytes)
                         throws BlogClientException
Create but do not save new resource in collection. To save resource, call its save() method.

Specified by:
newResource in interface Blog.Collection
Parameters:
name - Name of new resource.
contentType - MIME content-type of new resource.
bytes - Data for new resource.
Returns:
New BlogResource object,
Throws:
BlogClientException - On error creating entry.

newEntry

public BlogEntry newEntry()
                   throws BlogClientException
Create but do not save new entry in collection. To save entry, call its save() method.

Specified by:
newEntry in interface Blog.Collection
Returns:
New BlogEntry object.
Throws:
BlogClientException - On error creating entry.

accepts

public boolean accepts(String ct)
Determines if collection will accept a content-type.

Specified by:
accepts in interface Blog.Collection
Parameters:
ct - Content-type to be considered.
Returns:
True of content type will be accepted, false otherwise.

getEntries

public Iterator getEntries()
                    throws BlogClientException
Get iterator over entries/resources in this collection.

Specified by:
getEntries in interface Blog.Collection
Returns:
List of BlogEntry objects, some may be BlogResources.
Throws:
BlogClientException - On error fetching entries/resources.

saveEntry

public String saveEntry(BlogEntry entry)
                 throws BlogClientException
Save or update a BlogEntry in this collection by adding it to this collection and then calling it's entry.save() method.

Specified by:
saveEntry in interface Blog.Collection
Parameters:
entry - BlogEntry to be saved.
Returns:
URI of entry.
Throws:
BlogClientException - On error saving entry.

saveResource

public String saveResource(BlogResource res)
                    throws BlogClientException
Save or update resource in this collection

Specified by:
saveResource in interface Blog.Collection
Parameters:
res - BlogResource to be saved.
Returns:
URI of resource.
Throws:
BlogClientException - On error saving resource.

getCategories

public List getCategories()
                   throws BlogClientException
Return categories allowed by colletion.

Specified by:
getCategories in interface Blog.Collection
Returns:
List of BlogEntry.Category objects for this collection.
Throws:
BlogClientException - On error fetching categories.

getBlog

public Blog getBlog()
Get blog that contains this collection.

Specified by:
getBlog in interface Blog.Collection
Returns:
Blog that contains this collection.


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