KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > admin > common > AdminResponseConfigurator


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 package com.sun.enterprise.admin.common;
25
26 import java.io.Serializable JavaDoc;
27
28 import com.sun.enterprise.admin.common.Param;
29 import com.sun.enterprise.admin.common.AdminResponse;
30 import com.sun.enterprise.admin.common.constant.AdminConstants;
31
32 /**
33  */

34 public class AdminResponseConfigurator
35 {
36     private final AdminResponse response;
37
38     /**
39      * Creates new AdminResponseConfigurator
40      */

41     public AdminResponseConfigurator(AdminResponse response)
42     {
43         //ArgChecker.check(response);
44
this.response = response;
45     }
46
47     /**
48      */

49     public void setException(Throwable JavaDoc t)
50     {
51         //ArgChecker.check(t); Do we need this check?
52
response.addParam(new Param(AdminConstants.EXCEPTION, t));
53     }
54
55     public boolean hasException()
56     {
57         Param param = response.getParam(AdminConstants.EXCEPTION);
58         if (param != null)
59         {
60             return (param.mValue != null);
61         }
62         return false;
63     }
64
65     public Throwable JavaDoc getException()
66     {
67         Throwable JavaDoc t = null;
68         if (hasException())
69         {
70             Param param = response.getParam(AdminConstants.EXCEPTION);
71             t = (Throwable JavaDoc)param.mValue;
72         }
73         return t;
74     }
75
76     public void setReturnValue(Serializable JavaDoc value)
77     {
78         response.addParam(new Param(AdminConstants.RETURN_VALUE, value));
79     }
80
81     public Object JavaDoc getReturnValue()
82     {
83         Object JavaDoc returnValue = null;
84         Param param = response.getParam(AdminConstants.RETURN_VALUE);
85         if (param != null)
86         {
87             returnValue = (Object JavaDoc)param.mValue;
88         }
89         return returnValue;
90     }
91 }
Popular Tags