View Javadoc
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   * 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   */
22  
23  package org.metricshub.wbem.sblim.cimclient.internal.cimxml.sax.node;
24  
25  /*-
26   * ╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲
27   * WBEM Java Client
28   * ჻჻჻჻჻჻
29   * Copyright 2023 - 2025 MetricsHub
30   * ჻჻჻჻჻჻
31   * Licensed under the Apache License, Version 2.0 (the "License");
32   * you may not use this file except in compliance with the License.
33   * You may obtain a copy of the License at
34   *
35   *      http://www.apache.org/licenses/LICENSE-2.0
36   *
37   * Unless required by applicable law or agreed to in writing, software
38   * distributed under the License is distributed on an "AS IS" BASIS,
39   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40   * See the License for the specific language governing permissions and
41   * limitations under the License.
42   * ╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱╲╱
43   */
44  
45  import org.metricshub.wbem.javax.cim.CIMScope;
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   * <pre>
52   * ELEMENT SCOPE EMPTY
53   * ATTLIST SCOPE
54   *     CLASS (true | false) &quot;false&quot;
55   *     ASSOCIATION (true | false) &quot;false&quot;
56   *     REFERENCE (true | false) &quot;false&quot;
57   *     PROPERTY (true | false) &quot;false&quot;
58   *     METHOD (true | false) &quot;false&quot;
59   *     PARAMETER (true | false) &quot;false&quot;
60   *     INDICATION (true | false) &quot;false&quot;
61   * </pre>
62   */
63  public class ScopeNode extends Node {
64  	private int iScope;
65  
66  	/**
67  	 * Ctor.
68  	 */
69  	public ScopeNode() {
70  		super(SCOPE);
71  	}
72  
73  	/**
74  	 * getScope
75  	 *
76  	 * @return int - set of CIMScope bits
77  	 */
78  	public int getScope() {
79  		return this.iScope;
80  	}
81  
82  	/**
83  	 * @param pSession
84  	 */
85  	@Override
86  	public void init(Attributes pAttribs, SAXSession pSession) {
87  		this.iScope = 0;
88  		if (hasTrueAttribute(pAttribs, "CLASS")) this.iScope |= CIMScope.CLASS;
89  		if (hasTrueAttribute(pAttribs, "ASSOCIATION")) this.iScope |= CIMScope.ASSOCIATION;
90  		if (hasTrueAttribute(pAttribs, "REFERENCE")) this.iScope |= CIMScope.REFERENCE;
91  		if (hasTrueAttribute(pAttribs, "PROPERTY")) this.iScope |= CIMScope.PROPERTY;
92  		if (hasTrueAttribute(pAttribs, "METHOD")) this.iScope |= CIMScope.METHOD;
93  		if (hasTrueAttribute(pAttribs, "PARAMETER")) this.iScope |= CIMScope.PARAMETER;
94  		if (hasTrueAttribute(pAttribs, "INDICATION")) this.iScope |= CIMScope.INDICATION;
95  	}
96  
97  	/**
98  	 * @param pData
99  	 */
100 	@Override
101 	public void parseData(String pData) {
102 		// no data
103 	}
104 
105 	/**
106 	 * @param pNodeNameEnum
107 	 */
108 	@Override
109 	public void testChild(String pNodeNameEnum) throws SAXException {
110 		throw new SAXException("SCOPE node cannot have any child node!");
111 	}
112 
113 	/**
114 	 * @param pChild
115 	 */
116 	@Override
117 	public void childParsed(Node pChild) {
118 		// no child
119 	}
120 
121 	@Override
122 	public void testCompletness() {
123 		// Nothing to test, since it doesn't have any child node.
124 	}
125 }