1 /* 2 CIMResponse.java 3 4 (C) Copyright IBM Corp. 2005, 2012 5 6 THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE 7 ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE 8 CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. 9 10 You can obtain a current copy of the Eclipse Public License from 11 http://www.opensource.org/licenses/eclipse-1.0.php 12 13 @author : Roberto Pineiro, IBM, roberto.pineiro@us.ibm.com 14 * @author : Chung-hao Tan, IBM, chungtan@us.ibm.com 15 * 16 * 17 * Change History 18 * Flag Date Prog Description 19 *------------------------------------------------------------------------------- 20 * 1535756 2006-08-07 lupusalex Make code warning free 21 * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL 22 * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) 23 * 2531371 2009-02-10 raman_arora Upgrade client to JDK 1.5 (Phase 2) 24 * 2763216 2009-04-14 blaschke-oss Code cleanup: visible spelling/grammar errors 25 * 3525135 2012-05-09 blaschke-oss Remove CIMResponse.isSuccessul 26 */ 27 28 package org.metricshub.wbem.sblim.cimclient.internal.cimxml; 29 30 /*- 31 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲ 32 * WBEM Java Client 33 * ჻჻჻჻჻჻ 34 * Copyright 2023 - 2025 MetricsHub 35 * ჻჻჻჻჻჻ 36 * Licensed under the Apache License, Version 2.0 (the "License"); 37 * you may not use this file except in compliance with the License. 38 * You may obtain a copy of the License at 39 * 40 * http://www.apache.org/licenses/LICENSE-2.0 41 * 42 * Unless required by applicable law or agreed to in writing, software 43 * distributed under the License is distributed on an "AS IS" BASIS, 44 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 45 * See the License for the specific language governing permissions and 46 * limitations under the License. 47 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱ 48 */ 49 50 import java.util.List; 51 import java.util.Vector; 52 import org.metricshub.wbem.javax.wbem.WBEMException; 53 54 /** 55 * Represent a CIMReponse message. 56 */ 57 public class CIMResponse extends CIMMessage { 58 protected Vector<CIMResponse> iResponses = new Vector<CIMResponse>(0); 59 60 protected WBEMException iError = null; 61 62 protected Vector<Object> iReturnValue = new Vector<Object>(); 63 64 protected Vector<Object> iParamValue = new Vector<Object>(0); 65 66 /** 67 * Constructs a CIMResponse object. 68 * 69 */ 70 public CIMResponse() { 71 /**/ 72 } 73 74 /** 75 * Constructs a CIMResponse object with the specified CIMVersion, DTDVersion 76 * and method. 77 * 78 * @param pCimVersion 79 * @param pDtdVersion 80 * @param pId 81 * @param pMethod 82 */ 83 public CIMResponse(String pCimVersion, String pDtdVersion, String pId, String pMethod) { 84 super(pCimVersion, pDtdVersion, pId, pMethod); 85 } 86 87 /** 88 * Constructs a CIM Response message from a given CIM Request. 89 * 90 * @param request 91 */ 92 public CIMResponse(CIMRequest request) { 93 super(); 94 this.iCimVersion = request.getCIMVersion(); 95 this.iDtdVersion = request.getDTDVersion(); 96 } 97 98 /** 99 * addParamValue 100 * 101 * @param o 102 */ 103 public void addParamValue(Object o) { 104 this.iParamValue.add(o); 105 } 106 107 /** 108 * addParamValue 109 * 110 * @param v 111 */ 112 public void addParamValue(Vector<Object> v) { 113 this.iParamValue.addAll(v); 114 } 115 116 /** 117 * addResponse 118 * 119 * @param response 120 */ 121 public void addResponse(CIMResponse response) { 122 this.iResponses.add(response); 123 } 124 125 /** 126 * addReturnValue 127 * 128 * @param o 129 */ 130 public void addReturnValue(Object o) { 131 this.iReturnValue.add(o); 132 } 133 134 /** 135 * Verify the status code for this CIMResponse. 136 * 137 * @throws WBEMException 138 * if the status code is other than success. 139 */ 140 public void checkError() throws WBEMException { 141 if (this.iError != null) throw this.iError; 142 } 143 144 /** 145 * getAllResponses 146 * 147 * @return List 148 */ 149 public List<CIMResponse> getAllResponses() { 150 return this.iResponses; 151 } 152 153 /** 154 * getException 155 * 156 * @return WBEMException 157 */ 158 public WBEMException getException() { 159 return this.iError; 160 } 161 162 /** 163 * isSuccessful 164 * 165 * @return boolean 166 */ 167 public boolean isSuccessful() { 168 return this.iError == null; 169 } 170 171 /** 172 * getFirstResponse 173 * 174 * @return CIMResponse 175 */ 176 public CIMResponse getFirstResponse() { 177 if (this.iResponses != null && this.iResponses.size() > 0) return this.iResponses.elementAt(0); 178 return null; 179 } 180 181 /** 182 * getParamValues 183 * 184 * @return List 185 */ 186 public List<Object> getParamValues() { 187 return this.iParamValue; 188 } 189 190 /** 191 * getFirstReturnValue 192 * 193 * @return List 194 */ 195 public List<Object> getFirstReturnValue() { 196 return this.iReturnValue; 197 } 198 199 /** 200 * setError 201 * 202 * @param error 203 */ 204 public void setError(WBEMException error) { 205 this.iError = error; 206 } 207 208 /** 209 * setParamValue 210 * 211 * @param paramValue 212 */ 213 public void setParamValue(Vector<Object> paramValue) { 214 this.iParamValue = paramValue; 215 } 216 217 /** 218 * setReturnValue 219 * 220 * @param returnValue 221 */ 222 public void setReturnValue(Vector<Object> returnValue) { 223 this.iReturnValue = returnValue; 224 } 225 }