KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > blojsom > extension > xmlrpc > handler > BloggerAPIHandler


1 /**
2  * Copyright (c) 2003-2006, David A. Czarnecki
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and the
9  * following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
11  * following disclaimer in the documentation and/or other materials provided with the distribution.
12  * Neither the name of "David A. Czarnecki" and "blojsom" nor the names of its contributors may be used to
13  * endorse or promote products derived from this software without specific prior written permission.
14  * Products derived from this software may not be called "blojsom", nor may "blojsom" appear in their name,
15  * without prior written permission of David A. Czarnecki.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
18  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
19  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
21  * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  */

31 package org.blojsom.extension.xmlrpc.handler;
32
33 import org.apache.commons.logging.Log;
34 import org.apache.commons.logging.LogFactory;
35 import org.apache.xmlrpc.XmlRpcException;
36 import org.blojsom.BlojsomException;
37 import org.blojsom.authorization.AuthorizationException;
38 import org.blojsom.blog.Category;
39 import org.blojsom.blog.Entry;
40 import org.blojsom.fetcher.FetcherException;
41 import org.blojsom.plugin.admin.event.EntryAddedEvent;
42 import org.blojsom.plugin.admin.event.EntryDeletedEvent;
43 import org.blojsom.plugin.admin.event.EntryUpdatedEvent;
44 import org.blojsom.util.BlojsomConstants;
45 import org.blojsom.util.BlojsomUtils;
46 import org.blojsom.util.BlojsomMetaDataConstants;
47
48 import java.util.*;
49
50 /**
51  * Blogger API handler
52  *
53  * @author David Czarnecki
54  * @since blojsom 3.0
55  * @version $Id: BloggerAPIHandler.java,v 1.4 2006/09/26 02:55:20 czarneckid Exp $
56  */

