01: package com.ecyrd.jspwiki.ui.admin.beans;
02:
03: import java.util.Collection;
04: import java.util.Iterator;
05:
06: import javax.management.NotCompliantMBeanException;
07:
08: import org.apache.ecs.xhtml.*;
09:
10: import com.ecyrd.jspwiki.Release;
11: import com.ecyrd.jspwiki.WikiContext;
12: import com.ecyrd.jspwiki.WikiEngine;
13: import com.ecyrd.jspwiki.plugin.PluginManager.WikiPluginInfo;
14: import com.ecyrd.jspwiki.ui.admin.SimpleAdminBean;
15:
16: public class PluginBean extends SimpleAdminBean {
17: private WikiEngine m_engine;
18:
19: public PluginBean(WikiEngine engine)
20: throws NotCompliantMBeanException {
21: m_engine = engine;
22: }
23:
24: public String[] getAttributeNames() {
25: return new String[0];
26: }
27:
28: public String[] getMethodNames() {
29: return new String[0];
30: }
31:
32: public String getTitle() {
33: return "Plugins";
34: }
35:
36: public int getType() {
37: return CORE;
38: }
39:
40: public String doGet(WikiContext context) {
41: Collection plugins = m_engine.getPluginManager().modules();
42:
43: div root = new div();
44:
45: root.addElement(new h4("Plugins"));
46:
47: table tb = new table().setBorder(1);
48: root.addElement(tb);
49:
50: tr head = new tr();
51: head.addElement(new th("Name"));
52: head.addElement(new th("Alias"));
53: head.addElement(new th("Author"));
54: head.addElement(new th("Notes"));
55:
56: tb.addElement(head);
57:
58: for (Iterator i = plugins.iterator(); i.hasNext();) {
59: tr row = new tr();
60: tb.addElement(row);
61:
62: WikiPluginInfo info = (WikiPluginInfo) i.next();
63:
64: row.addElement(new td(info.getName()));
65: row.addElement(new td(info.getAlias()));
66: row.addElement(new td(info.getAuthor()));
67:
68: String verWarning = "";
69: if (!(Release.isNewerOrEqual(info.getMinVersion()) && Release
70: .isOlderOrEqual(info.getMaxVersion()))) {
71: verWarning = "<span class='warning'>This module is not compatible with this version of JSPWiki.</span>";
72: }
73:
74: row.addElement(new td(verWarning));
75: }
76:
77: return root.toString();
78: }
79:
80: }
|