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 * 1720707 2007-05-17 ebak Conventional Node factory for CIM-XML SAX parser 19 * 2003590 2008-06-30 blaschke-oss Change licensing from CPL to EPL 20 * 2524131 2009-01-21 raman_arora Upgrade client to JDK 1.5 (Phase 1) 21 * 2677 2013-09-30 blaschke-oss ObjectPathNode allows all child nodes 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.javax.cim.CIMObjectPath; 47 import org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.SAXSession; 48 import org.xml.sax.Attributes; 49 import org.xml.sax.SAXException; 50 51 /** 52 * ELEMENT OBJECTPATH (INSTANCEPATH | CLASSPATH) 53 */ 54 public class ObjectPathNode extends AbstractPathNode { 55 // (INSTANCEPATH | CLASSPATH) 56 private CIMObjectPath iObjPath; 57 58 // private AbstractObjectPathNode iChildNode; 59 60 /** 61 * Ctor. 62 */ 63 public ObjectPathNode() { 64 super(OBJECTPATH); 65 } 66 67 /** 68 * @param pAttribs 69 * @param pSession 70 */ 71 @Override 72 public void init(Attributes pAttribs, SAXSession pSession) { 73 this.iObjPath = null; 74 // no attributes 75 } 76 77 /** 78 * @param pData 79 */ 80 @Override 81 public void parseData(String pData) { 82 // no data 83 } 84 85 @Override 86 public void testChild(String pNodeNameEnum) throws SAXException { 87 if (this.iObjPath != null) throw new SAXException( 88 getNodeName() + 89 " node can have only one INSTANCEPATH or CLASSPATH child node!" + 90 " Additional " + 91 pNodeNameEnum + 92 " child node is invalid!" 93 ); 94 if (pNodeNameEnum != CLASSPATH && pNodeNameEnum != INSTANCEPATH) throw new SAXException( 95 getNodeName() + " node child node can be CLASSPATH or INSTANCEPATH but a " + pNodeNameEnum + " node was found!" 96 ); 97 } 98 99 @Override 100 public void childParsed(Node pChild) { 101 this.iObjPath = ((AbstractObjectPathNode) pChild).getCIMObjectPath(); 102 } 103 104 @Override 105 public void testCompletness() throws SAXException { 106 if (this.iObjPath == null) throw new SAXException( 107 getNodeName() + " node must have a INSTANCEPATH or CLASSPATH child node!" 108 ); 109 } 110 111 public CIMObjectPath getCIMObjectPath() { 112 return this.iObjPath; 113 } 114 }