View Javadoc
1   /*
2     CIMMessage.java
3   
4     (C) Copyright IBM Corp. 2005, 2009
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   */
25  
26  package org.metricshub.wbem.sblim.cimclient.internal.cimxml;
27  
28  /*-
29   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
30   * WBEM Java Client
31   * ჻჻჻჻჻჻
32   * Copyright 2023 - 2025 MetricsHub
33   * ჻჻჻჻჻჻
34   * Licensed under the Apache License, Version 2.0 (the "License");
35   * you may not use this file except in compliance with the License.
36   * You may obtain a copy of the License at
37   *
38   *      http://www.apache.org/licenses/LICENSE-2.0
39   *
40   * Unless required by applicable law or agreed to in writing, software
41   * distributed under the License is distributed on an "AS IS" BASIS,
42   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
43   * See the License for the specific language governing permissions and
44   * limitations under the License.
45   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
46   */
47  
48  import java.util.Hashtable;
49  import org.w3c.dom.Document;
50  
51  /**
52   * Class CIMMessage is used by the CIM-XML DOM parser.
53   */
54  public class CIMMessage {
55  	protected Document iDoc;
56  
57  	protected Hashtable<?, ?> iElements;
58  
59  	protected String iCimVersion;
60  
61  	protected String iDtdVersion;
62  
63  	protected String iId;
64  
65  	protected String iProtocolVersion;
66  
67  	protected String iMethod;
68  
69  	protected boolean iIsCIMExport = false;
70  
71  	protected boolean iIsSimple = false;
72  
73  	protected boolean iIsRequest = false;
74  
75  	protected CIMMessage() {
76  		/**/
77  	}
78  
79  	/**
80  	 * Ctor.
81  	 *
82  	 * @param pCimVersion
83  	 * @param pDtdVersion
84  	 * @param pId
85  	 * @param pMethod
86  	 */
87  	public CIMMessage(String pCimVersion, String pDtdVersion, String pId, String pMethod) {
88  		this.iCimVersion = pCimVersion;
89  		this.iDtdVersion = pDtdVersion;
90  		this.iId = pId;
91  		this.iMethod = pMethod;
92  	}
93  
94  	/**
95  	 * getCIMVersion
96  	 *
97  	 * @return String
98  	 */
99  	public String getCIMVersion() {
100 		return this.iCimVersion;
101 	}
102 
103 	/**
104 	 * getDTDVersion
105 	 *
106 	 * @return String
107 	 */
108 	public String getDTDVersion() {
109 		return this.iDtdVersion;
110 	}
111 
112 	/**
113 	 * isCIMOperation
114 	 *
115 	 * @return String
116 	 */
117 	public boolean isCIMOperation() {
118 		return !this.iIsCIMExport;
119 	}
120 
121 	/**
122 	 * isCIMExport
123 	 *
124 	 * @return String
125 	 */
126 	public boolean isCIMExport() {
127 		return this.iIsCIMExport;
128 	}
129 
130 	/**
131 	 * setId
132 	 *
133 	 * @param pId
134 	 */
135 	public void setId(String pId) {
136 		this.iId = pId;
137 	}
138 
139 	/**
140 	 * setMethod
141 	 *
142 	 * @param pMethod
143 	 */
144 	public void setMethod(String pMethod) {
145 		this.iMethod = pMethod;
146 		this.iIsCIMExport = (pMethod.toUpperCase().endsWith("EXPREQ") || pMethod.toUpperCase().endsWith("EXPRSP"));
147 		this.iIsRequest = (pMethod.toUpperCase().endsWith("REQ"));
148 		this.iIsSimple = pMethod.toUpperCase().startsWith("SIMPLE");
149 	}
150 
151 	/**
152 	 * setCIMVersion
153 	 *
154 	 * @param pCimVersion
155 	 */
156 	public void setCIMVersion(String pCimVersion) {
157 		this.iCimVersion = pCimVersion;
158 	}
159 
160 	/**
161 	 * setDTDVersion
162 	 *
163 	 * @param pDtdVersion
164 	 */
165 	public void setDTDVersion(String pDtdVersion) {
166 		this.iDtdVersion = pDtdVersion;
167 	}
168 
169 	/**
170 	 * setIsRequest
171 	 *
172 	 * @param pValue
173 	 */
174 	public void setIsRequest(boolean pValue) {
175 		this.iIsRequest = pValue;
176 	}
177 
178 	/**
179 	 * getId
180 	 *
181 	 * @return String
182 	 */
183 	public String getId() {
184 		return this.iId;
185 	}
186 
187 	/**
188 	 * getProtocolVersion
189 	 *
190 	 * @return String
191 	 */
192 	public String getProtocolVersion() {
193 		return this.iProtocolVersion;
194 	}
195 }