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
26
27 package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node;
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 import org.metricshub.wbem.javax.cim.CIMArgument;
50 import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession;
51 import org.metricshub.wbem.sblim.cimclient.internal.wbem.CIMError;
52 import org.xml.sax.Attributes;
53 import org.xml.sax.SAXException;
54
55
56
57
58
59
60
61
62
63 public class SimpleRspNode extends AbstractSimpleRspNode {
64 private Node iChildNode;
65
66
67
68
69 public SimpleRspNode() {
70 super(SIMPLERSP);
71 }
72
73 public void addChild(Node pChild) {
74 this.iChildNode = pChild;
75 }
76
77
78
79
80
81 @Override
82 public void init(Attributes pAttribs, SAXSession pSession) {
83 this.iChildNode = null;
84
85 }
86
87
88
89
90 @Override
91 public void parseData(String pData) {
92
93 }
94
95 @Override
96 public void testChild(String pNodeNameEnum) throws SAXException {
97 if (this.iChildNode != null) throw new SAXException(getNodeName() + " node can have only one child node!");
98 if (pNodeNameEnum != METHODRESPONSE && pNodeNameEnum != IMETHODRESPONSE) throw new SAXException(
99 getNodeName() + " node cannot have " + pNodeNameEnum + " child node!"
100 );
101 }
102
103 @Override
104 public void testCompletness() throws SAXException {
105 if (this.iChildNode == null) throw new SAXException(getNodeName() + " node must have a child node!");
106 }
107
108 @Override
109 public CIMError getCIMError() {
110 if (this.iChildNode instanceof ErrorIf) {
111 return ((ErrorIf) this.iChildNode).getCIMError();
112 }
113 return null;
114 }
115
116
117
118
119
120
121
122 @Override
123 public CIMArgument<?>[] getCIMArguments() {
124 if (this.iChildNode instanceof MethodResponseNode) return (
125 (MethodResponseNode) this.iChildNode
126 ).getCIMArguments(); else if (this.iChildNode instanceof IMethodResponseNode) return (
127 (IMethodResponseNode) this.iChildNode
128 ).getCIMArguments();
129 return null;
130 }
131
132 public int getReturnValueCount() {
133 if (this.iChildNode instanceof RetValPipeIf) {
134 return ((RetValPipeIf) this.iChildNode).getReturnValueCount();
135 }
136 return 0;
137 }
138
139 public Object readReturnValue() {
140 return ((RetValPipeIf) this.iChildNode).readReturnValue();
141 }
142 }