001/* 002 Licensed to the Apache Software Foundation (ASF) under one 003 or more contributor license agreements. See the NOTICE file 004 distributed with this work for additional information 005 regarding copyright ownership. The ASF licenses this file 006 to you under the Apache License, Version 2.0 (the 007 "License"); you may not use this file except in compliance 008 with the License. You may obtain a copy of the License at 009 010 http://www.apache.org/licenses/LICENSE-2.0 011 012 Unless required by applicable law or agreed to in writing, 013 software distributed under the License is distributed on an 014 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 KIND, either express or implied. See the License for the 016 specific language governing permissions and limitations 017 under the License. 018*/ 019package org.apache.wiki.ui.admin.beans; 020 021import java.util.Collection; 022 023import javax.management.NotCompliantMBeanException; 024 025import org.apache.wiki.WikiEngine; 026import org.apache.wiki.plugin.DefaultPluginManager.WikiPluginInfo; 027import org.apache.wiki.util.XHTML; 028import org.apache.wiki.util.XhtmlUtil; 029import org.jdom2.Element; 030 031 032public class PluginBean extends ModuleBean< WikiPluginInfo > { 033 034 public PluginBean( WikiEngine engine ) throws NotCompliantMBeanException { 035 super( engine ); 036 } 037 038 /** 039 * {@inheritDoc} 040 */ 041 public String getTitle() { 042 return "Plugins"; 043 } 044 045 /** 046 * {@inheritDoc} 047 */ 048 public int getType() { 049 return CORE; 050 } 051 052 /** 053 * {@inheritDoc} 054 */ 055 @Override 056 protected Collection< WikiPluginInfo > modules() { 057 return m_engine.getPluginManager().modules(); 058 } 059 060 /** 061 * {@inheritDoc} 062 */ 063 @Override 064 protected Element heading() { 065 Element trHead = XhtmlUtil.element( XHTML.tr ); 066 trHead.addContent( XhtmlUtil.element( XHTML.th ).addContent( "Name" ) ) 067 .addContent( XhtmlUtil.element( XHTML.th ).addContent( "Alias" ) ) 068 .addContent( XhtmlUtil.element( XHTML.th ).addContent( "Author" ) ) 069 .addContent( XhtmlUtil.element( XHTML.th ).addContent( "Notes" ) ); 070 return trHead; 071 } 072 073 /** 074 * {@inheritDoc} 075 */ 076 @Override 077 protected Element rowBody( WikiPluginInfo plugin ) { 078 Element tr = XhtmlUtil.element( XHTML.tr ); 079 tr.addContent( XhtmlUtil.element( XHTML.td ).addContent( plugin.getName() ) ) 080 .addContent( XhtmlUtil.element( XHTML.td ).addContent( plugin.getAlias() ) ) 081 .addContent( XhtmlUtil.element( XHTML.td ).addContent( plugin.getAuthor() ) ) 082 .addContent( XhtmlUtil.element( XHTML.td ).addContent( validModuleVersion( plugin ) ) ); 083 return tr; 084 } 085 086}