KickJava   Java API By Example, From Geeks To Geeks.

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


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 javax.management.*;
27 import com.sun.enterprise.admin.util.ArgChecker;
28 import com.sun.enterprise.admin.common.Param;
29 import com.sun.enterprise.admin.common.AdminRequest;
30 import com.sun.enterprise.admin.common.constant.AdminConstants;
31
32 /**
33  */

34 public class AdminRequestConfigurator
35 {
36     private final AdminRequest request;
37
38     /**
39      * Creates new AdminRequestConfigurator
40      */

41     public AdminRequestConfigurator(AdminRequest request)
42     {
43         ArgChecker.checkValid(request, "request"); //NOI18N
44
this.request = request;
45     }
46
47     /**
48      * Sets the objectName param in the request.
49      */

50     public void setObjectName(ObjectName objectName)
51     {
52         request.addParam(new Param(AdminConstants.OBJECT_NAME, objectName));
53     }
54
55     /**
56      * Gets the objectName param value from the request.
57      */

58     public ObjectName getObjectName()
59     {
60         ObjectName objectName = null;
61         Param param = request.getParam(AdminConstants.OBJECT_NAME);
62         if (param != null)
63         {
64             objectName = (ObjectName)(param.mValue);
65         }
66         return objectName;
67     }
68
69     /**
70      * Sets the clientVersion param in the request.
71      */

72     public void setClientVersion(String JavaDoc clientVersion)
73     {
74         request.addParam(new Param(AdminConstants.CLIENT_VERSION,
75                                         clientVersion));
76     }
77
78     /**
79      * Gets the clientVersion param value from the request.
80      */

81     public String JavaDoc getClientVersion()
82     {
83         String JavaDoc clientVersion = null;
84         Param param = request.getParam(AdminConstants.CLIENT_VERSION);
85         if (param != null)
86         {
87             clientVersion = (String JavaDoc)(param.mValue);
88         }
89         return clientVersion;
90     }
91
92     /**
93      * Sets the operationName param in the request.
94      */

95     public void setOperationName(String JavaDoc operationName)
96     {
97         request.addParam(new Param(AdminConstants.OPERATION_NAME,
98                                         operationName));
99     }
100
101     /**
102      * Gets the operationName param value from the request.
103      */

104     public String JavaDoc getOperationName()
105     {
106         String JavaDoc operationName = null;
107         Param param = request.getParam(AdminConstants.OPERATION_NAME);
108         if (param != null)
109         {
110             operationName = (String JavaDoc)(param.mValue);
111         }
112         return operationName;
113     }
114
115     /**
116      * Sets the 'params' param in the request.
117      */

118     public void setOperationParams(Object JavaDoc[] params)
119     {
120         request.addParam(new Param(AdminConstants.OPERATION_PARAMS, params));
121     }
122
123     /**
124      * Gets the 'params' param from the request.
125      */

126     public Object JavaDoc[] getOperationParams()
127     {
128         Object JavaDoc[] params = null;
129         Param param = request.getParam(AdminConstants.OPERATION_PARAMS);
130         if (param != null)
131         {
132             params = (Object JavaDoc[])(param.mValue);
133         }
134         return params;
135     }
136
137     /**
138      * Sets the signature param in the request.
139      */

140     public void setOperationSignature(String JavaDoc[] signature)
141     {
142         request.addParam(new Param(AdminConstants.OPERATION_SIGNATURE,
143                                    signature));
144     }
145
146     /**
147      * Gets the signature param from the request.
148      */

149     public String JavaDoc[] getOperationSignature()
150     {
151         String JavaDoc[] signature = null;
152         Param param = request.getParam(AdminConstants.OPERATION_SIGNATURE);
153         if (param != null)
154         {
155             signature = (String JavaDoc[])(param.mValue);
156         }
157         return signature;
158     }
159
160     /**
161      */

162     public void setAttributeName(String JavaDoc attributeName)
163     {
164         request.addParam(new Param(AdminConstants.ATTRIBUTE_NAME,
165                                     attributeName));
166     }
167
168     /**
169      */

170     public String JavaDoc getAttributeName()
171     {
172         String JavaDoc attributeName = null;
173         Param param = request.getParam(AdminConstants.ATTRIBUTE_NAME);
174         if (param != null)
175         {
176             attributeName = (String JavaDoc)(param.mValue);
177         }
178         return attributeName;
179     }
180
181     /**
182      */

183     public void setAttribute(Attribute attribute)
184     {
185         request.addParam(new Param(AdminConstants.ATTRIBUTE, attribute));
186     }
187
188     /**
189      */

190     public Attribute getAttribute()
191     {
192         Attribute attribute = null;
193         Param param = request.getParam(AdminConstants.ATTRIBUTE);
194         if (param != null)
195         {
196             attribute = (Attribute)(param.mValue);
197         }
198         return attribute;
199     }
200
201     /**
202      */

203     public void setAttributeList(AttributeList al)
204     {
205         request.addParam(new Param(AdminConstants.ATTRIBUTE_LIST, al));
206     }
207
208     /**
209      */

210     public AttributeList getAttributeList()
211     {
212         AttributeList attributeList = null;
213         Param param = request.getParam(AdminConstants.ATTRIBUTE_LIST);
214         if (param != null)
215         {
216             attributeList = (AttributeList)(param.mValue);
217         }
218         return attributeList;
219     }
220
221     /**
222      */

223     public String JavaDoc[] getAttributeNames()
224     {
225         String JavaDoc[] attributeNames = null;
226         Param param = request.getParam(AdminConstants.ATTRIBUTE_NAMES);
227         if (param != null)
228         {
229             attributeNames = (String JavaDoc[])(param.mValue);
230         }
231         return attributeNames;
232     }
233
234     /**
235      */

236     public void setAttributeNames(String JavaDoc[] attributeNames)
237     {
238         request.addParam(new Param(AdminConstants.ATTRIBUTE_NAMES,
239                                    attributeNames));
240     }
241 }
Popular Tags