1 /*
2 (C) Copyright IBM Corp. 2006, 2009
3
4 THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
5 ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
6 CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
7
8 You can obtain a current copy of the Eclipse Public License from
9 http://www.opensource.org/licenses/eclipse-1.0.php
10
11 @author : Endre Bak, ebak@de.ibm.com
12 *
13 * Flag Date Prog Description
14 * -------------------------------------------------------------------------------
15 * 1565892 2006-12-04 ebak Make SBLIM client JSR48 compliant
16 * 1663270 2007-02-19 ebak Minor performance problems
17 * 1660756 2007-02-22 ebak Embedded object support
18 * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser
19 * 1742873 2007-06-25 ebak IPv6 ready cim-client
20 * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL
21 * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1)
22 */
23
24 package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node;
25
26 /*-
27 * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
28 * WBEM Java Client
29 * ჻჻჻჻჻჻
30 * Copyright 2023 - 2025 MetricsHub
31 * ჻჻჻჻჻჻
32 * Licensed under the Apache License, Version 2.0 (the "License");
33 * you may not use this file except in compliance with the License.
34 * You may obtain a copy of the License at
35 *
36 * http://www.apache.org/licenses/LICENSE-2.0
37 *
38 * Unless required by applicable law or agreed to in writing, software
39 * distributed under the License is distributed on an "AS IS" BASIS,
40 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41 * See the License for the specific language governing permissions and
42 * limitations under the License.
43 * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
44 */
45
46 import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession;
47 import org.xml.sax.Attributes;
48 import org.xml.sax.SAXException;
49
50 /**
51 * ELEMENT HOST (#PCDATA)
52 */
53 public class HostNode extends Node {
54 private String iHost;
55
56 /**
57 * Ctor.
58 */
59 public HostNode() {
60 super(HOST);
61 }
62
63 /**
64 * @param pAttribs
65 * @param pSession
66 */
67 @Override
68 public void init(Attributes pAttribs, SAXSession pSession) {
69 this.iHost = null;
70 // no attributes
71 }
72
73 @Override
74 public void parseData(String pData) {
75 this.iHost = pData;
76 }
77
78 /**
79 * @param pNodeNameEnum
80 */
81 @Override
82 public void testChild(String pNodeNameEnum) throws SAXException {
83 throw new SAXException("HOST node cannot have any child node!");
84 }
85
86 /**
87 * @param pChild
88 */
89 @Override
90 public void childParsed(Node pChild) {
91 // no child node
92
93 }
94
95 @Override
96 public void testCompletness() throws SAXException {
97 if (this.iHost == null) throw new SAXException("HOST node must contain the host name as #PCDATA!");
98 }
99
100 /**
101 * getHostStr
102 *
103 * @return String which may contain the protocol, host and port
104 */
105 public String getHostStr() {
106 return this.iHost;
107 }
108 }