Welcome!

Search





Page: BlogClientLibrary


BlogClientLibrary#

Blog Client is a Java based client library for interacting with a blog server that supports either the Atom Protocol or the XML-RPC based blogging APIs (BloggerAPI, MetaWeblogAPI, MovableTypeAPI). Below is a diagram that shows the interfaces and classes that make up the Blog Client API.

http://www.rollerweblogger.org/wiki/attach/BlogClientLibrary/BlogClientAPI.png

Below are the declarations of the API it stands today.

~BlogClient#

This interface is the entry point for the Blog Client API, it represents a single-user session with a blog server. This interface allows a caller to get a list of all blogs available to a user and to get a ~BlogSite interface to interact with an individual blog.
public interface BlogClient {
    
    /** Returns array of user's blogids, TODO: metadata! */
    public abstract String[] getUserBlogs() throws Exception;
    
    /** Returns interface for interacting with a blog */
    public abstract BlogSite getBlogSite(String blogId);
}

~BlogSite#

This interface represents a single-user session with an individual blog in a blog server.
public interface BlogSite {
    
    /** Create new and empty entry */
    public BlogEntry createEntry();
    
    /** Get a single Entry by token */
    public BlogEntry getEntry(String token) throws Exception;
    
    /** Returns list of most recent entries as Entry objects */
    public List getRecentEntries(int maxEntries) throws Exception;
    
    /** Returns available categories as a  list of BlogEntry.Category objects. */
    public List getCategories() throws Exception;
    
    /** Create a new resource on the server and return it's URL */
    public String createResource(
            String name, String contentType, File file) throws Exception;
}

~BlogEntry#

Represents an individual blog entry (may want to replace this with a Rome item or entry interface?)
public interface BlogEntry {
    
    /** Entry ID */
    public String getId();

    /** Token can be used to fetch this entry again later */
    public String getToken();

    /** Save this entry as new entry or update existing entry in blog server */
    public void save(boolean publish) throws Exception;
    
    /** Delete this entry from blog server */
    public void delete() throws Exception;
    
    public String getTitle();
    public void setTitle(String title);
    
    public String getSummary();
    public void setSummary(String summary);
    
    public Content getContent();
    public void setContent(Content content);
    
    public Person getAuthor();
    public void setAuthor(Person author);
    
    /** List of Category objects */
    public List getCategories();
    public void setCategories(List categories);
    
    public Date getCreationDate();
    public void setCreationDate(Date date);   
    
    public Date getPublicationDate();
    public void setPublicationDate(Date date);   
    
    public Date getModificationDate();
    public void setModificationDate(Date date);
    
    public class Person {
        String name;
        String email;
        String url;
        public String getEmail() {
            return email;
        }
        public void setEmail(String email) {
            this.email = email;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getUrl() {
            return url;
        }
        public void setUrl(String url) {
            this.url = url;
        }
        public String toString() {
            return name;
        }
    }
    public class Content {
        String mode;
        String type;
        String value;
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
        public String getType() {
            return type;
        }
        public void setType(String type) {
            this.type = type;
        }
        /** Must be "xml" or "escaped" or "base64" */
        public String getMode() {
            return mode;
        }
        public void setMode(String mode) {
            this.mode = mode;
        }
    }
    public class Category {
        public boolean equals(Object obj) {
            Category other = (Category)obj;
            if (obj == null) return false;
            if (getName() != null && other.getName() != null 
                    && getName().equals(other.getName())) return true;
            if (getId() != null && other.getId() != null 
                    && getId().equals(other.getId())) return true;
            return false;
        }
        String id;
        String name;
        String url;
        public String getId() {
            return id;
        }
        public void setId(String id) {
            this.id = id;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getUrl() {
            return url;
        }
        public void setUrl(String url) {
            this.url = url;
        }
        public String toString() {
            return name;
        }
    }
}

Add new attachment

In order to upload a new attachment to this page, please use the following box to find the file, then click on “Upload”.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
png
BlogClientAPI.png 42.7 kB 3 17-Jan-2005 09:01 DaveJohnson
« This page (revision-1) was last changed on 27-Dec-2005 09:08 by UnknownAuthor