KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > jmx > remote > internal > MBeanServerResponseActor


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  * MBeanServerResponseActor.java
26  * $Id: MBeanServerResponseActor.java,v 1.3 2005/12/25 04:26:34 tcfujii Exp $
27  * $Revision: 1.3 $
28  * $Date: 2005/12/25 04:26:34 $
29  * Indentation Information:
30  * 0. Please (try to) preserve these settings.
31  * 1. Tabs are preferred over spaces.
32  * 2. In vi/vim -
33  * :set tabstop=4 :set shiftwidth=4 :set softtabstop=4
34  * 3. In S1 Studio -
35  * 1. Tools->Options->Editor Settings->Java Editor->Tab Size = 4
36  * 2. Tools->Options->Indentation Engines->Java Indentation Engine->Expand Tabs to Spaces = False.
37  * 3. Tools->Options->Indentation Engines->Java Indentation Engine->Number of Spaces per Tab = 4.
38  * Unit Testing Information:
39  * 0. Is Standard Unit Test Written (y/n):
40  * 1. Unit Test Location: (The instructions should be in the Unit Test Class itself).
41  */

42
43 package com.sun.enterprise.admin.jmx.remote.internal;
44
45 import javax.management.remote.message.MBeanServerResponseMessage;
46
47 /** A class to <code> act </code> on the instances of {@link MBeanServerResponseMessage}.
48  * Since the response may have both the exceptions and valid results, we have to
49  * carefully handle them.
50  * @author mailto:Kedar.Mhaswade@Sun.Com
51  * @since Sun Java System Application Server 8
52  */

53 class MBeanServerResponseActor {
54     
55     private MBeanServerResponseActor() {
56         //disllow
57
}
58     static final void voidOrThrow(final MBeanServerResponseMessage message) throws Exception JavaDoc {
59         if (message.isException()) {
60             throw ((Exception JavaDoc)message.getWrappedResult());
61         }
62         /*ignore the return value, if there is no exception, as the message
63         implies a method invocation that returns void. */

64     }
65     
66     static final Object JavaDoc returnOrThrow(final MBeanServerResponseMessage message) throws Exception JavaDoc {
67         voidOrThrow(message);
68         return ( message.getWrappedResult() );
69     }
70 }
71
Popular Tags