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 * 1712656 2007-05-04 ebak Correct type identification for SVC CIMOM 19 * 1714878 2007-05-08 ebak Empty string property values are parsed as nulls 20 * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser 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.sax.node; 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 org.metricshub.wbem.javax.cim.CIMDataType; 49 import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; 50 import org.xml.sax.Attributes; 51 import org.xml.sax.SAXException; 52 53 /** 54 * ELEMENT VALUE (#PCDATA)<br> 55 * For non-standard CIMOMs the TYPE and PARAMTYPE attributes are supported. 56 */ 57 public class ValueNode extends AbstractScalarValueNode { 58 private CIMDataType iType; 59 60 private String iData; 61 62 /** 63 * Ctor. 64 */ 65 public ValueNode() { 66 super(VALUE); 67 } 68 69 /** 70 * @param pSession 71 */ 72 @Override 73 public void init(Attributes pAttribs, SAXSession pSession) throws SAXException { 74 this.iData = null; 75 /* 76 * For supporting non-standard CIMOMs TYPE and PARAMTYPE attributes are 77 * handled 78 */ 79 this.iType = getCIMType(pAttribs, true); 80 if (this.iType == null) this.iType = getParamType(pAttribs); 81 } 82 83 @Override 84 public void parseData(String pData) { 85 this.iData = pData; 86 } 87 88 @Override 89 public void testChild(String pNodeNameEnum) throws SAXException { 90 throw new SAXException("VALUE node cannot have any child node! (" + pNodeNameEnum + ")"); 91 } 92 93 /** 94 * @param pChild 95 */ 96 @Override 97 public void childParsed(Node pChild) { 98 // no child 99 } 100 101 @Override 102 public void testCompletness() { 103 // no child nodes 104 } 105 106 /** 107 * @see ValueIf#getValue() If 108 * the getType() returns non-null value, the container Node have to 109 * convert the String into the corresponding Java object. 110 * @return String 111 */ 112 public Object getValue() { 113 /* 114 * If iData is null we return empty String. If null values have to be 115 * represented by avoiding the VALUE element, or placing VALUE.NULLs 116 * into VALUE.ARRAYs. 117 */ 118 return this.iData == null ? "" : this.iData; 119 } 120 121 /** 122 * @see TypedIf#getType() 123 * @return usually null, because the type is unknown, but can return 124 * non-null in case of non-standard CIMOM. 125 */ 126 public CIMDataType getType() { 127 return this.iType; 128 } 129 }