KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > monitor > stats > spi > StatisticFactory


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * $Id: StatisticFactory.java,v 1.3 2005/12/25 03:43:45 tcfujii Exp $
26  * $Date: 2005/12/25 03:43:45 $
27  * $Revision: 1.3 $
28  */

29
30 package com.sun.enterprise.admin.monitor.stats.spi;
31 import javax.management.j2ee.statistics.*;
32 import com.sun.enterprise.admin.monitor.stats.*;
33
34 public class StatisticFactory {
35     
36     /** Creates a new instance of StatisticFactory */
37     public StatisticFactory() {
38     }
39     
40     /**
41      * returns an instance of the CountStatistic
42      * @return CountStatistic
43      */

44     public static CountStatistic getCountStatistic(long countVal, String JavaDoc name,
45                                                    String JavaDoc unit, String JavaDoc desc,
46                                                    long sampleTime, long startTime) {
47                                                        
48         return new CountStatisticImpl(countVal, name, unit, desc,
49                                       sampleTime, startTime);
50     }
51     
52     /**
53      * returns an instance of the RangeStatistic
54      * @return RangeStatistic
55      */

56     public static RangeStatistic getRangeStatistic(long curVal, long highMark,
57                                                    long lowMark, String JavaDoc name,
58                                                    String JavaDoc unit, String JavaDoc desc,
59                                                    long startTime, long sampleTime) {
60         
61         return new RangeStatisticImpl(curVal, highMark, lowMark, name,
62                                       unit, desc, startTime, sampleTime);
63     }
64     
65     /**
66      * returns an instance of the BoundaryStatistic
67      * @return BoundaryStatistic
68      */

69     public static BoundaryStatistic getBoundaryStatistic(long lower, long upper,
70                                                          String JavaDoc name, String JavaDoc unit,
71                                                          String JavaDoc desc, long startTime,
72                                                          long sampleTime) {
73         
74         return new BoundaryStatisticImpl(lower, upper, name, unit, desc,
75                                          startTime, sampleTime);
76     }
77     
78     /**
79      * returns an instance of the BoundedRangeStatistic
80      * @return BoundedRangeStatistic
81      */

82     public static BoundedRangeStatistic getBoundedRangeStatistic(long curVal, long highMark,
83                                                                  long lowMark, long upper,
84                                                                  long lower, String JavaDoc name,
85                                                                  String JavaDoc unit, String JavaDoc desc,
86                                                                  long startTime, long sampleTime) {
87         
88         return new BoundedRangeStatisticImpl(curVal, highMark, lowMark,
89                                              upper, lower, name, unit,
90                                              desc, startTime, sampleTime);
91     }
92     
93     /**
94      * returns an instance of the TimeStatistic
95      * @return TimeStatistic
96      */

97     public static TimeStatistic getTimeStatistic(long counter, long maxTime,
98                                                  long minTime, long totalTime,
99                                                  String JavaDoc name, String JavaDoc unit,
100                                                  String JavaDoc desc, long startTime,
101                                                  long sampleTime) {
102                                                      
103         return new TimeStatisticImpl(counter, maxTime, minTime, totalTime,
104                                      name, unit, desc, startTime, sampleTime);
105                                      
106     }
107 }
108
Popular Tags