1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node;
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession;
48 import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError;
49 import org.xml.sax.Attributes;
50 import org.xml.sax.SAXException;
51
52
53
54
55
56
57
58
59 public class ExpMethodResponseNode extends Node implements ErrorIf, RetValPipeIf, NonVolatileIf {
60 private String iName;
61
62 private ErrorNode iErrorNode;
63
64 private IReturnValueNode iRetValNode;
65
66
67
68
69 public ExpMethodResponseNode() {
70 super(EXPMETHODRESPONSE);
71 }
72
73 public void addChild(Node pChild) {
74 if (pChild instanceof ErrorNode) this.iErrorNode = (ErrorNode) pChild; else this.iRetValNode =
75 (IReturnValueNode) pChild;
76 }
77
78
79
80
81 @Override
82 public void init(Attributes pAttribs, SAXSession pSession) throws SAXException {
83 this.iName = getCIMName(pAttribs);
84 this.iErrorNode = null;
85 this.iRetValNode = null;
86 }
87
88
89
90
91 @Override
92 public void parseData(String pData) {
93
94 }
95
96 @Override
97 public void testChild(String pNodeNameEnum) throws SAXException {
98 if (pNodeNameEnum == ERROR || pNodeNameEnum == IRETURNVALUE) {
99 Node node;
100 if (this.iErrorNode != null) node = this.iErrorNode; else if (this.iRetValNode != null) node =
101 this.iRetValNode; else node = null;
102 if (node != null) throw new SAXException(
103 pNodeNameEnum +
104 " child node is invalid for " +
105 getNodeName() +
106 " node, since it already has a " +
107 node.getNodeName() +
108 " child node!"
109 );
110 } else throw new SAXException(getNodeName() + " node cannot have " + pNodeNameEnum + " child node!");
111 }
112
113
114
115
116 @Override
117 public void childParsed(Node pChild) {
118
119 }
120
121 @Override
122 public void testCompletness() {
123
124 }
125
126 public CIMError getCIMError() {
127 return this.iErrorNode == null ? null : this.iErrorNode.getCIMError();
128 }
129
130 public int getReturnValueCount() {
131 return this.iRetValNode == null ? 0 : this.iRetValNode.getReturnValueCount();
132 }
133
134 public Object readReturnValue() {
135 return this.iRetValNode.readReturnValue();
136 }
137
138
139
140
141
142
143 public String getName() {
144 return this.iName;
145 }
146 }