KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > presentation > velocity > PagePlugin


1 /*
2  * Created on May 26, 2003
3  */

4 package org.roller.presentation.velocity;
5
6 import org.apache.velocity.context.Context;
7 import org.roller.RollerException;
8 import org.roller.pojos.WeblogEntryData;
9 import org.roller.presentation.RollerRequest;
10
11 /**
12  * Interface for a Roller WeblogEntry Plugin. Implementors of this
13  * class are expected to operate on the text field of a WeblogEntryData
14  * object. Existing implementations autogenerate links from Bookmarks (BookmarkPlugin),
15  * obfuscate email addresses (EmailObfuscator), truncate an Entry at 250
16  * characters and add a Read More... link (ReadMorePlugin), and transform
17  * 'simple markup' according to several schemes (JSPWiki, Radeox, Textile).
18  * See the "contrib" directory for these implementations.
19  *
20  * @author David M Johnson
21  */

22 public interface PagePlugin
23 {
24     public String JavaDoc name = "PagePlugin";
25     
26     /**
27      * Plugins can this as an opportunity to add any required objects
28      * to the RollerRequest and the VelocityContext, or to initialize
29      * any internal values reachable from RollerRequest.
30      *
31      * @param rreq Plugins may need to access RollerRequest.
32      * @param ctx Plugins may place objects into the Velocity Context.
33      */

34     public void init(RollerRequest rreq, Context ctx) throws RollerException;
35
36     /**
37      * Apply plugin to content of specified WeblogEntry. The WeblogEntryData
38      * is actually a copy of the real thing, so that changes made via
39      * entry.setText() are not persisted. Notice this; no changes made
40      * to the entry will be persisted.
41      * Some Plugins are only suited to rendering during Page display
42      * (not when generating RSS or Trackback content or in the
43      * Entry Preview) - ReadMorePlugin is an example of such a case.
44      * If the skipFlag is set to 'true' it merely returns the
45      * unadorned contents of entry.getText().
46      *
47      * @param entry WeblogEntry to which plugin should be applied.
48      * @param skipFlag Should processing be skipped.
49      * @return Results of applying plugin to entry.
50      */

51     public String JavaDoc render(WeblogEntryData entry, boolean skipFlag);
52     
53     /**
54      * Apply plugin to content of specified String. Some plugins
55      * may require interaction with an Entry to do its job (such
56      * as the BookmarkPlugin) and will simply return the String
57      * that was passed in.
58      *
59      * @param str String to which plugin should be applied.
60      * @return Results of applying plugin to string.
61      */

62     public String JavaDoc render(String JavaDoc str);
63     
64     /**
65      * Must implement toString(), returning the human-friendly
66      * name of this Plugin. This is what users will see.
67      * @return The human-friendly name of this Plugin.
68      */

69     public String JavaDoc toString();
70     
71     /**
72      * Returns the human-friendly name of this Plugin.
73      * This is what users will see.
74      * @return The human-friendly name of this Plugin.
75      */

76     public String JavaDoc getName();
77     
78     /**
79      * Briefly describes the function of the Plugin. May
80      * contain HTML.
81      * @return A brief description of the Plugin.
82      */

83     public String JavaDoc getDescription();
84 }
85
Popular Tags