57 public class BloggerAPIHandler extends APIHandler {
58
59     private Log _logger = LogFactory.getLog(BloggerAPIHandler.class);
60
61     /**
62      * Blogger API "url" key
63      */

64     private static final String JavaDoc MEMBER_URL = "url";
65
66     /**
67      * Blogger API "blogid" key
68      */

69     private static final String JavaDoc MEMBER_BLOGID = "blogid";
70
71     /**
72      * Blogger APU "postid" key
73      */

74     private static final String JavaDoc MEMBER_POSTID = "postid";
75
76     /**
77      * Blogger API "blogName" key
78      */

79     private static final String JavaDoc MEMBER_BLOGNAME = "blogName";
80
81     /**
82      * Blogger API "title" key
83      */

84     private static final String JavaDoc MEMBER_TITLE = "title";
85
86     /**
87      * Blogger API "content" key
88      */

89     private static final String JavaDoc MEMBER_CONTENT = "content";
90
91     /**
92      * Blogger API "dateCreated" key
93      */

94     private static final String JavaDoc MEMBER_DATECREATED = "dateCreated";
95
96     /**
97      * Blogger API "authorName" key
98      */

99     private static final String JavaDoc MEMBER_AUTHORNAME = "authorName";
100
101     /**
102      * Blogger API "authorEmail" key
103      */

104     private static final String JavaDoc MEMBER_AUTHOREMAIL = "authorEmail";
105
106     /**
107      * Blogger API "nickname" key
108      */

109     private static final String JavaDoc MEMBER_NICKNAME = "nickname";
110
111     /**
112      * Blogger API "userid" key
113      */

114     private static final String JavaDoc MEMBER_USERID = "userid";
115
116     /**
117      * Blogger API "email" key
118      */

119     private static final String JavaDoc MEMBER_EMAIL = "email";
120
121     /**
122      * Blogger API "firstname" key
123      */

124     private static final String JavaDoc MEMBER_FIRSTNAME = "firstname";
125
126     /**
127      * Blogger API "lastname" key
128      */

129     private static final String JavaDoc MEMBER_LASTNAME = "lastname";
130
131     private static final String JavaDoc TITLE_TAG_START = "<title>";
132     private static final String JavaDoc TITLE_TAG_END = "</title>";
133
134     private static final String JavaDoc API_PREFIX = "blogger";
135
136     private static final String JavaDoc BLOGGER_API_PERMISSION = "post_via_blogger_api_permission";
137
138     /**
139      * Create a new instance of the Blogger API handler
140      */

141     public BloggerAPIHandler() {
142     }
143
144     /**
145      * Retrieve the API handler name
146      *
147      * @return API handler name "blogger"
148      */

149     public String JavaDoc getName() {
150         return API_PREFIX;
151     }
152
153     /**
154      * Authenticates a user and returns basic user info (name, email, userid, etc.).
155      *
156      * @param appkey Unique identifier/passcode of the application sending the post
157      * @param userid Login for a Blogger user who has permission to post to the blog
158      * @param password Password for said username
159      * @return
160      * @throws org.apache.xmlrpc.XmlRpcException
161      *
162      */

163     public Object JavaDoc getUserInfo(String JavaDoc appkey, String JavaDoc userid, String JavaDoc password) throws Exception JavaDoc {
164         _logger.debug("getUserInfo() Called =====[ SUPPORTED ]=======");
165         _logger.debug(" Appkey: " + appkey);
166         _logger.debug(" UserId: " + userid);
167         _logger.debug(" Password: *********");
168
169         try {
170             _authorizationProvider.authorize(_blog, null, userid, password);
171             checkXMLRPCPermission(userid, BLOGGER_API_PERMISSION);
172
173             Hashtable userinfo = new Hashtable();
174             userinfo.put(MEMBER_EMAIL, _blog.getBlogOwnerEmail());
175             userinfo.put(MEMBER_NICKNAME, userid);
176             userinfo.put(MEMBER_USERID, "1");
177             userinfo.put(MEMBER_URL, _blog.getBlogURL());
178
179             String JavaDoc _ownerName = _blog.getBlogOwner();
180             int _split = _ownerName.indexOf(" ");
181             if (_split > 0) {
182                 userinfo.put(MEMBER_FIRSTNAME, _ownerName.substring(0, _split));
183                 userinfo.put(MEMBER_LASTNAME, _ownerName.substring(_split + 1));
184             } else {
185                 userinfo.put(MEMBER_FIRSTNAME, "blojsom");
186                 userinfo.put(MEMBER_LASTNAME, _ownerName);
187             }
188
189             return userinfo;
190
191         } catch (BlojsomException e) {
192             throw new XmlRpcException(AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
193         }
194     }
195
196     /**
197      * Returns information on all the blogs a given user is a member of
198      *
199      * @param appkey Unique identifier/passcode of the application sending the post
200      * @param userid Login for a Blogger user who has permission to post to the blog
201      * @param password Password for said username
202      * @return Blog category list
203      * @throws XmlRpcException If there are no categories or the user was not authenticated correctly
204      */

205     public Object JavaDoc getUsersBlogs(String JavaDoc appkey, String JavaDoc userid, String JavaDoc password) throws Exception JavaDoc {
206         _logger.debug("getUsersBlogs() Called ===[ SUPPORTED ]=======");
207         _logger.debug(" Appkey: " + appkey);
208         _logger.debug(" UserId: " + userid);
209         _logger.debug(" Password: *********");
210
211         try {
212             _authorizationProvider.authorize(_blog, null, userid, password);
213             checkXMLRPCPermission(userid, BLOGGER_API_PERMISSION);
214
215             Vector result = new Vector();
216
217             Category[] categories = _fetcher.loadAllCategories(_blog);
218
219             if (categories != null) {
220                 for (int x = 0; x < categories.length; x++) {
221                     Hashtable _bloglist = new Hashtable(3);
222                     Category category = categories[x];
223
224                     String JavaDoc description;
225                     if (!BlojsomUtils.checkNullOrBlank(category.getDescription())) {
226                         description = category.getDescription();
227                     } else {
228                         description = category.getName();
229                     }
230
231                     _bloglist.put(MEMBER_URL, _blog.getBlogURL() + category.getName());
232                     _bloglist.put(MEMBER_BLOGID, Integer.toString(category.getId().intValue()));
233                     _bloglist.put(MEMBER_BLOGNAME, description);
234
235                     result.add(_bloglist);
236                 }
237             } else {
238                 throw new XmlRpcException(NOBLOGS_EXCEPTION, NOBLOGS_EXCEPTION_MSG);
239             }
240
241             return result;
242         } catch (BlojsomException e) {
243             throw new XmlRpcException(AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
244         }
245     }
246
247     /**
248      * Find a title in a content string delimited by &lt;title&gt;...&lt;/title&gt;
249      *
250      * @param content Content
251      * @return Title found in content or <code>null</code> if the title was not present in &lt;title&gt; tags
252      */

253     private String JavaDoc findTitleInContent(String JavaDoc content) {
254         String JavaDoc titleFromContent = null;
255         int titleTagStartIndex = content.indexOf(TITLE_TAG_START);
256
257         if (titleTagStartIndex != -1) {
258             int titleTagEndIndex = content.indexOf(TITLE_TAG_END);
259
260             if (titleTagEndIndex != -1 && (titleTagEndIndex > titleTagStartIndex)) {
261                 titleFromContent = content.substring(titleTagStartIndex + TITLE_TAG_START.length(), titleTagEndIndex);
262             }
263         }
264
265         return titleFromContent;
266     }
267
268     /**
269      * Makes a new post to a designated blog. Optionally, will publish the blog after making the post
270      *
271      * @param appkey Unique identifier/passcode of the application sending the post
272      * @param blogid Unique identifier of the blog the post will be added to
273      * @param userid Login for a Blogger user who has permission to post to the blog
274      * @param password Password for said username
275      * @param content Contents of the post
276      * @param publish If true, the blog will be published immediately after the post is made
277      * @return Post ID of the added entry
278      * @throws XmlRpcException If the user was not authenticated correctly or if there was an I/O exception
279      */

280     public String JavaDoc newPost(String JavaDoc appkey, String JavaDoc blogid, String JavaDoc userid, String JavaDoc password, String JavaDoc content, boolean publish) throws Exception JavaDoc {
281         _logger.debug("newPost() Called ===========[ SUPPORTED ]=====");
282         _logger.debug(" Appkey: " + appkey);
283         _logger.debug(" BlogId: " + blogid);
284         _logger.debug(" UserId: " + userid);
285         _logger.debug(" Password: *********");
286         _logger.debug(" Publish: " + publish);
287         _logger.debug(" Content:\n " + content);
288
289         try {
290             _authorizationProvider.authorize(_blog, null, userid, password);
291             checkXMLRPCPermission(userid, BLOGGER_API_PERMISSION);
292
293             String JavaDoc result;
294             String JavaDoc title = findTitleInContent(content);
295
296             Integer JavaDoc blogID;
297             try {
298                 blogID = Integer.valueOf(blogid);
299             } catch (NumberFormatException JavaDoc e) {
300                 throw new XmlRpcException(UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG);
301             }
302
303             try {
304                 Category category = _fetcher.loadCategory(_blog, blogID);
305                 Entry entry = _fetcher.newEntry();
306
307                 if (title != null) {
308                     content = BlojsomUtils.replace(content, TITLE_TAG_START + title + TITLE_TAG_END, "");
309                     entry.setTitle(title);
310                 }
311
312                 entry.setBlogId(_blog.getId());
313                 entry.setBlogCategoryId(category.getId());
314                 entry.setDate(new Date());
315                 entry.setModifiedDate(entry.getDate());
316                 entry.setTitle(title);
317                 entry.setDescription(content);
318                 entry.setAuthor(userid);
319
320                 if (publish) {
321                     entry.setStatus(BlojsomMetaDataConstants.PUBLISHED_STATUS);
322                 } else {
323                     entry.setStatus(BlojsomMetaDataConstants.DRAFT_STATUS);
324                 }
325
326                 _fetcher.saveEntry(_blog, entry);
327
328                 result = Integer.toString(entry.getId().intValue());
329
330                 // Send out an add blog entry event
331
_eventBroadcaster.broadcastEvent(new EntryAddedEvent(this, new Date(), entry, _blog));
332             } catch (FetcherException e) {
333                 throw new XmlRpcException(UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG);
334             }
335
336             return result;
337         } catch (BlojsomException e) {
338             throw new XmlRpcException(AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
339         }
340     }
341
342     /**
343      * Edits a given post. Optionally, will publish the blog after making the edit
344      *
345      * @param appkey Unique identifier/passcode of the application sending the post
346      * @param postid Unique identifier of the post to be changed
347      * @param userid Login for a Blogger user who has permission to post to the blog
348      * @param password Password for said username
349      * @param content Contents of the post
350      * @param publish If true, the blog will be published immediately after the post is made
351      * @return <code>true</code> if the entry was edited, <code>false</code> otherwise
352      * @throws XmlRpcException If the user was not authenticated correctly, if there was an I/O exception,
353      * or if the entry permalink ID is invalid
354      */

355     public boolean editPost(String JavaDoc appkey, String JavaDoc postid, String JavaDoc userid, String JavaDoc password, String JavaDoc content, boolean publish) throws Exception JavaDoc {
356         _logger.debug("editPost() Called ========[ SUPPORTED ]=====");
357         _logger.debug(" Appkey: " + appkey);
358         _logger.debug(" PostId: " + postid);
359         _logger.debug(" UserId: " + userid);
360         _logger.debug(" Password: *********");
361         _logger.debug(" Publish: " + publish);
362         _logger.debug(" Content:\n " + content);
363
364         try {
365             _authorizationProvider.authorize(_blog, null, userid, password);
366             checkXMLRPCPermission(userid, BLOGGER_API_PERMISSION);
367
368             boolean result;
369
370             Integer JavaDoc postID;
371             try {
372                 postID = Integer.valueOf(postid);
373             } catch (NumberFormatException JavaDoc e) {
374                 throw new XmlRpcException(INVALID_POSTID, INVALID_POSTID_MSG);
375             }
376
377             try {
378                 Entry entryToEdit = _fetcher.loadEntry(_blog, postID);
379
380                 String JavaDoc title = findTitleInContent(content);
381                 if (title != null) {
382                     content = BlojsomUtils.replace(content, TITLE_TAG_START + title + TITLE_TAG_END, "");
383                     entryToEdit.setTitle(title);
384                 } else {
385                     entryToEdit.setTitle("");
386                 }
387                 entryToEdit.setDescription(content);
388                 entryToEdit.setModifiedDate(new Date());
389
390                 if (publish) {
391                     entryToEdit.setStatus(BlojsomMetaDataConstants.PUBLISHED_STATUS);
392                 } else {
393                     entryToEdit.setStatus(BlojsomMetaDataConstants.DRAFT_STATUS);
394                 }
395
396                 _fetcher.saveEntry(_blog, entryToEdit);
397
398                 result = true;
399
400                 _eventBroadcaster.broadcastEvent(new EntryUpdatedEvent(this, new Date(), entryToEdit, _blog));
401             } catch (FetcherException e) {
402                 throw new XmlRpcException(UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG);
403             }
404
405             return result;
406         } catch (AuthorizationException e) {
407             throw new XmlRpcException(AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
408         }
409     }
410
411     /**
412      * Get a particular post for a blojsom category
413      *
414      * @param appkey Unique identifier/passcode of the application sending the post
415      * @param postid Unique identifier of the blog post
416      * @param userid Login for a Blogger user who has permission to post to the blog
417      * @param password Password for said username
418      * @return Post to the blog
419      * @throws XmlRpcException If the user was not authenticated correctly
420      */

421     public Object JavaDoc getPost(String JavaDoc appkey, String JavaDoc postid, String JavaDoc userid, String JavaDoc password) throws Exception JavaDoc {
422         _logger.debug("getPost() Called ===========[ SUPPORTED ]=====");
423         _logger.debug(" Appkey: " + appkey);
424         _logger.debug(" PostId: " + postid);
425         _logger.debug(" UserId: " + userid);
426         _logger.debug(" Password: *********");
427
428         try {
429             _authorizationProvider.authorize(_blog, null, userid, password);
430             checkXMLRPCPermission(userid, BLOGGER_API_PERMISSION);
431
432             Integer JavaDoc postID;
433             try {
434                 postID = Integer.valueOf(postid);
435             } catch (NumberFormatException JavaDoc e) {
436                 throw new XmlRpcException(INVALID_POSTID, INVALID_POSTID_MSG);
437             }
438
439             try {
440                 Entry entry = _fetcher.loadEntry(_blog, postID);
441
442                 Hashtable entrystruct = new Hashtable();
443                 entrystruct.put(MEMBER_POSTID, Integer.toString(entry.getId().intValue()));
444                 entrystruct.put(MEMBER_BLOGID, Integer.toString(entry.getBlogCategory().getId().intValue()));
445                 entrystruct.put(MEMBER_TITLE, entry.getTitle());
446                 entrystruct.put(MEMBER_URL, _blog.getBlogURL() + entry.getCategory() + entry.getPostSlug());
447                 entrystruct.put(MEMBER_CONTENT, entry.getTitle() + BlojsomConstants.LINE_SEPARATOR + entry.getDescription());
448                 entrystruct.put(MEMBER_DATECREATED, entry.getDate());
449                 entrystruct.put(MEMBER_AUTHORNAME, _blog.getBlogOwner());
450                 entrystruct.put(MEMBER_AUTHOREMAIL, _blog.getBlogOwnerEmail());
451
452                 return entrystruct;
453             } catch (FetcherException e) {
454                 throw new XmlRpcException(INVALID_POSTID, INVALID_POSTID_MSG);
455             }
456         } catch (AuthorizationException e) {
457             throw new XmlRpcException(AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
458         }
459     }
460
461     /**
462      * Delete a Post
463      *
464      * @param appkey Unique identifier/passcode of the application sending the post
465      * @param postid Unique identifier of the post to be changed
466      * @param userid Login for a Blogger user who has permission to post to the blog
467      * @param password Password for said username
468      * @param publish Ignored
469      * @return <code>true</code> if the entry was delete, <code>false</code> otherwise
470      * @throws XmlRpcException
471      */

472     public boolean deletePost(String JavaDoc appkey, String JavaDoc postid, String JavaDoc userid, String JavaDoc password, boolean publish) throws Exception JavaDoc {
473         _logger.debug("deletePost() Called =====[ SUPPORTED ]=====");
474         _logger.debug(" Appkey: " + appkey);
475         _logger.debug(" PostId: " + postid);
476         _logger.debug(" UserId: " + userid);
477         _logger.debug(" Password: *********");
478
479         boolean result;
480
481         try {
482             _authorizationProvider.authorize(_blog, null, userid, password);
483             checkXMLRPCPermission(userid, BLOGGER_API_PERMISSION);
484
485             Integer JavaDoc postID;
486             try {
487                 postID = Integer.valueOf(postid);
488             } catch (NumberFormatException JavaDoc e) {
489                 throw new XmlRpcException(INVALID_POSTID, INVALID_POSTID_MSG);
490             }
491
492             try {
493                 Entry entryToDelete = _fetcher.loadEntry(_blog, postID);
494                 _fetcher.deleteEntry(_blog, entryToDelete);
495
496                 result = true;
497                 _eventBroadcaster.broadcastEvent(new EntryDeletedEvent(this, new Date(), entryToDelete, _blog));
498             } catch (FetcherException e) {
499                 throw new XmlRpcException(UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG);
500             }
501         } catch (AuthorizationException e) {
502             throw new XmlRpcException(AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
503         }
504
505         return result;
506     }
507
508     /**
509      * Get a list of recent posts for a blojsom category
510      *
511      * @param appkey Unique identifier/passcode of the application sending the post
512      * @param blogid Unique identifier of the blog the post will be added to
513      * @param userid Login for a Blogger user who has permission to post to the blog
514      * @param password Password for said username
515      * @param numposts Number of Posts to Retrieve
516      * @return Recent posts to the blog
517      * @throws XmlRpcException If the user was not authenticated correctly
518      */

519     public Object JavaDoc getRecentPosts(String JavaDoc appkey, String JavaDoc blogid, String JavaDoc userid, String JavaDoc password, int numposts) throws Exception JavaDoc {
520         _logger.debug("getRecentPosts() Called ===========[ SUPPORTED ]=====");
521         _logger.debug(" Appkey: " + appkey);
522         _logger.debug(" BlogId: " + blogid);
523         _logger.debug(" UserId: " + userid);
524         _logger.debug(" Password: *********");
525         _logger.debug(" Numposts: " + numposts);
526
527         Vector recentPosts = new Vector();
528
529         try {
530             _authorizationProvider.authorize(_blog, null, userid, password);
531             checkXMLRPCPermission(userid, BLOGGER_API_PERMISSION);
532
533             Entry[] entries;
534             try {
535                 entries = _fetcher.loadEntriesForCategory(_blog, Integer.valueOf(blogid), new Integer JavaDoc(numposts));
536             } catch (FetcherException e) {
537                 throw new XmlRpcException(UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG);
538             } catch (NumberFormatException JavaDoc e) {
539                 throw new XmlRpcException(UNKNOWN_EXCEPTION, UNKNOWN_EXCEPTION_MSG);
540             }
541
542             if (entries != null && entries.length > 0) {
543                 for (int x = 0; x < entries.length; x++) {
544                     Entry entry = entries[x];
545                     Hashtable entrystruct = new Hashtable();
546                     entrystruct.put(MEMBER_POSTID, Integer.toString(entry.getId().intValue()));
547                     entrystruct.put(MEMBER_BLOGID, Integer.toString(entry.getBlogCategory().getId().intValue()));
548                     entrystruct.put(MEMBER_TITLE, entry.getTitle());
549                     entrystruct.put(MEMBER_URL, _blog.getBlogURL() + entry.getCategory() + entry.getPostSlug());
550                     entrystruct.put(MEMBER_CONTENT, entry.getTitle() + BlojsomConstants.LINE_SEPARATOR + entry.getDescription());
551                     entrystruct.put(MEMBER_DATECREATED, entry.getDate());
552                     entrystruct.put(MEMBER_AUTHORNAME, _blog.getBlogOwner());
553                     entrystruct.put(MEMBER_AUTHOREMAIL, _blog.getBlogOwnerEmail());
554                     recentPosts.add(entrystruct);
555                 }
556             }
557
558             return recentPosts;
559         } catch (AuthorizationException e) {
560             throw new XmlRpcException(AUTHORIZATION_EXCEPTION, AUTHORIZATION_EXCEPTION_MSG);
561         }
562     }
563
564     /**
565      * Edits the main or archive index template of a given blog (NOT IMPLEMENTED)
566      *
567      * @param appkey Unique identifier/passcode of the application sending the post
568      * @param blogid Unique identifier of the blog the post will be added to
569      * @param userid Login for a Blogger user who has permission to post to the blog
570      * @param password Password for said username
571      * @param template The text for the new template (usually mostly HTML). Must contain opening and closing <Blogger> tags, since they're needed to publish
572      * @param templateType Determines which of the blog's templates will be returned. Currently, either "main" or "archiveIndex"
573      * @return
574      * @throws XmlRpcException
575      */

576     public boolean setTemplate(String JavaDoc appkey, String JavaDoc blogid, String JavaDoc userid, String JavaDoc password, String JavaDoc template, String JavaDoc templateType) throws Exception JavaDoc {
577         _logger.debug("setTemplate() Called =====[ UNSUPPORTED ]=====");
578         _logger.debug(" Appkey: " + appkey);
579         _logger.debug(" BlogId: " + blogid);
580         _logger.debug(" UserId: " + userid);
581         _logger.debug(" Password: *********");
582         _logger.debug(" Template: " + template);
583         _logger.debug(" Type: " + templateType);
584
585         throw new XmlRpcException(UNSUPPORTED_EXCEPTION, UNSUPPORTED_EXCEPTION_MSG);
586     }
587
588     /**
589      * Returns the main or archive index template of a given blog (NOT IMPLEMENTED)
590      *
591      * @param appkey Unique identifier/passcode of the application sending the post
592      * @param blogid Unique identifier of the blog the post will be added to
593      * @param userid Login for a Blogger user who has permission to post to the blog
594      * @param password Password for said username
595      * @param templateType Determines which of the blog's templates will be returned. Currently, either "main" or "archiveIndex"
596      * @return
597      * @throws XmlRpcException
598      */

599     public String JavaDoc getTemplate(String JavaDoc appkey, String JavaDoc blogid, String JavaDoc userid, String JavaDoc password, String JavaDoc templateType) throws Exception JavaDoc {
600         _logger.debug("getTemplate() Called =====[ UNSUPPORTED ]=====");
601         _logger.debug(" Appkey: " + appkey);
602         _logger.debug(" BlogId: " + blogid);
603         _logger.debug(" UserId: " + userid);
604         _logger.debug(" Password: *********");
605         _logger.debug(" Type: " + templateType);
606
607         throw new XmlRpcException(UNSUPPORTED_EXCEPTION, UNSUPPORTED_EXCEPTION_MSG);
608     }
609 }
610
Popular Tags