001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    package org.apache.geronimo.management.stats;
019    
020    import javax.management.j2ee.statistics.CountStatistic;
021    
022    /**
023     * EJB module statistics implementation
024     */
025    public class EJBModuleStatsImpl extends StatsImpl implements EJBModuleStats {
026        private CountStatisticImpl entityBeanCount;
027        private CountStatisticImpl statelessSessionBeanCount;
028        private CountStatisticImpl statefulSessionBeanCount;
029        private CountStatisticImpl messageDrivenBeanCount;
030        private CountStatisticImpl totalBeanCount;
031    
032        /**
033         * Default constructor which constructs the different EJB type statistic
034         */
035        public EJBModuleStatsImpl() {
036            entityBeanCount = new CountStatisticImpl("Entity Bean Count",
037                    StatisticImpl.UNIT_COUNT,
038                    "The number of entity beans defined in this EJB Module");
039            statelessSessionBeanCount = new CountStatisticImpl(
040                    "Stateless Session Bean Count", StatisticImpl.UNIT_COUNT,
041                    "The number of stateless session beans defined in this EJB Module");
042            statefulSessionBeanCount = new CountStatisticImpl(
043                    "Stateful Session Bean Count", StatisticImpl.UNIT_COUNT,
044                    "The number of stateful session beans defined in this EJB Module");
045            messageDrivenBeanCount = new CountStatisticImpl(
046                    "Message Driven Bean Count", StatisticImpl.UNIT_COUNT,
047                    "The number of message driven beans defined in this EJB Module");
048            totalBeanCount = new CountStatisticImpl("Total Bean Count",
049                    StatisticImpl.UNIT_COUNT,
050                    "The total number of beans defined in this EJB Module");
051    
052            addStat("EntityBeanCount", entityBeanCount);
053            addStat("StatelessSessionBeanCount", statelessSessionBeanCount);
054            addStat("StatefulSessionBeanCount", statefulSessionBeanCount);
055            addStat("MessageDrivenBeanCount", messageDrivenBeanCount);
056            addStat("TotalBeanCount", totalBeanCount);
057        }
058    
059        /**
060         * Get the entity bean count
061         */
062        public CountStatistic getEntityBeanCount() {
063            return entityBeanCount;
064        }
065    
066        /**
067         * Get the stateless session bean count
068         */
069        public CountStatistic getStatelessSessionBeanCount() {
070            return statelessSessionBeanCount;
071        }
072    
073        /**
074         * Get the statefull session bean count
075         */
076        public CountStatistic getStatefulSessionBeanCount() {
077            return statefulSessionBeanCount;
078        }
079    
080        /**
081         * Get the message driven bean count
082         */
083        public CountStatistic getMessageDrivenBeanCount() {
084            return messageDrivenBeanCount;
085        }
086    
087        /**
088         * Get the total bean count
089         */
090        public CountStatistic getTotalBeanCount() {
091            return totalBeanCount;
092        }
093    
094        /**
095         * Get the entity bean count
096         */
097        public CountStatisticImpl getEntityBeanCountImpl() {
098            return entityBeanCount;
099        }
100    
101        /**
102         * Get the stateless session bean count
103         */
104        public CountStatisticImpl getStatelessSessionBeanCountImpl() {
105            return statelessSessionBeanCount;
106        }
107    
108        /**
109         * Get the statefull session bean count
110         */
111        public CountStatisticImpl getStatefulSessionBeanCountImpl() {
112            return statefulSessionBeanCount;
113        }
114    
115        /**
116         * Get the message driven bean count
117         */
118        public CountStatisticImpl getMessageDrivenBeanCountImpl() {
119            return messageDrivenBeanCount;
120        }
121    
122        /**
123         * Get the total bean count
124         */
125        public CountStatisticImpl getTotalBeanCountImpl() {
126            return totalBeanCount;
127        }
128    }