View Javadoc
1   /*
2     (C) Copyright IBM Corp. 2006, 2013
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   * 1689085    2007-04-10  ebak         Embedded object enhancements for Pegasus
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   *    2636    2013-05-08  blaschke-oss Nested embedded instances cause CIMXMLParseException
25   */
26  
27  package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node;
28  
29  /*-
30   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
31   * WBEM Java Client
32   * ჻჻჻჻჻჻
33   * Copyright 2023 - 2025 MetricsHub
34   * ჻჻჻჻჻჻
35   * Licensed under the Apache License, Version 2.0 (the "License");
36   * you may not use this file except in compliance with the License.
37   * You may obtain a copy of the License at
38   *
39   *      http://www.apache.org/licenses/LICENSE-2.0
40   *
41   * Unless required by applicable law or agreed to in writing, software
42   * distributed under the License is distributed on an "AS IS" BASIS,
43   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44   * See the License for the specific language governing permissions and
45   * limitations under the License.
46   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
47   */
48  
49  import org.metricshub.wbem.javax.cim.CIMDataType;
50  import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession;
51  import org.xml.sax.Attributes;
52  
53  /**
54   * <pre>
55   *
56   * ELEMENT PROPERTY.REFERENCE (QUALIFIER*, (VALUE.REFERENCE)?)
57   * ATTLIST PROPERTY.REFERENCE
58   *   %CIMName;
59   *   %ReferenceClass;
60   *   %ClassOrigin;
61   *   %Propagated;
62   * </pre>
63   */
64  public class PropertyReferenceNode extends AbstractPropertyNode {
65  	private String iRefClassName;
66  
67  	// VALUE.REFERENCE
68  	private boolean iHasValueRef;
69  
70  	private Object iValue;
71  
72  	/**
73  	 * Ctor.
74  	 */
75  	public PropertyReferenceNode() {
76  		super(PROPERTY_REFERENCE);
77  	}
78  
79  	@Override
80  	protected void childValueNodeParsed(Node pChild) {
81  		this.iValue = ((ValueReferenceNode) pChild).getValue();
82  		this.iHasValueRef = true;
83  	}
84  
85  	@Override
86  	protected String getChildValueNodeNameEnum() {
87  		return VALUE_REFERENCE;
88  	}
89  
90  	public Object getValue() {
91  		return this.iHasValueRef ? this.iValue : null;
92  	}
93  
94  	@Override
95  	protected boolean hasValueNode() {
96  		return this.iHasValueRef;
97  	}
98  
99  	/**
100 	 * @param pSession
101 	 */
102 	@Override
103 	protected void specificInit(Attributes pAttribs, SAXSession pSession) {
104 		this.iHasValueRef = false;
105 		this.iRefClassName = getReferenceClass(pAttribs);
106 	}
107 
108 	@Override
109 	public void testCompletness() {
110 		//
111 	}
112 
113 	public CIMDataType getType() {
114 		return new CIMDataType(this.iRefClassName != null ? this.iRefClassName : "");
115 	}
116 }