KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > j2ee > statistics > TimeStatisticImpl


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  * $Header: /cvs/glassfish/admin-core/mbeanapi/src/java/com/sun/appserv/management/j2ee/statistics/TimeStatisticImpl.java,v 1.4 2006/03/09 20:30:29 llc Exp $
26  * $Revision: 1.4 $
27  * $Date: 2006/03/09 20:30:29 $
28  */

29
30 package com.sun.appserv.management.j2ee.statistics;
31
32 import java.util.Map JavaDoc;
33 import java.io.Serializable JavaDoc;
34
35 import javax.management.openmbean.CompositeData JavaDoc;
36
37 import javax.management.j2ee.statistics.TimeStatistic JavaDoc;
38
39 import com.sun.appserv.management.util.jmx.OpenMBeanUtil;
40
41
42 /**
43     
44  */

45 public final class TimeStatisticImpl
46     extends StatisticImpl implements TimeStatistic JavaDoc, Serializable JavaDoc
47 {
48     static final long serialVersionUID = 1090185734375468511L;
49     
50     /* member names as defined by JSR 77 */
51     private final long Count;
52     private final long MinTime;
53     private final long MaxTime;
54     private final long TotalTime;
55     
56         public
57     TimeStatisticImpl( final CompositeData JavaDoc compositeData )
58     {
59         this( OpenMBeanUtil.compositeDataToMap( compositeData ) );
60     }
61     
62         public
63     TimeStatisticImpl( final Map JavaDoc<String JavaDoc,?> m )
64     {
65         this( new MapStatisticImpl( m ) );
66     }
67     
68         public
69     TimeStatisticImpl( final TimeStatistic JavaDoc s )
70     {
71         super( s );
72         
73         Count = s.getCount();
74         MinTime = s.getMinTime();
75         MaxTime = s.getMaxTime();
76         TotalTime = s.getTotalTime();
77     }
78     
79         public
80     TimeStatisticImpl( final MapStatistic s )
81     {
82         super( s );
83         
84         Count = s.getlong( "Count" );
85         MinTime = s.getlong( "MinTime" );
86         MaxTime = s.getlong( "MaxTime" );
87         TotalTime = s.getlong( "TotalTime" );
88     }
89     
90         public
91     TimeStatisticImpl(
92         final String JavaDoc name,
93         final String JavaDoc description,
94         final String JavaDoc unit,
95         final long startTime,
96         final long lastSampleTime,
97         final long count,
98         final long maxTime,
99         final long minTime,
100         final long totalTime )
101     {
102         super( name, description, unit, startTime, lastSampleTime );
103         Count = count;
104         MaxTime = maxTime;
105         MinTime = minTime;
106         TotalTime = totalTime;
107     }
108
109
110         public long
111     getCount()
112     {
113         return( Count );
114     }
115
116         public long
117     getMaxTime()
118     {
119         return( MaxTime );
120     }
121
122         public long
123     getMinTime()
124     {
125         return( MinTime );
126     }
127
128         public long
129     getTotalTime()
130     {
131         return( TotalTime );
132     }
133 }
134
135
136
137
138
139
Popular Tags