KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > appserv > management > base > Sample


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/base/Sample.java,v 1.3 2005/12/25 03:49:00 tcfujii Exp $
26  * $Revision: 1.3 $
27  * $Date: 2005/12/25 03:49:00 $
28  */

29 package com.sun.appserv.management.base;
30
31 import javax.management.Attribute JavaDoc;
32
33 import com.sun.appserv.management.base.AMX;
34 import com.sun.appserv.management.base.XTypes;
35
36 /**
37     Interface for a sample MBean , used as target for sample and test code.
38     Various Attributes of varying types are made available for testing.
39  */

40 public interface Sample extends Utility, AMX, Singleton
41 {
42 /** The j2eeType as returned by {@link com.sun.appserv.management.base.AMX#getJ2EEType}. */
43     public static final String JavaDoc J2EE_TYPE = XTypes.SAMPLE;
44     
45     /**
46         The type of Notification emitted by emitNotification().
47      */

48     public static final String JavaDoc SAMPLE_NOTIFICATION_TYPE = "Sample";
49     
50     /**
51         The key to access user data within the Map obtained from Notification.getUserData().
52      */

53     public static final String JavaDoc USER_DATA_KEY = "UserData";
54     
55     /**
56         Emit 'numNotifs' notifications of type
57         SAMPLE_NOTIFICATION_TYPE at the specified interval.
58         
59         @param data arbitrary data which will be placed into the Notification's UserData field.
60         @param numNotifs number of Notifications to issue >= 1
61         @param intervalMillis interval at which Notifications should be issued >= 0
62      */

63     public void emitNotifications( final Object JavaDoc data, final int numNotifs, final long intervalMillis );
64     
65     /**
66         Add a new Attribute. After this, the MBeanInfo will contain an MBeanAttributeInfo
67         for this Attribute.
68         
69         @param name
70         @param value
71      */

72     public void addAttribute( final String JavaDoc name, final Object JavaDoc value );
73     
74     /**
75         Remove an Attribute. After this, the MBeanInfo will no longer
76         contain an MBeanAttributeInfo for this Attribute.
77      */

78     public void removeAttribute( final String JavaDoc name );
79     
80     /**
81         For testing bandwidth...
82      */

83     public void uploadBytes( final byte[] bytes );
84     public byte[] downloadBytes( final int numBytes );
85 }
86
Popular Tags