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 */
019 package org.apache.wiki.ui.admin.beans;
020
021 import javax.management.NotCompliantMBeanException;
022
023 import org.apache.wiki.Release;
024 import org.apache.wiki.WikiEngine;
025 import org.apache.wiki.ui.admin.SimpleAdminBean;
026
027 /**
028 * An AdminBean which manages the JSPWiki core operations.
029 *
030 */
031 public class CoreBean
032 extends SimpleAdminBean
033 {
034 private static final String[] ATTRIBUTES = { "pages", "version" };
035 private static final String[] METHODS = { };
036 private WikiEngine m_engine;
037
038 public CoreBean( WikiEngine engine ) throws NotCompliantMBeanException
039 {
040 m_engine = engine;
041 }
042
043 /**
044 * Return the page count in the Wiki.
045 *
046 * @return the page content
047 */
048 public int getPages()
049 {
050 return m_engine.getPageCount();
051 }
052
053 public String getPagesDescription()
054 {
055 return "The total number of pages in this wiki";
056 }
057
058 public String getVersion()
059 {
060 return Release.VERSTR;
061 }
062
063 public String getVersionDescription()
064 {
065 return "The JSPWiki engine version";
066 }
067
068 public String getTitle()
069 {
070 return "Core bean";
071 }
072
073 public int getType()
074 {
075 return CORE;
076 }
077
078
079 public String getId()
080 {
081 return "corebean";
082 }
083
084 public String[] getAttributeNames()
085 {
086 return ATTRIBUTES;
087 }
088
089 public String[] getMethodNames()
090 {
091 return METHODS;
092 }
093
094 }