Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package com.sun.syndication.propono.blogclient

Client library for interacting with blog servers

See:
Description

Interface Summary
Blog | Represents a blog, which has collections of entries and resources.
Blog.Collection | Represents an entry or resource collection on a blog server.
BlogConnection | A BlogConnection is a single-user connection to a blog server where the user has access to multiple blogs, which are each represented by a Blog interface.
BlogEntry | Represents a single blog entry.
BlogResource | Represents a file that has been uploaded to a blog.

Class Summary
BaseBlogEntry | Base implementation of a blog entry.
BlogConnectionFactory | Entry point to the Blogapps blog client library.
BlogEntry.Category | Represents a weblog category
BlogEntry.Content | Represents blog entry content
BlogEntry.Person | Represents a blog author or contributor

Exception Summary
BlogClientException | Represents a Blog Client exception, the library throws these instead of implementation specific exceptions.

## Package com.sun.syndication.propono.blogclient Description

Client library for interacting with blog servers

The BlogClient package defines generic interface that can be used to create, retrieve, update and delete blog entries and blog resources from a blog server that supports either the MetaWeblog API or the Atom protocol.

The diagram below shows the interfaces in the blog client package.

Now let's take a look at an example that shows how to post a blog entry via Atom protocol and the Blog Client library.

    import com.sun.syndication.propono.blogclient.*;

    // class and method declaration omitted

    String endpointURL = // URL of your blog server
    String username =    // your username on the blog server
    String password =    // your password
    String title =       // title of the new blog entry
    String content =     // content of the new blog entry

    BlogConnection con =                                      #1
       BlogConnectionFactory.getBlogConnection(
          "atom", endpointURL, username, password);
    Blog blog = (Blog)con.getBlogs().get(0);                  #2

    BlogEntry entry = blog.newEntry();                        #3
    entry.setTitle(title);                                    #4
    entry.setContent(new BlogEntry.Content(content));         #5
    entry.save();                                             #6

Let's review that code. First we get a connection from the factory by specifying Atom protocol, our blog server's endpoint URL and login credentials (#1). From the connection, we get the first blog that's available (#2). Next we create a new entry in the blog's primary collection (#3), set its title (#4), set it's content (#5) and post it to the blog server by calling its save() method (#5).

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES