KickJava   Java API By Example, From Geeks To Geeks.

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


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/BoundaryStatisticImpl.java,v 1.4 2006/03/09 20:30:28 llc Exp $
26  * $Revision: 1.4 $
27  * $Date: 2006/03/09 20:30:28 $
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 import javax.management.j2ee.statistics.BoundaryStatistic JavaDoc;
37
38 import com.sun.appserv.management.util.jmx.OpenMBeanUtil;
39
40 /**
41     Serializable implementation of a BoundaryStatistic
42  */

43 public class BoundaryStatisticImpl extends StatisticImpl
44     implements BoundaryStatistic JavaDoc, Serializable JavaDoc
45 {
46     static final long serialVersionUID = -5190567251179453418L;
47     
48     private long LowerBound;
49     private long UpperBound;
50     
51     
52         public
53     BoundaryStatisticImpl(
54         final String JavaDoc name,
55         final String JavaDoc description,
56         final String JavaDoc unit,
57         final long startTime,
58         final long lastSampleTime,
59         final long lower,
60         final long upper )
61     {
62         super( name, description, unit, startTime, lastSampleTime );
63         
64         if ( LowerBound > UpperBound )
65         {
66             throw new IllegalArgumentException JavaDoc();
67         }
68         
69         LowerBound = lower;
70         UpperBound = upper;
71     }
72     
73     /**
74         Base the Statistic on the {@link CompositeData}
75      */

76         public
77     BoundaryStatisticImpl( final CompositeData JavaDoc compositeData )
78     {
79         this( OpenMBeanUtil.compositeDataToMap( compositeData ) );
80     }
81     
82         public
83     BoundaryStatisticImpl( final Map JavaDoc<String JavaDoc,?> m )
84     {
85         this( new MapStatisticImpl( m ) );
86     }
87     
88     
89         public
90     BoundaryStatisticImpl( final MapStatistic s )
91     {
92         super( s );
93         
94         LowerBound = s.getlong( "LowerBound" );
95         UpperBound = s.getlong( "UpperBound" );
96     }
97     
98         public
99     BoundaryStatisticImpl( final BoundaryStatistic JavaDoc s )
100     {
101         super( s );
102         
103         LowerBound = s.getLowerBound();
104         UpperBound = s.getUpperBound();
105     }
106     
107         public long
108     getLowerBound()
109     {
110         return( LowerBound );
111     }
112     
113         public long
114     getUpperBound()
115     {
116         return( UpperBound );
117     }
118 }
119
120
121
122
123
124
Popular Tags