1 package net.sourceforge.blogentis.plugins;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import java.util.Iterator;
26
27 import net.sourceforge.blogentis.om.Blog;
28
29 import org.apache.turbine.services.TurbineServices;
30
31 /***
32 * @author abas
33 */
34 public class BlogPluginService {
35
36 public static final String PLUGIN_LIST = "plugin.list";
37
38 public static IPluginService getInstance() {
39 return (IPluginService)TurbineServices.getInstance()
40 .getService(IPluginService.SERVICE_NAME);
41 }
42
43 /***
44 * List the plugins in the order of their definition.
45 *
46 * @return an iterator that returns IPlugin
47 */
48 public static Iterator getPlugins() {
49 return getInstance().getPlugins();
50 }
51
52 /***
53 * Register a global extension point.
54 *
55 * @param point
56 * the global extension point to register.
57 */
58 public static void registerExtensionPoint(IExtensionPoint point) {
59 getInstance().registerExtensionPoint(point);
60 }
61
62 /***
63 * Remove a global extension point.
64 *
65 * @param point
66 * the extension point to remove.
67 */
68 public static void deregisterExtensionPoint(IExtensionPoint point) {
69 getInstance().deregisterExtensionPoint(point);
70 }
71
72 /***
73 * Register a blog-specific extension point.
74 *
75 * @param blog
76 * the blog that the extension point will apply.
77 * @param point
78 * the extension point that will be registered.
79 */
80 public static void registerExtensionPoint(Blog blog,
81 IBlogExtensionPoint point) {
82 getInstance().registerExtensionPoint(blog, point);
83 }
84
85 /***
86 * Remove a blog-specific extension point
87 *
88 * @param blog
89 * the blog that should contain the extension point.
90 * @param point
91 * the extension point to remove.
92 */
93 public static void deregisterExtensionPoint(Blog blog,
94 IBlogExtensionPoint point) {
95 getInstance().deregisterExtensionPoint(blog, point);
96 }
97
98 /***
99 * Locate a global extension point that extends/implements the specified
100 * class.
101 *
102 * @param name
103 * @return a global extension point instance that is castable to the
104 * specified class.
105 */
106 public static IExtensionPoint locateExtensionPoint(Class name) {
107 return getInstance().locateExtensionPoint(name);
108 }
109
110 /***
111 * Locate an extension point that extends/implements the specified class.
112 *
113 * @param blog
114 * the blog to which the extension point will belong.
115 * @param name
116 * @return the extension point instance that is castable to the specified
117 * class.
118 */
119 public static IBlogExtensionPoint locateExtensionPoint(Blog blog, Class name) {
120 if (blog == null)
121 return null;
122 return getInstance().locateExtensionPoint(blog, name);
123 }
124
125 /***
126 * Get the list of extension points supported by a blog.
127 *
128 * @param blog
129 * the blog whose extension points to list.
130 * @return an Iterator over the extension points.
131 */
132 public static Iterator getExtensionPoints(Blog blog) {
133 return getInstance().getExtensionPoints(blog);
134 }
135 }